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 14 matching lines...) Expand all Loading... |
25 | 25 |
26 #ifndef HARFBUZZ_GSUB_PRIVATE_H | 26 #ifndef HARFBUZZ_GSUB_PRIVATE_H |
27 #define HARFBUZZ_GSUB_PRIVATE_H | 27 #define HARFBUZZ_GSUB_PRIVATE_H |
28 | 28 |
29 #include "harfbuzz-impl.h" | 29 #include "harfbuzz-impl.h" |
30 #include "harfbuzz-stream-private.h" | 30 #include "harfbuzz-stream-private.h" |
31 #include "harfbuzz-gsub.h" | 31 #include "harfbuzz-gsub.h" |
32 | 32 |
33 HB_BEGIN_HEADER | 33 HB_BEGIN_HEADER |
34 | 34 |
| 35 #ifdef HB_USE_PACKED_STRUCTS |
| 36 #pragma pack(push, 1) |
| 37 #endif |
35 | 38 |
36 typedef union HB_GSUB_SubTable_ HB_GSUB_SubTable; | 39 typedef union HB_GSUB_SubTable_ HB_GSUB_SubTable; |
37 | 40 |
38 /* LookupType 1 */ | 41 /* LookupType 1 */ |
39 | 42 |
40 struct HB_SingleSubstFormat1_ | 43 struct HB_SingleSubstFormat1_ |
41 { | 44 { |
42 HB_Short DeltaGlyphID; /* constant added to get | 45 HB_Short DeltaGlyphID; /* constant added to get |
43 substitution glyph index */ | 46 substitution glyph index */ |
44 }; | 47 }; |
45 | 48 |
46 typedef struct HB_SingleSubstFormat1_ HB_SingleSubstFormat1; | 49 typedef struct HB_SingleSubstFormat1_ HB_SingleSubstFormat1; |
47 | 50 |
48 | 51 |
49 struct HB_SingleSubstFormat2_ | 52 struct HB_SingleSubstFormat2_ |
50 { | 53 { |
| 54 HB_UShort* Substitute; /* array of substitute glyph IDs */ |
51 HB_UShort GlyphCount; /* number of glyph IDs in | 55 HB_UShort GlyphCount; /* number of glyph IDs in |
52 Substitute array */ | 56 Substitute array */ |
53 HB_UShort* Substitute; /* array of substitute glyph IDs */ | |
54 }; | 57 }; |
55 | 58 |
56 typedef struct HB_SingleSubstFormat2_ HB_SingleSubstFormat2; | 59 typedef struct HB_SingleSubstFormat2_ HB_SingleSubstFormat2; |
57 | 60 |
58 | 61 |
59 struct HB_SingleSubst_ | 62 struct HB_SingleSubst_ |
60 { | 63 { |
61 HB_UShort SubstFormat; /* 1 or 2 */ | |
62 HB_Coverage Coverage; /* Coverage table */ | |
63 | |
64 union | 64 union |
65 { | 65 { |
66 HB_SingleSubstFormat1 ssf1; | 66 HB_SingleSubstFormat1 ssf1; |
67 HB_SingleSubstFormat2 ssf2; | 67 HB_SingleSubstFormat2 ssf2; |
68 } ssf; | 68 } ssf; |
| 69 |
| 70 HB_Coverage Coverage; /* Coverage table */ |
| 71 HB_Byte SubstFormat; /* 1 or 2 */ |
69 }; | 72 }; |
70 | 73 |
71 typedef struct HB_SingleSubst_ HB_SingleSubst; | 74 typedef struct HB_SingleSubst_ HB_SingleSubst; |
72 | 75 |
73 | 76 |
74 /* LookupType 2 */ | 77 /* LookupType 2 */ |
75 | 78 |
76 struct HB_Sequence_ | 79 struct HB_Sequence_ |
77 { | 80 { |
| 81 HB_UShort* Substitute; /* string of glyph IDs to |
| 82 substitute */ |
78 HB_UShort GlyphCount; /* number of glyph IDs in the | 83 HB_UShort GlyphCount; /* number of glyph IDs in the |
79 Substitute array */ | 84 Substitute array */ |
80 HB_UShort* Substitute; /* string of glyph IDs to | |
81 substitute */ | |
82 }; | 85 }; |
83 | 86 |
84 typedef struct HB_Sequence_ HB_Sequence; | 87 typedef struct HB_Sequence_ HB_Sequence; |
85 | 88 |
86 | 89 |
87 struct HB_MultipleSubst_ | 90 struct HB_MultipleSubst_ |
88 { | 91 { |
| 92 HB_Sequence* Sequence; /* array of Sequence tables */ |
| 93 HB_Coverage Coverage; /* Coverage table */ |
89 HB_UShort SubstFormat; /* always 1 */ | 94 HB_UShort SubstFormat; /* always 1 */ |
90 HB_Coverage Coverage; /* Coverage table */ | |
91 HB_UShort SequenceCount; /* number of Sequence tables */ | 95 HB_UShort SequenceCount; /* number of Sequence tables */ |
92 HB_Sequence* Sequence; /* array of Sequence tables */ | |
93 }; | 96 }; |
94 | 97 |
95 typedef struct HB_MultipleSubst_ HB_MultipleSubst; | 98 typedef struct HB_MultipleSubst_ HB_MultipleSubst; |
96 | 99 |
97 | 100 |
98 /* LookupType 3 */ | 101 /* LookupType 3 */ |
99 | 102 |
100 struct HB_AlternateSet_ | 103 struct HB_AlternateSet_ |
101 { | 104 { |
| 105 HB_UShort* Alternate; /* array of alternate glyph IDs */ |
102 HB_UShort GlyphCount; /* number of glyph IDs in the | 106 HB_UShort GlyphCount; /* number of glyph IDs in the |
103 Alternate array */ | 107 Alternate array */ |
104 HB_UShort* Alternate; /* array of alternate glyph IDs */ | |
105 }; | 108 }; |
106 | 109 |
107 typedef struct HB_AlternateSet_ HB_AlternateSet; | 110 typedef struct HB_AlternateSet_ HB_AlternateSet; |
108 | 111 |
109 | 112 |
110 struct HB_AlternateSubst_ | 113 struct HB_AlternateSubst_ |
111 { | 114 { |
| 115 HB_AlternateSet* AlternateSet; /* array of AlternateSet tables */ |
| 116 HB_Coverage Coverage; /* Coverage table */ |
112 HB_UShort SubstFormat; /* always 1 */ | 117 HB_UShort SubstFormat; /* always 1 */ |
113 HB_Coverage Coverage; /* Coverage table */ | |
114 HB_UShort AlternateSetCount; | 118 HB_UShort AlternateSetCount; |
115 /* number of AlternateSet tables */ | 119 /* number of AlternateSet tables */ |
116 HB_AlternateSet* AlternateSet; /* array of AlternateSet tables */ | |
117 }; | 120 }; |
118 | 121 |
119 typedef struct HB_AlternateSubst_ HB_AlternateSubst; | 122 typedef struct HB_AlternateSubst_ HB_AlternateSubst; |
120 | 123 |
121 | 124 |
122 /* LookupType 4 */ | 125 /* LookupType 4 */ |
123 | 126 |
124 struct HB_Ligature_ | 127 struct HB_Ligature_ |
125 { | 128 { |
| 129 HB_UShort* Component; /* array of component glyph IDs */ |
126 HB_UShort LigGlyph; /* glyphID of ligature | 130 HB_UShort LigGlyph; /* glyphID of ligature |
127 to substitute */ | 131 to substitute */ |
128 HB_UShort ComponentCount; /* number of components in ligature */ | 132 HB_UShort ComponentCount; /* number of components in ligature */ |
129 HB_UShort* Component; /* array of component glyph IDs */ | |
130 }; | 133 }; |
131 | 134 |
132 typedef struct HB_Ligature_ HB_Ligature; | 135 typedef struct HB_Ligature_ HB_Ligature; |
133 | 136 |
134 | 137 |
135 struct HB_LigatureSet_ | 138 struct HB_LigatureSet_ |
136 { | 139 { |
| 140 HB_Ligature* Ligature; /* array of Ligature tables */ |
137 HB_UShort LigatureCount; /* number of Ligature tables */ | 141 HB_UShort LigatureCount; /* number of Ligature tables */ |
138 HB_Ligature* Ligature; /* array of Ligature tables */ | |
139 }; | 142 }; |
140 | 143 |
141 typedef struct HB_LigatureSet_ HB_LigatureSet; | 144 typedef struct HB_LigatureSet_ HB_LigatureSet; |
142 | 145 |
143 | 146 |
144 struct HB_LigatureSubst_ | 147 struct HB_LigatureSubst_ |
145 { | 148 { |
| 149 HB_LigatureSet* LigatureSet; /* array of LigatureSet tables */ |
| 150 HB_Coverage Coverage; /* Coverage table */ |
146 HB_UShort SubstFormat; /* always 1 */ | 151 HB_UShort SubstFormat; /* always 1 */ |
147 HB_Coverage Coverage; /* Coverage table */ | |
148 HB_UShort LigatureSetCount; /* number of LigatureSet tables */ | 152 HB_UShort LigatureSetCount; /* number of LigatureSet tables */ |
149 HB_LigatureSet* LigatureSet; /* array of LigatureSet tables */ | |
150 }; | 153 }; |
151 | 154 |
152 typedef struct HB_LigatureSubst_ HB_LigatureSubst; | 155 typedef struct HB_LigatureSubst_ HB_LigatureSubst; |
153 | 156 |
154 | 157 |
155 /* needed by both lookup type 5 and 6 */ | 158 /* needed by both lookup type 5 and 6 */ |
156 | 159 |
157 struct HB_SubstLookupRecord_ | 160 struct HB_SubstLookupRecord_ |
158 { | 161 { |
159 HB_UShort SequenceIndex; /* index into current | 162 HB_UShort SequenceIndex; /* index into current |
160 glyph sequence */ | 163 glyph sequence */ |
161 HB_UShort LookupListIndex; /* Lookup to apply to that pos. */ | 164 HB_UShort LookupListIndex; /* Lookup to apply to that pos. */ |
162 }; | 165 }; |
163 | 166 |
164 typedef struct HB_SubstLookupRecord_ HB_SubstLookupRecord; | 167 typedef struct HB_SubstLookupRecord_ HB_SubstLookupRecord; |
165 | 168 |
166 | 169 |
167 /* LookupType 5 */ | 170 /* LookupType 5 */ |
168 | 171 |
169 struct HB_SubRule_ | 172 struct HB_SubRule_ |
170 { | 173 { |
171 HB_UShort GlyphCount; /* total number of input glyphs */ | |
172 HB_UShort SubstCount; /* number of SubstLookupRecord | |
173 tables */ | |
174 HB_UShort* Input; /* array of input glyph IDs */ | 174 HB_UShort* Input; /* array of input glyph IDs */ |
175 HB_SubstLookupRecord* SubstLookupRecord; | 175 HB_SubstLookupRecord* SubstLookupRecord; |
176 /* array of SubstLookupRecord | 176 /* array of SubstLookupRecord |
177 tables */ | 177 tables */ |
| 178 HB_UShort GlyphCount; /* total number of input glyphs */ |
| 179 HB_UShort SubstCount; /* number of SubstLookupRecord |
| 180 tables */ |
178 }; | 181 }; |
179 | 182 |
180 typedef struct HB_SubRule_ HB_SubRule; | 183 typedef struct HB_SubRule_ HB_SubRule; |
181 | 184 |
182 | 185 |
183 struct HB_SubRuleSet_ | 186 struct HB_SubRuleSet_ |
184 { | 187 { |
| 188 HB_SubRule* SubRule; /* array of SubRule tables */ |
185 HB_UShort SubRuleCount; /* number of SubRule tables */ | 189 HB_UShort SubRuleCount; /* number of SubRule tables */ |
186 HB_SubRule* SubRule; /* array of SubRule tables */ | |
187 }; | 190 }; |
188 | 191 |
189 typedef struct HB_SubRuleSet_ HB_SubRuleSet; | 192 typedef struct HB_SubRuleSet_ HB_SubRuleSet; |
190 | 193 |
191 | 194 |
192 struct HB_ContextSubstFormat1_ | 195 struct HB_ContextSubstFormat1_ |
193 { | 196 { |
| 197 HB_SubRuleSet* SubRuleSet; /* array of SubRuleSet tables */ |
194 HB_Coverage Coverage; /* Coverage table */ | 198 HB_Coverage Coverage; /* Coverage table */ |
195 HB_UShort SubRuleSetCount; /* number of SubRuleSet tables */ | 199 HB_UShort SubRuleSetCount; /* number of SubRuleSet tables */ |
196 HB_SubRuleSet* SubRuleSet; /* array of SubRuleSet tables */ | |
197 }; | 200 }; |
198 | 201 |
199 typedef struct HB_ContextSubstFormat1_ HB_ContextSubstFormat1; | 202 typedef struct HB_ContextSubstFormat1_ HB_ContextSubstFormat1; |
200 | 203 |
201 | 204 |
202 struct HB_SubClassRule_ | 205 struct HB_SubClassRule_ |
203 { | 206 { |
204 HB_UShort GlyphCount; /* total number of context classes */ | |
205 HB_UShort SubstCount; /* number of SubstLookupRecord | |
206 tables */ | |
207 HB_UShort* Class; /* array of classes */ | 207 HB_UShort* Class; /* array of classes */ |
208 HB_SubstLookupRecord* SubstLookupRecord; | 208 HB_SubstLookupRecord* SubstLookupRecord; |
209 /* array of SubstLookupRecord | 209 /* array of SubstLookupRecord |
210 tables */ | 210 tables */ |
| 211 HB_UShort GlyphCount; /* total number of context classes */ |
| 212 HB_UShort SubstCount; /* number of SubstLookupRecord |
| 213 tables */ |
211 }; | 214 }; |
212 | 215 |
213 typedef struct HB_SubClassRule_ HB_SubClassRule; | 216 typedef struct HB_SubClassRule_ HB_SubClassRule; |
214 | 217 |
215 | 218 |
216 struct HB_SubClassSet_ | 219 struct HB_SubClassSet_ |
217 { | 220 { |
| 221 HB_SubClassRule* SubClassRule; /* array of SubClassRule tables */ |
218 HB_UShort SubClassRuleCount; | 222 HB_UShort SubClassRuleCount; |
219 /* number of SubClassRule tables */ | 223 /* number of SubClassRule tables */ |
220 HB_SubClassRule* SubClassRule; /* array of SubClassRule tables */ | |
221 }; | 224 }; |
222 | 225 |
223 typedef struct HB_SubClassSet_ HB_SubClassSet; | 226 typedef struct HB_SubClassSet_ HB_SubClassSet; |
224 | 227 |
225 | 228 |
226 /* The `MaxContextLength' field is not defined in the TTO specification | 229 /* The `MaxContextLength' field is not defined in the TTO specification |
227 but simplifies the implementation of this format. It holds the | 230 but simplifies the implementation of this format. It holds the |
228 maximal context length used in the context rules. */ | 231 maximal context length used in the context rules. */ |
229 | 232 |
230 struct HB_ContextSubstFormat2_ | 233 struct HB_ContextSubstFormat2_ |
231 { | 234 { |
232 HB_UShort MaxContextLength; | 235 HB_SubClassSet* SubClassSet; /* array of SubClassSet tables */ |
233 » » » » /* maximal context length */ | |
234 HB_Coverage Coverage; /* Coverage table */ | 236 HB_Coverage Coverage; /* Coverage table */ |
235 HB_ClassDefinition ClassDef; /* ClassDef table */ | 237 HB_ClassDefinition ClassDef; /* ClassDef table */ |
236 HB_UShort SubClassSetCount; | 238 HB_UShort SubClassSetCount; |
237 /* number of SubClassSet tables */ | 239 /* number of SubClassSet tables */ |
238 HB_SubClassSet* SubClassSet; /* array of SubClassSet tables */ | 240 HB_UShort MaxContextLength; |
| 241 » » » » /* maximal context length */ |
239 }; | 242 }; |
240 | 243 |
241 typedef struct HB_ContextSubstFormat2_ HB_ContextSubstFormat2; | 244 typedef struct HB_ContextSubstFormat2_ HB_ContextSubstFormat2; |
242 | 245 |
243 | 246 |
244 struct HB_ContextSubstFormat3_ | 247 struct HB_ContextSubstFormat3_ |
245 { | 248 { |
246 HB_UShort GlyphCount; /* number of input glyphs */ | |
247 HB_UShort SubstCount; /* number of SubstLookupRecords */ | |
248 HB_Coverage* Coverage; /* array of Coverage tables */ | 249 HB_Coverage* Coverage; /* array of Coverage tables */ |
249 HB_SubstLookupRecord* SubstLookupRecord; | 250 HB_SubstLookupRecord* SubstLookupRecord; |
250 /* array of substitution lookups */ | 251 /* array of substitution lookups */ |
| 252 HB_UShort GlyphCount; /* number of input glyphs */ |
| 253 HB_UShort SubstCount; /* number of SubstLookupRecords */ |
251 }; | 254 }; |
252 | 255 |
253 typedef struct HB_ContextSubstFormat3_ HB_ContextSubstFormat3; | 256 typedef struct HB_ContextSubstFormat3_ HB_ContextSubstFormat3; |
254 | 257 |
255 | 258 |
256 struct HB_ContextSubst_ | 259 struct HB_ContextSubst_ |
257 { | 260 { |
258 HB_UShort SubstFormat; /* 1, 2, or 3 */ | |
259 | |
260 union | 261 union |
261 { | 262 { |
262 HB_ContextSubstFormat1 csf1; | 263 HB_ContextSubstFormat1 csf1; |
263 HB_ContextSubstFormat2 csf2; | 264 HB_ContextSubstFormat2 csf2; |
264 HB_ContextSubstFormat3 csf3; | 265 HB_ContextSubstFormat3 csf3; |
265 } csf; | 266 } csf; |
| 267 |
| 268 HB_Byte SubstFormat; /* 1, 2, or 3 */ |
266 }; | 269 }; |
267 | 270 |
268 typedef struct HB_ContextSubst_ HB_ContextSubst; | 271 typedef struct HB_ContextSubst_ HB_ContextSubst; |
269 | 272 |
270 | 273 |
271 /* LookupType 6 */ | 274 /* LookupType 6 */ |
272 | 275 |
273 struct HB_ChainSubRule_ | 276 struct HB_ChainSubRule_ |
274 { | 277 { |
| 278 HB_UShort* Backtrack; /* array of backtrack glyph IDs */ |
| 279 HB_UShort* Input; /* array of input glyph IDs */ |
| 280 HB_UShort* Lookahead; /* array of lookahead glyph IDs */ |
| 281 HB_SubstLookupRecord* SubstLookupRecord; |
| 282 /* array of SubstLookupRecords */ |
275 HB_UShort BacktrackGlyphCount; | 283 HB_UShort BacktrackGlyphCount; |
276 /* total number of backtrack glyphs */ | 284 /* total number of backtrack glyphs */ |
277 HB_UShort* Backtrack; /* array of backtrack glyph IDs */ | |
278 HB_UShort InputGlyphCount; | 285 HB_UShort InputGlyphCount; |
279 /* total number of input glyphs */ | 286 /* total number of input glyphs */ |
280 HB_UShort* Input; /* array of input glyph IDs */ | |
281 HB_UShort LookaheadGlyphCount; | 287 HB_UShort LookaheadGlyphCount; |
282 /* total number of lookahead glyphs */ | 288 /* total number of lookahead glyphs */ |
283 HB_UShort* Lookahead; /* array of lookahead glyph IDs */ | |
284 HB_UShort SubstCount; /* number of SubstLookupRecords */ | 289 HB_UShort SubstCount; /* number of SubstLookupRecords */ |
285 HB_SubstLookupRecord* SubstLookupRecord; | |
286 /* array of SubstLookupRecords */ | |
287 }; | 290 }; |
288 | 291 |
289 typedef struct HB_ChainSubRule_ HB_ChainSubRule; | 292 typedef struct HB_ChainSubRule_ HB_ChainSubRule; |
290 | 293 |
291 | 294 |
292 struct HB_ChainSubRuleSet_ | 295 struct HB_ChainSubRuleSet_ |
293 { | 296 { |
| 297 HB_ChainSubRule* ChainSubRule; /* array of ChainSubRule tables */ |
294 HB_UShort ChainSubRuleCount; | 298 HB_UShort ChainSubRuleCount; |
295 /* number of ChainSubRule tables */ | 299 /* number of ChainSubRule tables */ |
296 HB_ChainSubRule* ChainSubRule; /* array of ChainSubRule tables */ | |
297 }; | 300 }; |
298 | 301 |
299 typedef struct HB_ChainSubRuleSet_ HB_ChainSubRuleSet; | 302 typedef struct HB_ChainSubRuleSet_ HB_ChainSubRuleSet; |
300 | 303 |
301 | 304 |
302 struct HB_ChainContextSubstFormat1_ | 305 struct HB_ChainContextSubstFormat1_ |
303 { | 306 { |
| 307 HB_ChainSubRuleSet* ChainSubRuleSet; |
| 308 /* array of ChainSubRuleSet tables */ |
304 HB_Coverage Coverage; /* Coverage table */ | 309 HB_Coverage Coverage; /* Coverage table */ |
305 HB_UShort ChainSubRuleSetCount; | 310 HB_UShort ChainSubRuleSetCount; |
306 /* number of ChainSubRuleSet tables */ | 311 /* number of ChainSubRuleSet tables */ |
307 HB_ChainSubRuleSet* ChainSubRuleSet; | |
308 /* array of ChainSubRuleSet tables */ | |
309 }; | 312 }; |
310 | 313 |
311 typedef struct HB_ChainContextSubstFormat1_ HB_ChainContextSubstFormat1; | 314 typedef struct HB_ChainContextSubstFormat1_ HB_ChainContextSubstFormat1; |
312 | 315 |
313 | 316 |
314 struct HB_ChainSubClassRule_ | 317 struct HB_ChainSubClassRule_ |
315 { | 318 { |
| 319 HB_UShort* Backtrack; /* array of backtrack classes */ |
| 320 HB_UShort* Input; /* array of context classes */ |
| 321 HB_UShort* Lookahead; /* array of lookahead classes */ |
| 322 HB_SubstLookupRecord* SubstLookupRecord; |
| 323 /* array of substitution lookups */ |
316 HB_UShort BacktrackGlyphCount; | 324 HB_UShort BacktrackGlyphCount; |
317 /* total number of backtrack | 325 /* total number of backtrack |
318 classes */ | 326 classes */ |
319 HB_UShort* Backtrack; /* array of backtrack classes */ | |
320 HB_UShort InputGlyphCount; | 327 HB_UShort InputGlyphCount; |
321 /* total number of context classes */ | 328 /* total number of context classes */ |
322 HB_UShort* Input; /* array of context classes */ | |
323 HB_UShort LookaheadGlyphCount; | 329 HB_UShort LookaheadGlyphCount; |
324 /* total number of lookahead | 330 /* total number of lookahead |
325 classes */ | 331 classes */ |
326 HB_UShort* Lookahead; /* array of lookahead classes */ | |
327 HB_UShort SubstCount; /* number of SubstLookupRecords */ | 332 HB_UShort SubstCount; /* number of SubstLookupRecords */ |
328 HB_SubstLookupRecord* SubstLookupRecord; | |
329 /* array of substitution lookups */ | |
330 }; | 333 }; |
331 | 334 |
332 typedef struct HB_ChainSubClassRule_ HB_ChainSubClassRule; | 335 typedef struct HB_ChainSubClassRule_ HB_ChainSubClassRule; |
333 | 336 |
334 | 337 |
335 struct HB_ChainSubClassSet_ | 338 struct HB_ChainSubClassSet_ |
336 { | 339 { |
| 340 HB_ChainSubClassRule* ChainSubClassRule; |
| 341 /* array of ChainSubClassRule |
| 342 tables */ |
337 HB_UShort ChainSubClassRuleCount; | 343 HB_UShort ChainSubClassRuleCount; |
338 /* number of ChainSubClassRule | 344 /* number of ChainSubClassRule |
339 tables */ | 345 tables */ |
340 HB_ChainSubClassRule* ChainSubClassRule; | |
341 /* array of ChainSubClassRule | |
342 tables */ | |
343 }; | 346 }; |
344 | 347 |
345 typedef struct HB_ChainSubClassSet_ HB_ChainSubClassSet; | 348 typedef struct HB_ChainSubClassSet_ HB_ChainSubClassSet; |
346 | 349 |
347 | 350 |
348 /* The `MaxXXXLength' fields are not defined in the TTO specification | 351 /* The `MaxXXXLength' fields are not defined in the TTO specification |
349 but simplifies the implementation of this format. It holds the | 352 but simplifies the implementation of this format. It holds the |
350 maximal context length used in the specific context rules. */ | 353 maximal context length used in the specific context rules. */ |
351 | 354 |
352 struct HB_ChainContextSubstFormat2_ | 355 struct HB_ChainContextSubstFormat2_ |
353 { | 356 { |
| 357 HB_ChainSubClassSet* ChainSubClassSet; |
| 358 /* array of ChainSubClassSet |
| 359 tables */ |
354 HB_Coverage Coverage; /* Coverage table */ | 360 HB_Coverage Coverage; /* Coverage table */ |
355 | 361 |
356 HB_UShort MaxBacktrackLength; | |
357 /* maximal backtrack length */ | |
358 HB_ClassDefinition BacktrackClassDef; | 362 HB_ClassDefinition BacktrackClassDef; |
359 /* BacktrackClassDef table */ | 363 /* BacktrackClassDef table */ |
360 HB_UShort MaxInputLength; | |
361 /* maximal input length */ | |
362 HB_ClassDefinition InputClassDef; | 364 HB_ClassDefinition InputClassDef; |
363 /* InputClassDef table */ | 365 /* InputClassDef table */ |
364 HB_UShort MaxLookaheadLength; | |
365 /* maximal lookahead length */ | |
366 HB_ClassDefinition LookaheadClassDef; | 366 HB_ClassDefinition LookaheadClassDef; |
367 /* LookaheadClassDef table */ | 367 /* LookaheadClassDef table */ |
368 | 368 |
369 HB_UShort ChainSubClassSetCount; | 369 HB_UShort ChainSubClassSetCount; |
370 /* number of ChainSubClassSet | 370 /* number of ChainSubClassSet |
371 tables */ | 371 tables */ |
372 HB_ChainSubClassSet* ChainSubClassSet; | 372 HB_UShort MaxBacktrackLength; |
373 » » » » /* array of ChainSubClassSet | 373 » » » » /* maximal backtrack length */ |
374 » » » » » tables */ | 374 HB_UShort MaxLookaheadLength; |
| 375 » » » » /* maximal lookahead length */ |
| 376 HB_UShort MaxInputLength; |
| 377 » » » » /* maximal input length */ |
375 }; | 378 }; |
376 | 379 |
377 typedef struct HB_ChainContextSubstFormat2_ HB_ChainContextSubstFormat2; | 380 typedef struct HB_ChainContextSubstFormat2_ HB_ChainContextSubstFormat2; |
378 | 381 |
379 | 382 |
380 struct HB_ChainContextSubstFormat3_ | 383 struct HB_ChainContextSubstFormat3_ |
381 { | 384 { |
382 HB_UShort BacktrackGlyphCount; | |
383 /* number of backtrack glyphs */ | |
384 HB_Coverage* BacktrackCoverage; | 385 HB_Coverage* BacktrackCoverage; |
385 /* array of backtrack Coverage | 386 /* array of backtrack Coverage |
386 tables */ | 387 tables */ |
387 HB_UShort InputGlyphCount; | |
388 /* number of input glyphs */ | |
389 HB_Coverage* InputCoverage; | 388 HB_Coverage* InputCoverage; |
390 /* array of input coverage | 389 /* array of input coverage |
391 tables */ | 390 tables */ |
392 HB_UShort LookaheadGlyphCount; | |
393 /* number of lookahead glyphs */ | |
394 HB_Coverage* LookaheadCoverage; | 391 HB_Coverage* LookaheadCoverage; |
395 /* array of lookahead coverage | 392 /* array of lookahead coverage |
396 tables */ | 393 tables */ |
397 HB_UShort SubstCount; /* number of SubstLookupRecords */ | |
398 HB_SubstLookupRecord* SubstLookupRecord; | 394 HB_SubstLookupRecord* SubstLookupRecord; |
399 /* array of substitution lookups */ | 395 /* array of substitution lookups */ |
| 396 HB_UShort BacktrackGlyphCount; |
| 397 /* number of backtrack glyphs */ |
| 398 HB_UShort InputGlyphCount; |
| 399 /* number of input glyphs */ |
| 400 HB_UShort LookaheadGlyphCount; |
| 401 /* number of lookahead glyphs */ |
| 402 HB_UShort SubstCount; /* number of SubstLookupRecords */ |
400 }; | 403 }; |
401 | 404 |
402 typedef struct HB_ChainContextSubstFormat3_ HB_ChainContextSubstFormat3; | 405 typedef struct HB_ChainContextSubstFormat3_ HB_ChainContextSubstFormat3; |
403 | 406 |
404 | 407 |
405 struct HB_ChainContextSubst_ | 408 struct HB_ChainContextSubst_ |
406 { | 409 { |
407 HB_UShort SubstFormat; /* 1, 2, or 3 */ | |
408 | |
409 union | 410 union |
410 { | 411 { |
411 HB_ChainContextSubstFormat1 ccsf1; | 412 HB_ChainContextSubstFormat1 ccsf1; |
412 HB_ChainContextSubstFormat2 ccsf2; | 413 HB_ChainContextSubstFormat2 ccsf2; |
413 HB_ChainContextSubstFormat3 ccsf3; | 414 HB_ChainContextSubstFormat3 ccsf3; |
414 } ccsf; | 415 } ccsf; |
| 416 |
| 417 HB_Byte SubstFormat; /* 1, 2, or 3 */ |
415 }; | 418 }; |
416 | 419 |
417 typedef struct HB_ChainContextSubst_ HB_ChainContextSubst; | 420 typedef struct HB_ChainContextSubst_ HB_ChainContextSubst; |
418 | 421 |
419 | 422 |
420 #if 0 | 423 #if 0 |
421 /* LookupType 7 */ | 424 /* LookupType 7 */ |
422 struct HB_ExtensionSubst_ | 425 struct HB_ExtensionSubst_ |
423 { | 426 { |
| 427 HB_GSUB_SubTable *subtable; /* referenced subtable */ |
424 HB_UShort SubstFormat; /* always 1 */ | 428 HB_UShort SubstFormat; /* always 1 */ |
425 HB_UShort LookuptType; /* lookup-type of referenced subtable */ | 429 HB_UShort LookuptType; /* lookup-type of referenced subtable */ |
426 HB_GSUB_SubTable *subtable; /* referenced subtable */ | |
427 }; | 430 }; |
428 | 431 |
429 typedef struct HB_ExtensionSubst_ HB_ExtensionSubst; | 432 typedef struct HB_ExtensionSubst_ HB_ExtensionSubst; |
430 #endif | 433 #endif |
431 | 434 |
432 | 435 |
433 /* LookupType 8 */ | 436 /* LookupType 8 */ |
434 struct HB_ReverseChainContextSubst_ | 437 struct HB_ReverseChainContextSubst_ |
435 { | 438 { |
436 HB_UShort SubstFormat; /* always 1 */ | 439 HB_Coverage* LookaheadCoverage; /* array of lookahead Coverage |
437 HB_Coverage Coverage;» /* coverage table for input glyphs */ | 440 » » » » » tables */ |
438 HB_UShort BacktrackGlyphCount; /* number of backtrack glyphs */ | 441 HB_UShort* Substitute; /* array of substitute Glyph ID */ |
439 HB_Coverage* BacktrackCoverage; /* array of backtrack Coverage | 442 HB_Coverage* BacktrackCoverage; /* array of backtrack Coverage |
440 tables */ | 443 tables */ |
| 444 HB_Coverage Coverage; /* coverage table for input glyphs */ |
| 445 HB_UShort SubstFormat; /* always 1 */ |
| 446 HB_UShort BacktrackGlyphCount; /* number of backtrack glyphs */ |
441 HB_UShort LookaheadGlyphCount; /* number of lookahead glyphs */ | 447 HB_UShort LookaheadGlyphCount; /* number of lookahead glyphs */ |
442 HB_Coverage* LookaheadCoverage; /* array of lookahead Coverage | |
443 tables */ | |
444 HB_UShort GlyphCount; /* number of Glyph IDs */ | 448 HB_UShort GlyphCount; /* number of Glyph IDs */ |
445 HB_UShort* Substitute; /* array of substitute Glyph ID */ | |
446 }; | 449 }; |
447 | 450 |
448 typedef struct HB_ReverseChainContextSubst_ HB_ReverseChainContextSubst; | 451 typedef struct HB_ReverseChainContextSubst_ HB_ReverseChainContextSubst; |
449 | 452 |
450 | 453 |
451 union HB_GSUB_SubTable_ | 454 union HB_GSUB_SubTable_ |
452 { | 455 { |
453 HB_SingleSubst single; | 456 HB_SingleSubst single; |
454 HB_MultipleSubst multiple; | 457 HB_MultipleSubst multiple; |
455 HB_AlternateSubst alternate; | 458 HB_AlternateSubst alternate; |
456 HB_LigatureSubst ligature; | 459 HB_LigatureSubst ligature; |
457 HB_ContextSubst context; | 460 HB_ContextSubst context; |
458 HB_ChainContextSubst chain; | 461 HB_ChainContextSubst chain; |
459 HB_ReverseChainContextSubst reverse; | 462 HB_ReverseChainContextSubst reverse; |
460 }; | 463 }; |
461 | 464 |
462 | 465 |
463 | 466 |
464 | 467 |
465 HB_INTERNAL HB_Error | 468 HB_INTERNAL HB_Error |
466 _HB_GSUB_Load_SubTable( HB_GSUB_SubTable* st, | 469 _HB_GSUB_Load_SubTable( HB_GSUB_SubTable* st, |
467 HB_Stream stream, | 470 HB_Stream stream, |
468 HB_UShort lookup_type ); | 471 HB_UShort lookup_type ); |
469 | 472 |
470 HB_INTERNAL void | 473 HB_INTERNAL void |
471 _HB_GSUB_Free_SubTable( HB_GSUB_SubTable* st, | 474 _HB_GSUB_Free_SubTable( HB_GSUB_SubTable* st, |
472 HB_UShort lookup_type ); | 475 HB_UShort lookup_type ); |
473 | 476 |
| 477 #ifdef HB_USE_PACKED_STRUCTS |
| 478 #pragma pack(pop) |
| 479 #endif |
| 480 |
474 HB_END_HEADER | 481 HB_END_HEADER |
475 | 482 |
476 #endif /* HARFBUZZ_GSUB_PRIVATE_H */ | 483 #endif /* HARFBUZZ_GSUB_PRIVATE_H */ |
OLD | NEW |