1
/*******************************************************************
3
* Copyright 1996-2000 by
4
* David Turner, Robert Wilhelm, and Werner Lemberg.
6
* Copyright 2006 Behdad Esfahbod
8
* This is part of HarfBuzz, an OpenType Layout engine library.
10
* See the file name COPYING for licensing information.
12
******************************************************************/
13
#ifndef HARFBUZZ_GSUB_PRIVATE_H
14
#define HARFBUZZ_GSUB_PRIVATE_H
16
#include "harfbuzz-gsub.h"
21
typedef union HB_GSUB_SubTable_ HB_GSUB_SubTable;
25
struct HB_SingleSubstFormat1_
27
FT_Short DeltaGlyphID; /* constant added to get
28
substitution glyph index */
31
typedef struct HB_SingleSubstFormat1_ HB_SingleSubstFormat1;
34
struct HB_SingleSubstFormat2_
36
FT_UShort GlyphCount; /* number of glyph IDs in
38
FT_UShort* Substitute; /* array of substitute glyph IDs */
41
typedef struct HB_SingleSubstFormat2_ HB_SingleSubstFormat2;
44
struct HB_SingleSubst_
46
FT_UShort SubstFormat; /* 1 or 2 */
47
HB_Coverage Coverage; /* Coverage table */
51
HB_SingleSubstFormat1 ssf1;
52
HB_SingleSubstFormat2 ssf2;
56
typedef struct HB_SingleSubst_ HB_SingleSubst;
63
FT_UShort GlyphCount; /* number of glyph IDs in the
65
FT_UShort* Substitute; /* string of glyph IDs to
69
typedef struct HB_Sequence_ HB_Sequence;
72
struct HB_MultipleSubst_
74
FT_UShort SubstFormat; /* always 1 */
75
HB_Coverage Coverage; /* Coverage table */
76
FT_UShort SequenceCount; /* number of Sequence tables */
77
HB_Sequence* Sequence; /* array of Sequence tables */
80
typedef struct HB_MultipleSubst_ HB_MultipleSubst;
85
struct HB_AlternateSet_
87
FT_UShort GlyphCount; /* number of glyph IDs in the
89
FT_UShort* Alternate; /* array of alternate glyph IDs */
92
typedef struct HB_AlternateSet_ HB_AlternateSet;
95
struct HB_AlternateSubst_
97
FT_UShort SubstFormat; /* always 1 */
98
HB_Coverage Coverage; /* Coverage table */
99
FT_UShort AlternateSetCount;
100
/* number of AlternateSet tables */
101
HB_AlternateSet* AlternateSet; /* array of AlternateSet tables */
104
typedef struct HB_AlternateSubst_ HB_AlternateSubst;
111
FT_UShort LigGlyph; /* glyphID of ligature
113
FT_UShort ComponentCount; /* number of components in ligature */
114
FT_UShort* Component; /* array of component glyph IDs */
117
typedef struct HB_Ligature_ HB_Ligature;
120
struct HB_LigatureSet_
122
FT_UShort LigatureCount; /* number of Ligature tables */
123
HB_Ligature* Ligature; /* array of Ligature tables */
126
typedef struct HB_LigatureSet_ HB_LigatureSet;
129
struct HB_LigatureSubst_
131
FT_UShort SubstFormat; /* always 1 */
132
HB_Coverage Coverage; /* Coverage table */
133
FT_UShort LigatureSetCount; /* number of LigatureSet tables */
134
HB_LigatureSet* LigatureSet; /* array of LigatureSet tables */
137
typedef struct HB_LigatureSubst_ HB_LigatureSubst;
140
/* needed by both lookup type 5 and 6 */
142
struct HB_SubstLookupRecord_
144
FT_UShort SequenceIndex; /* index into current
146
FT_UShort LookupListIndex; /* Lookup to apply to that pos. */
149
typedef struct HB_SubstLookupRecord_ HB_SubstLookupRecord;
156
FT_UShort GlyphCount; /* total number of input glyphs */
157
FT_UShort SubstCount; /* number of SubstLookupRecord
159
FT_UShort* Input; /* array of input glyph IDs */
160
HB_SubstLookupRecord* SubstLookupRecord;
161
/* array of SubstLookupRecord
165
typedef struct HB_SubRule_ HB_SubRule;
168
struct HB_SubRuleSet_
170
FT_UShort SubRuleCount; /* number of SubRule tables */
171
HB_SubRule* SubRule; /* array of SubRule tables */
174
typedef struct HB_SubRuleSet_ HB_SubRuleSet;
177
struct HB_ContextSubstFormat1_
179
HB_Coverage Coverage; /* Coverage table */
180
FT_UShort SubRuleSetCount; /* number of SubRuleSet tables */
181
HB_SubRuleSet* SubRuleSet; /* array of SubRuleSet tables */
184
typedef struct HB_ContextSubstFormat1_ HB_ContextSubstFormat1;
187
struct HB_SubClassRule_
189
FT_UShort GlyphCount; /* total number of context classes */
190
FT_UShort SubstCount; /* number of SubstLookupRecord
192
FT_UShort* Class; /* array of classes */
193
HB_SubstLookupRecord* SubstLookupRecord;
194
/* array of SubstLookupRecord
198
typedef struct HB_SubClassRule_ HB_SubClassRule;
201
struct HB_SubClassSet_
203
FT_UShort SubClassRuleCount;
204
/* number of SubClassRule tables */
205
HB_SubClassRule* SubClassRule; /* array of SubClassRule tables */
208
typedef struct HB_SubClassSet_ HB_SubClassSet;
211
/* The `MaxContextLength' field is not defined in the TTO specification
212
but simplifies the implementation of this format. It holds the
213
maximal context length used in the context rules. */
215
struct HB_ContextSubstFormat2_
217
FT_UShort MaxContextLength;
218
/* maximal context length */
219
HB_Coverage Coverage; /* Coverage table */
220
HB_ClassDefinition ClassDef; /* ClassDef table */
221
FT_UShort SubClassSetCount;
222
/* number of SubClassSet tables */
223
HB_SubClassSet* SubClassSet; /* array of SubClassSet tables */
226
typedef struct HB_ContextSubstFormat2_ HB_ContextSubstFormat2;
229
struct HB_ContextSubstFormat3_
231
FT_UShort GlyphCount; /* number of input glyphs */
232
FT_UShort SubstCount; /* number of SubstLookupRecords */
233
HB_Coverage* Coverage; /* array of Coverage tables */
234
HB_SubstLookupRecord* SubstLookupRecord;
235
/* array of substitution lookups */
238
typedef struct HB_ContextSubstFormat3_ HB_ContextSubstFormat3;
241
struct HB_ContextSubst_
243
FT_UShort SubstFormat; /* 1, 2, or 3 */
247
HB_ContextSubstFormat1 csf1;
248
HB_ContextSubstFormat2 csf2;
249
HB_ContextSubstFormat3 csf3;
253
typedef struct HB_ContextSubst_ HB_ContextSubst;
258
struct HB_ChainSubRule_
260
FT_UShort BacktrackGlyphCount;
261
/* total number of backtrack glyphs */
262
FT_UShort* Backtrack; /* array of backtrack glyph IDs */
263
FT_UShort InputGlyphCount;
264
/* total number of input glyphs */
265
FT_UShort* Input; /* array of input glyph IDs */
266
FT_UShort LookaheadGlyphCount;
267
/* total number of lookahead glyphs */
268
FT_UShort* Lookahead; /* array of lookahead glyph IDs */
269
FT_UShort SubstCount; /* number of SubstLookupRecords */
270
HB_SubstLookupRecord* SubstLookupRecord;
271
/* array of SubstLookupRecords */
274
typedef struct HB_ChainSubRule_ HB_ChainSubRule;
277
struct HB_ChainSubRuleSet_
279
FT_UShort ChainSubRuleCount;
280
/* number of ChainSubRule tables */
281
HB_ChainSubRule* ChainSubRule; /* array of ChainSubRule tables */
284
typedef struct HB_ChainSubRuleSet_ HB_ChainSubRuleSet;
287
struct HB_ChainContextSubstFormat1_
289
HB_Coverage Coverage; /* Coverage table */
290
FT_UShort ChainSubRuleSetCount;
291
/* number of ChainSubRuleSet tables */
292
HB_ChainSubRuleSet* ChainSubRuleSet;
293
/* array of ChainSubRuleSet tables */
296
typedef struct HB_ChainContextSubstFormat1_ HB_ChainContextSubstFormat1;
299
struct HB_ChainSubClassRule_
301
FT_UShort BacktrackGlyphCount;
302
/* total number of backtrack
304
FT_UShort* Backtrack; /* array of backtrack classes */
305
FT_UShort InputGlyphCount;
306
/* total number of context classes */
307
FT_UShort* Input; /* array of context classes */
308
FT_UShort LookaheadGlyphCount;
309
/* total number of lookahead
311
FT_UShort* Lookahead; /* array of lookahead classes */
312
FT_UShort SubstCount; /* number of SubstLookupRecords */
313
HB_SubstLookupRecord* SubstLookupRecord;
314
/* array of substitution lookups */
317
typedef struct HB_ChainSubClassRule_ HB_ChainSubClassRule;
320
struct HB_ChainSubClassSet_
322
FT_UShort ChainSubClassRuleCount;
323
/* number of ChainSubClassRule
325
HB_ChainSubClassRule* ChainSubClassRule;
326
/* array of ChainSubClassRule
330
typedef struct HB_ChainSubClassSet_ HB_ChainSubClassSet;
333
/* The `MaxXXXLength' fields are not defined in the TTO specification
334
but simplifies the implementation of this format. It holds the
335
maximal context length used in the specific context rules. */
337
struct HB_ChainContextSubstFormat2_
339
HB_Coverage Coverage; /* Coverage table */
341
FT_UShort MaxBacktrackLength;
342
/* maximal backtrack length */
343
HB_ClassDefinition BacktrackClassDef;
344
/* BacktrackClassDef table */
345
FT_UShort MaxInputLength;
346
/* maximal input length */
347
HB_ClassDefinition InputClassDef;
348
/* InputClassDef table */
349
FT_UShort MaxLookaheadLength;
350
/* maximal lookahead length */
351
HB_ClassDefinition LookaheadClassDef;
352
/* LookaheadClassDef table */
354
FT_UShort ChainSubClassSetCount;
355
/* number of ChainSubClassSet
357
HB_ChainSubClassSet* ChainSubClassSet;
358
/* array of ChainSubClassSet
362
typedef struct HB_ChainContextSubstFormat2_ HB_ChainContextSubstFormat2;
365
struct HB_ChainContextSubstFormat3_
367
FT_UShort BacktrackGlyphCount;
368
/* number of backtrack glyphs */
369
HB_Coverage* BacktrackCoverage;
370
/* array of backtrack Coverage
372
FT_UShort InputGlyphCount;
373
/* number of input glyphs */
374
HB_Coverage* InputCoverage;
375
/* array of input coverage
377
FT_UShort LookaheadGlyphCount;
378
/* number of lookahead glyphs */
379
HB_Coverage* LookaheadCoverage;
380
/* array of lookahead coverage
382
FT_UShort SubstCount; /* number of SubstLookupRecords */
383
HB_SubstLookupRecord* SubstLookupRecord;
384
/* array of substitution lookups */
387
typedef struct HB_ChainContextSubstFormat3_ HB_ChainContextSubstFormat3;
390
struct HB_ChainContextSubst_
392
FT_UShort SubstFormat; /* 1, 2, or 3 */
396
HB_ChainContextSubstFormat1 ccsf1;
397
HB_ChainContextSubstFormat2 ccsf2;
398
HB_ChainContextSubstFormat3 ccsf3;
402
typedef struct HB_ChainContextSubst_ HB_ChainContextSubst;
406
struct HB_ReverseChainContextSubst_
408
FT_UShort SubstFormat; /* always 1 */
409
HB_Coverage Coverage; /* coverage table for input glyphs */
410
FT_UShort BacktrackGlyphCount; /* number of backtrack glyphs */
411
HB_Coverage* BacktrackCoverage; /* array of backtrack Coverage
413
FT_UShort LookaheadGlyphCount; /* number of lookahead glyphs */
414
HB_Coverage* LookaheadCoverage; /* array of lookahead Coverage
416
FT_UShort GlyphCount; /* number of Glyph IDs */
417
FT_UShort* Substitute; /* array of substitute Glyph ID */
420
typedef struct HB_ReverseChainContextSubst_ HB_ReverseChainContextSubst;
423
union HB_GSUB_SubTable_
425
HB_SingleSubst single;
426
HB_MultipleSubst multiple;
427
HB_AlternateSubst alternate;
428
HB_LigatureSubst ligature;
429
HB_ContextSubst context;
430
HB_ChainContextSubst chain;
431
HB_ReverseChainContextSubst reverse;
438
FT_Error _HB_GSUB_Load_SubTable( HB_GSUB_SubTable* st,
440
FT_UShort lookup_type );
442
void _HB_GSUB_Free_SubTable( HB_GSUB_SubTable* st,
444
FT_UShort lookup_type );
448
#endif /* HARFBUZZ_GSUB_PRIVATE_H */