* lisp/cedet/semantic/wisent/comp.el (wisent-defcontext): Move declarations
[emacs.git] / src / macfont.h
blobe6e45ab152c6c1454730a67a4c07176dfd9690c2
1 /* Interface definition for Mac OSX Core text font backend.
2 Copyright (C) 2009-2014 Free Software Foundation, Inc.
4 This file is part of GNU Emacs.
6 GNU Emacs is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 GNU Emacs is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
19 Original author: YAMAMOTO Mitsuharu
22 /* Structure used by Mac `shape' functions for storing layout
23 information for each glyph. */
24 struct mac_glyph_layout
26 /* Range of indices of the characters composed into the group of
27 glyphs that share the cursor position with this glyph. The
28 members `location' and `length' are in UTF-16 indices. */
29 CFRange comp_range;
31 /* UTF-16 index in the source string for the first character
32 associated with this glyph. */
33 CFIndex string_index;
35 /* Horizontal and vertical adjustments of glyph position. The
36 coordinate space is that of Core Text. So, the `baseline_delta'
37 value is negative if the glyph should be placed below the
38 baseline. */
39 CGFloat advance_delta, baseline_delta;
41 /* Typographical width of the glyph. */
42 CGFloat advance;
44 /* Glyph ID of the glyph. */
45 CGGlyph glyph_id;
48 typedef CTFontDescriptorRef FontDescriptorRef;
49 typedef CTFontRef FontRef;
50 typedef CTFontSymbolicTraits FontSymbolicTraits;
51 typedef CTCharacterCollection CharacterCollection;
53 #define MAC_FONT_NAME_ATTRIBUTE kCTFontNameAttribute
54 #define MAC_FONT_FAMILY_NAME_ATTRIBUTE kCTFontFamilyNameAttribute
55 #define MAC_FONT_TRAITS_ATTRIBUTE kCTFontTraitsAttribute
56 #define MAC_FONT_SIZE_ATTRIBUTE kCTFontSizeAttribute
57 #define MAC_FONT_CASCADE_LIST_ATTRIBUTE kCTFontCascadeListAttribute
58 #define MAC_FONT_CHARACTER_SET_ATTRIBUTE kCTFontCharacterSetAttribute
59 #define MAC_FONT_LANGUAGES_ATTRIBUTE kCTFontLanguagesAttribute
60 #define MAC_FONT_FORMAT_ATTRIBUTE kCTFontFormatAttribute
61 #define MAC_FONT_SYMBOLIC_TRAIT kCTFontSymbolicTrait
62 #define MAC_FONT_WEIGHT_TRAIT kCTFontWeightTrait
63 #define MAC_FONT_WIDTH_TRAIT kCTFontWidthTrait
64 #define MAC_FONT_SLANT_TRAIT kCTFontSlantTrait
66 enum {
67 MAC_FONT_TRAIT_ITALIC = kCTFontItalicTrait,
68 MAC_FONT_TRAIT_BOLD = kCTFontBoldTrait,
69 MAC_FONT_TRAIT_MONO_SPACE = kCTFontMonoSpaceTrait,
70 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
71 MAC_FONT_TRAIT_COLOR_GLYPHS = kCTFontColorGlyphsTrait
72 #else
73 MAC_FONT_TRAIT_COLOR_GLYPHS = (1 << 13)
74 #endif
77 enum {
78 MAC_FONT_FORMAT_BITMAP = kCTFontFormatBitmap
81 enum {
82 MAC_CHARACTER_COLLECTION_IDENTITY_MAPPING = kCTIdentityMappingCharacterCollection,
83 MAC_CHARACTER_COLLECTION_ADOBE_JAPAN1 = kCTAdobeJapan1CharacterCollection
86 #define mac_font_descriptor_create_with_attributes \
87 CTFontDescriptorCreateWithAttributes
88 #define mac_font_descriptor_create_matching_font_descriptors \
89 CTFontDescriptorCreateMatchingFontDescriptors
90 #define mac_font_descriptor_create_matching_font_descriptor \
91 CTFontDescriptorCreateMatchingFontDescriptor
92 #define mac_font_descriptor_copy_attribute CTFontDescriptorCopyAttribute
93 #define mac_font_descriptor_supports_languages \
94 mac_ctfont_descriptor_supports_languages
95 #define mac_font_create_with_name(name, size) \
96 CTFontCreateWithName (name, size, NULL)
97 #define mac_font_get_size CTFontGetSize
98 #define mac_font_copy_family_name CTFontCopyFamilyName
99 #define mac_font_copy_character_set CTFontCopyCharacterSet
100 #define mac_font_get_glyphs_for_characters CTFontGetGlyphsForCharacters
101 #define mac_font_get_ascent CTFontGetAscent
102 #define mac_font_get_descent CTFontGetDescent
103 #define mac_font_get_leading CTFontGetLeading
104 #define mac_font_get_underline_position CTFontGetUnderlinePosition
105 #define mac_font_get_underline_thickness CTFontGetUnderlineThickness
106 #define mac_font_copy_graphics_font(font) CTFontCopyGraphicsFont (font, NULL)
107 #define mac_font_copy_non_synthetic_table(font, table) \
108 CTFontCopyTable (font, table, kCTFontTableOptionNoOptions)
110 #define mac_font_create_preferred_family_for_attributes \
111 mac_ctfont_create_preferred_family_for_attributes
112 #define mac_font_get_advance_width_for_glyph \
113 mac_ctfont_get_advance_width_for_glyph
114 #define mac_font_get_bounding_rect_for_glyph \
115 mac_ctfont_get_bounding_rect_for_glyph
116 #define mac_font_create_available_families mac_ctfont_create_available_families
117 #define mac_font_shape mac_ctfont_shape
118 #if USE_CT_GLYPH_INFO
119 #define mac_font_get_glyph_for_cid mac_ctfont_get_glyph_for_cid
120 #endif
122 #define mac_nsctfont_copy_font_descriptor CTFontCopyFontDescriptor
124 #ifndef kCTVersionNumber10_9
125 #define kCTVersionNumber10_9 0x00060000
126 #endif
127 #define MAC_FONT_CHARACTER_SET_STRING_ATTRIBUTE \
128 (CFSTR ("MAC_FONT_CHARACTER_SET_STRING_ATTRIBUTE"))
130 typedef const struct _EmacsScreenFont *ScreenFontRef; /* opaque */
132 extern void mac_register_font_driver (struct frame *f);
133 extern void *macfont_get_nsctfont (struct font *font);
134 extern void macfont_update_antialias_threshold (void);