OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1998-2004 David Turner and Werner Lemberg | 2 * Copyright (C) 1998-2004 David Turner and Werner Lemberg |
3 * Copyright (C) 2006 Behdad Esfahbod | 3 * Copyright (C) 2006 Behdad Esfahbod |
4 * | 4 * |
5 * This is part of HarfBuzz, an OpenType Layout engine library. | 5 * This is part of HarfBuzz, an OpenType Layout engine library. |
6 * | 6 * |
7 * Permission is hereby granted, without written agreement and without | 7 * Permission is hereby granted, without written agreement and without |
8 * license or royalty fees, to use, copy, modify, and distribute this | 8 * license or royalty fees, to use, copy, modify, and distribute this |
9 * software and its documentation for any purpose, provided that the | 9 * software and its documentation for any purpose, provided that the |
10 * above copyright notice and the following two paragraphs appear in | 10 * above copyright notice and the following two paragraphs appear in |
(...skipping 13 matching lines...) Expand all Loading... |
24 */ | 24 */ |
25 | 25 |
26 #ifndef HARFBUZZ_GDEF_H | 26 #ifndef HARFBUZZ_GDEF_H |
27 #define HARFBUZZ_GDEF_H | 27 #define HARFBUZZ_GDEF_H |
28 | 28 |
29 #include "harfbuzz-open.h" | 29 #include "harfbuzz-open.h" |
30 #include "harfbuzz-stream.h" | 30 #include "harfbuzz-stream.h" |
31 | 31 |
32 HB_BEGIN_HEADER | 32 HB_BEGIN_HEADER |
33 | 33 |
| 34 #ifdef HB_USE_PACKED_STRUCTS |
| 35 #pragma pack(push, 1) |
| 36 #endif |
| 37 |
34 /* GDEF glyph properties. Note that HB_GDEF_COMPONENT has no corresponding | 38 /* GDEF glyph properties. Note that HB_GDEF_COMPONENT has no corresponding |
35 * flag in the LookupFlag field. */ | 39 * flag in the LookupFlag field. */ |
36 #define HB_GDEF_BASE_GLYPH 0x0002 | 40 #define HB_GDEF_BASE_GLYPH 0x0002 |
37 #define HB_GDEF_LIGATURE 0x0004 | 41 #define HB_GDEF_LIGATURE 0x0004 |
38 #define HB_GDEF_MARK 0x0008 | 42 #define HB_GDEF_MARK 0x0008 |
39 #define HB_GDEF_COMPONENT 0x0010 | 43 #define HB_GDEF_COMPONENT 0x0010 |
40 | 44 |
41 | 45 |
42 typedef struct HB_AttachPoint_ HB_AttachPoint; | 46 typedef struct HB_AttachPoint_ HB_AttachPoint; |
43 | 47 |
44 | 48 |
45 struct HB_AttachList_ | 49 struct HB_AttachList_ |
46 { | 50 { |
47 HB_Bool loaded; | 51 HB_AttachPoint* AttachPoint; /* array of AttachPoint tables */ |
48 | |
49 HB_Coverage Coverage; /* Coverage table */ | 52 HB_Coverage Coverage; /* Coverage table */ |
50 HB_UShort GlyphCount; /* number of glyphs with | 53 HB_UShort GlyphCount; /* number of glyphs with |
51 attachments */ | 54 attachments */ |
52 HB_AttachPoint* AttachPoint; /* array of AttachPoint tables */ | 55 HB_Bool loaded; |
53 }; | 56 }; |
54 | 57 |
55 typedef struct HB_AttachList_ HB_AttachList; | 58 typedef struct HB_AttachList_ HB_AttachList; |
56 | 59 |
57 typedef struct HB_LigGlyph_ HB_LigGlyph; | 60 typedef struct HB_LigGlyph_ HB_LigGlyph; |
58 | 61 |
59 struct HB_LigCaretList_ | 62 struct HB_LigCaretList_ |
60 { | 63 { |
61 HB_Bool loaded; | 64 HB_LigGlyph* LigGlyph; /* array of LigGlyph tables */ |
62 | |
63 HB_Coverage Coverage; /* Coverage table */ | 65 HB_Coverage Coverage; /* Coverage table */ |
64 HB_UShort LigGlyphCount; /* number of ligature glyphs */ | 66 HB_UShort LigGlyphCount; /* number of ligature glyphs */ |
65 HB_LigGlyph* LigGlyph; /* array of LigGlyph tables */ | 67 HB_Bool loaded; |
66 }; | 68 }; |
67 | 69 |
68 typedef struct HB_LigCaretList_ HB_LigCaretList; | 70 typedef struct HB_LigCaretList_ HB_LigCaretList; |
69 | 71 |
70 | 72 |
71 | 73 |
72 /* The `NewGlyphClasses' field is not defined in the TTO specification. | 74 /* The `NewGlyphClasses' field is not defined in the TTO specification. |
73 We use it for fonts with a constructed `GlyphClassDef' structure | 75 We use it for fonts with a constructed `GlyphClassDef' structure |
74 (i.e., which don't have a GDEF table) to collect glyph classes | 76 (i.e., which don't have a GDEF table) to collect glyph classes |
75 assigned during the lookup process. The number of arrays in this | 77 assigned during the lookup process. The number of arrays in this |
76 pointer array is GlyphClassDef->cd.cd2.ClassRangeCount+1; the nth | 78 pointer array is GlyphClassDef->cd.cd2.ClassRangeCount+1; the nth |
77 array then contains the glyph class values of the glyphs not covered | 79 array then contains the glyph class values of the glyphs not covered |
78 by the ClassRangeRecords structures with index n-1 and n. We store | 80 by the ClassRangeRecords structures with index n-1 and n. We store |
79 glyph class values for four glyphs in a single array element. | 81 glyph class values for four glyphs in a single array element. |
80 | 82 |
81 `LastGlyph' is identical to the number of glyphs minus one in the | 83 `LastGlyph' is identical to the number of glyphs minus one in the |
82 font; we need it only if `NewGlyphClasses' is not NULL (to have an | 84 font; we need it only if `NewGlyphClasses' is not NULL (to have an |
83 upper bound for the last array). | 85 upper bound for the last array). |
84 | 86 |
85 Note that we first store the file offset to the `MarkAttachClassDef' | 87 Note that we first store the file offset to the `MarkAttachClassDef' |
86 field (which has been introduced in OpenType 1.2) -- since the | 88 field (which has been introduced in OpenType 1.2) -- since the |
87 `Version' field value hasn't been increased to indicate that we have | 89 `Version' field value hasn't been increased to indicate that we have |
88 one more field for some obscure reason, we must parse the GSUB table | 90 one more field for some obscure reason, we must parse the GSUB table |
89 to find out whether class values refer to this table. Only then we | 91 to find out whether class values refer to this table. Only then we |
90 can finally load the MarkAttachClassDef structure if necessary. */ | 92 can finally load the MarkAttachClassDef structure if necessary. */ |
91 | 93 |
92 struct HB_GDEFHeader_ | 94 struct HB_GDEFHeader_ |
93 { | 95 { |
| 96 HB_UShort** NewGlyphClasses; |
94 HB_UInt offset; | 97 HB_UInt offset; |
| 98 HB_UInt MarkAttachClassDef_offset; |
95 | 99 |
96 HB_16Dot16 Version; | 100 HB_16Dot16 Version; |
97 | 101 |
98 HB_ClassDefinition GlyphClassDef; | 102 HB_ClassDefinition GlyphClassDef; |
99 HB_AttachList AttachList; | 103 HB_AttachList AttachList; |
100 HB_LigCaretList LigCaretList; | 104 HB_LigCaretList LigCaretList; |
101 HB_UInt MarkAttachClassDef_offset; | |
102 HB_ClassDefinition MarkAttachClassDef; /* new in OT 1.2 */ | 105 HB_ClassDefinition MarkAttachClassDef; /* new in OT 1.2 */ |
103 | 106 |
104 HB_UShort LastGlyph; | 107 HB_UShort LastGlyph; |
105 HB_UShort** NewGlyphClasses; | |
106 }; | 108 }; |
107 | 109 |
108 typedef struct HB_GDEFHeader_ HB_GDEFHeader; | 110 typedef struct HB_GDEFHeader_ HB_GDEFHeader; |
109 typedef struct HB_GDEFHeader_* HB_GDEF; | 111 typedef struct HB_GDEFHeader_* HB_GDEF; |
110 | 112 |
111 | 113 |
112 HB_Error HB_New_GDEF_Table( HB_GDEFHeader** retptr ); | 114 HB_Error HB_New_GDEF_Table( HB_GDEFHeader** retptr ); |
113 | 115 |
114 | 116 |
115 HB_Error HB_Load_GDEF_Table( HB_Stream stream, | 117 HB_Error HB_Load_GDEF_Table( HB_Stream stream, |
116 HB_GDEFHeader** gdef ); | 118 HB_GDEFHeader** gdef ); |
117 | 119 |
118 | 120 |
119 HB_Error HB_Done_GDEF_Table ( HB_GDEFHeader* gdef ); | 121 HB_Error HB_Done_GDEF_Table ( HB_GDEFHeader* gdef ); |
120 | 122 |
121 | 123 |
122 HB_Error HB_GDEF_Get_Glyph_Property( HB_GDEFHeader* gdef, | 124 HB_Error HB_GDEF_Get_Glyph_Property( HB_GDEFHeader* gdef, |
123 HB_UShort glyphID, | 125 HB_UShort glyphID, |
124 HB_UShort* property ); | 126 HB_UShort* property ); |
125 | 127 |
126 HB_Error HB_GDEF_Build_ClassDefinition( HB_GDEFHeader* gdef, | 128 HB_Error HB_GDEF_Build_ClassDefinition( HB_GDEFHeader* gdef, |
127 HB_UShort num_glyphs, | 129 HB_UShort num_glyphs, |
128 HB_UShort glyph_count, | 130 HB_UShort glyph_count, |
129 HB_UShort* glyph_array, | 131 HB_UShort* glyph_array, |
130 HB_UShort* class_array ); | 132 HB_UShort* class_array ); |
131 | 133 |
| 134 #ifdef HB_USE_PACKED_STRUCTS |
| 135 #pragma pack(pop) |
| 136 #endif |
132 | 137 |
133 HB_END_HEADER | 138 HB_END_HEADER |
134 | 139 |
135 #endif /* HARFBUZZ_GDEF_H */ | 140 #endif /* HARFBUZZ_GDEF_H */ |
OLD | NEW |