2
* Copyright (C) 1998-2004 David Turner and Werner Lemberg
3
* Copyright (C) 2006 Behdad Esfahbod
5
* This is part of HarfBuzz, an OpenType Layout engine library.
7
* Permission is hereby granted, without written agreement and without
8
* license or royalty fees, to use, copy, modify, and distribute this
9
* software and its documentation for any purpose, provided that the
10
* above copyright notice and the following two paragraphs appear in
11
* all copies of this software.
13
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
14
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
15
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
16
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
19
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
20
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
21
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
22
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
23
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
26
#ifndef HARFBUZZ_GSUB_PRIVATE_H
27
#define HARFBUZZ_GSUB_PRIVATE_H
29
#include "harfbuzz-impl.h"
30
#include "harfbuzz-stream-private.h"
31
#include "harfbuzz-gsub.h"
35
#ifdef HB_USE_PACKED_STRUCTS
39
typedef union HB_GSUB_SubTable_ HB_GSUB_SubTable;
43
struct HB_SingleSubstFormat1_
45
HB_Short DeltaGlyphID; /* constant added to get
46
substitution glyph index */
49
typedef struct HB_SingleSubstFormat1_ HB_SingleSubstFormat1;
52
struct HB_SingleSubstFormat2_
54
HB_UShort* Substitute; /* array of substitute glyph IDs */
55
HB_UShort GlyphCount; /* number of glyph IDs in
59
typedef struct HB_SingleSubstFormat2_ HB_SingleSubstFormat2;
62
struct HB_SingleSubst_
66
HB_SingleSubstFormat1 ssf1;
67
HB_SingleSubstFormat2 ssf2;
70
HB_Coverage Coverage; /* Coverage table */
71
HB_Byte SubstFormat; /* 1 or 2 */
74
typedef struct HB_SingleSubst_ HB_SingleSubst;
81
HB_UShort* Substitute; /* string of glyph IDs to
83
HB_UShort GlyphCount; /* number of glyph IDs in the
87
typedef struct HB_Sequence_ HB_Sequence;
90
struct HB_MultipleSubst_
92
HB_Sequence* Sequence; /* array of Sequence tables */
93
HB_Coverage Coverage; /* Coverage table */
94
HB_UShort SubstFormat; /* always 1 */
95
HB_UShort SequenceCount; /* number of Sequence tables */
98
typedef struct HB_MultipleSubst_ HB_MultipleSubst;
103
struct HB_AlternateSet_
105
HB_UShort* Alternate; /* array of alternate glyph IDs */
106
HB_UShort GlyphCount; /* number of glyph IDs in the
110
typedef struct HB_AlternateSet_ HB_AlternateSet;
113
struct HB_AlternateSubst_
115
HB_AlternateSet* AlternateSet; /* array of AlternateSet tables */
116
HB_Coverage Coverage; /* Coverage table */
117
HB_UShort SubstFormat; /* always 1 */
118
HB_UShort AlternateSetCount;
119
/* number of AlternateSet tables */
122
typedef struct HB_AlternateSubst_ HB_AlternateSubst;
129
HB_UShort* Component; /* array of component glyph IDs */
130
HB_UShort LigGlyph; /* glyphID of ligature
132
HB_UShort ComponentCount; /* number of components in ligature */
135
typedef struct HB_Ligature_ HB_Ligature;
138
struct HB_LigatureSet_
140
HB_Ligature* Ligature; /* array of Ligature tables */
141
HB_UShort LigatureCount; /* number of Ligature tables */
144
typedef struct HB_LigatureSet_ HB_LigatureSet;
147
struct HB_LigatureSubst_
149
HB_LigatureSet* LigatureSet; /* array of LigatureSet tables */
150
HB_Coverage Coverage; /* Coverage table */
151
HB_UShort SubstFormat; /* always 1 */
152
HB_UShort LigatureSetCount; /* number of LigatureSet tables */
155
typedef struct HB_LigatureSubst_ HB_LigatureSubst;
158
/* needed by both lookup type 5 and 6 */
160
struct HB_SubstLookupRecord_
162
HB_UShort SequenceIndex; /* index into current
164
HB_UShort LookupListIndex; /* Lookup to apply to that pos. */
167
typedef struct HB_SubstLookupRecord_ HB_SubstLookupRecord;
174
HB_UShort* Input; /* array of input glyph IDs */
175
HB_SubstLookupRecord* SubstLookupRecord;
176
/* array of SubstLookupRecord
178
HB_UShort GlyphCount; /* total number of input glyphs */
179
HB_UShort SubstCount; /* number of SubstLookupRecord
183
typedef struct HB_SubRule_ HB_SubRule;
186
struct HB_SubRuleSet_
188
HB_SubRule* SubRule; /* array of SubRule tables */
189
HB_UShort SubRuleCount; /* number of SubRule tables */
192
typedef struct HB_SubRuleSet_ HB_SubRuleSet;
195
struct HB_ContextSubstFormat1_
197
HB_SubRuleSet* SubRuleSet; /* array of SubRuleSet tables */
198
HB_Coverage Coverage; /* Coverage table */
199
HB_UShort SubRuleSetCount; /* number of SubRuleSet tables */
202
typedef struct HB_ContextSubstFormat1_ HB_ContextSubstFormat1;
205
struct HB_SubClassRule_
207
HB_UShort* Class; /* array of classes */
208
HB_SubstLookupRecord* SubstLookupRecord;
209
/* array of SubstLookupRecord
211
HB_UShort GlyphCount; /* total number of context classes */
212
HB_UShort SubstCount; /* number of SubstLookupRecord
216
typedef struct HB_SubClassRule_ HB_SubClassRule;
219
struct HB_SubClassSet_
221
HB_SubClassRule* SubClassRule; /* array of SubClassRule tables */
222
HB_UShort SubClassRuleCount;
223
/* number of SubClassRule tables */
226
typedef struct HB_SubClassSet_ HB_SubClassSet;
229
/* The `MaxContextLength' field is not defined in the TTO specification
230
but simplifies the implementation of this format. It holds the
231
maximal context length used in the context rules. */
233
struct HB_ContextSubstFormat2_
235
HB_SubClassSet* SubClassSet; /* array of SubClassSet tables */
236
HB_Coverage Coverage; /* Coverage table */
237
HB_ClassDefinition ClassDef; /* ClassDef table */
238
HB_UShort SubClassSetCount;
239
/* number of SubClassSet tables */
240
HB_UShort MaxContextLength;
241
/* maximal context length */
244
typedef struct HB_ContextSubstFormat2_ HB_ContextSubstFormat2;
247
struct HB_ContextSubstFormat3_
249
HB_Coverage* Coverage; /* array of Coverage tables */
250
HB_SubstLookupRecord* SubstLookupRecord;
251
/* array of substitution lookups */
252
HB_UShort GlyphCount; /* number of input glyphs */
253
HB_UShort SubstCount; /* number of SubstLookupRecords */
256
typedef struct HB_ContextSubstFormat3_ HB_ContextSubstFormat3;
259
struct HB_ContextSubst_
263
HB_ContextSubstFormat1 csf1;
264
HB_ContextSubstFormat2 csf2;
265
HB_ContextSubstFormat3 csf3;
268
HB_Byte SubstFormat; /* 1, 2, or 3 */
271
typedef struct HB_ContextSubst_ HB_ContextSubst;
276
struct HB_ChainSubRule_
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 */
283
HB_UShort BacktrackGlyphCount;
284
/* total number of backtrack glyphs */
285
HB_UShort InputGlyphCount;
286
/* total number of input glyphs */
287
HB_UShort LookaheadGlyphCount;
288
/* total number of lookahead glyphs */
289
HB_UShort SubstCount; /* number of SubstLookupRecords */
292
typedef struct HB_ChainSubRule_ HB_ChainSubRule;
295
struct HB_ChainSubRuleSet_
297
HB_ChainSubRule* ChainSubRule; /* array of ChainSubRule tables */
298
HB_UShort ChainSubRuleCount;
299
/* number of ChainSubRule tables */
302
typedef struct HB_ChainSubRuleSet_ HB_ChainSubRuleSet;
305
struct HB_ChainContextSubstFormat1_
307
HB_ChainSubRuleSet* ChainSubRuleSet;
308
/* array of ChainSubRuleSet tables */
309
HB_Coverage Coverage; /* Coverage table */
310
HB_UShort ChainSubRuleSetCount;
311
/* number of ChainSubRuleSet tables */
314
typedef struct HB_ChainContextSubstFormat1_ HB_ChainContextSubstFormat1;
317
struct HB_ChainSubClassRule_
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 */
324
HB_UShort BacktrackGlyphCount;
325
/* total number of backtrack
327
HB_UShort InputGlyphCount;
328
/* total number of context classes */
329
HB_UShort LookaheadGlyphCount;
330
/* total number of lookahead
332
HB_UShort SubstCount; /* number of SubstLookupRecords */
335
typedef struct HB_ChainSubClassRule_ HB_ChainSubClassRule;
338
struct HB_ChainSubClassSet_
340
HB_ChainSubClassRule* ChainSubClassRule;
341
/* array of ChainSubClassRule
343
HB_UShort ChainSubClassRuleCount;
344
/* number of ChainSubClassRule
348
typedef struct HB_ChainSubClassSet_ HB_ChainSubClassSet;
351
/* The `MaxXXXLength' fields are not defined in the TTO specification
352
but simplifies the implementation of this format. It holds the
353
maximal context length used in the specific context rules. */
355
struct HB_ChainContextSubstFormat2_
357
HB_ChainSubClassSet* ChainSubClassSet;
358
/* array of ChainSubClassSet
360
HB_Coverage Coverage; /* Coverage table */
362
HB_ClassDefinition BacktrackClassDef;
363
/* BacktrackClassDef table */
364
HB_ClassDefinition InputClassDef;
365
/* InputClassDef table */
366
HB_ClassDefinition LookaheadClassDef;
367
/* LookaheadClassDef table */
369
HB_UShort ChainSubClassSetCount;
370
/* number of ChainSubClassSet
372
HB_UShort MaxBacktrackLength;
373
/* maximal backtrack length */
374
HB_UShort MaxLookaheadLength;
375
/* maximal lookahead length */
376
HB_UShort MaxInputLength;
377
/* maximal input length */
380
typedef struct HB_ChainContextSubstFormat2_ HB_ChainContextSubstFormat2;
383
struct HB_ChainContextSubstFormat3_
385
HB_Coverage* BacktrackCoverage;
386
/* array of backtrack Coverage
388
HB_Coverage* InputCoverage;
389
/* array of input coverage
391
HB_Coverage* LookaheadCoverage;
392
/* array of lookahead coverage
394
HB_SubstLookupRecord* SubstLookupRecord;
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 */
405
typedef struct HB_ChainContextSubstFormat3_ HB_ChainContextSubstFormat3;
408
struct HB_ChainContextSubst_
412
HB_ChainContextSubstFormat1 ccsf1;
413
HB_ChainContextSubstFormat2 ccsf2;
414
HB_ChainContextSubstFormat3 ccsf3;
417
HB_Byte SubstFormat; /* 1, 2, or 3 */
420
typedef struct HB_ChainContextSubst_ HB_ChainContextSubst;
425
struct HB_ExtensionSubst_
427
HB_GSUB_SubTable *subtable; /* referenced subtable */
428
HB_UShort SubstFormat; /* always 1 */
429
HB_UShort LookuptType; /* lookup-type of referenced subtable */
432
typedef struct HB_ExtensionSubst_ HB_ExtensionSubst;
437
struct HB_ReverseChainContextSubst_
439
HB_Coverage* LookaheadCoverage; /* array of lookahead Coverage
441
HB_UShort* Substitute; /* array of substitute Glyph ID */
442
HB_Coverage* BacktrackCoverage; /* array of backtrack Coverage
444
HB_Coverage Coverage; /* coverage table for input glyphs */
445
HB_UShort SubstFormat; /* always 1 */
446
HB_UShort BacktrackGlyphCount; /* number of backtrack glyphs */
447
HB_UShort LookaheadGlyphCount; /* number of lookahead glyphs */
448
HB_UShort GlyphCount; /* number of Glyph IDs */
451
typedef struct HB_ReverseChainContextSubst_ HB_ReverseChainContextSubst;
454
union HB_GSUB_SubTable_
456
HB_SingleSubst single;
457
HB_MultipleSubst multiple;
458
HB_AlternateSubst alternate;
459
HB_LigatureSubst ligature;
460
HB_ContextSubst context;
461
HB_ChainContextSubst chain;
462
HB_ReverseChainContextSubst reverse;
469
_HB_GSUB_Load_SubTable( HB_GSUB_SubTable* st,
471
HB_UShort lookup_type );
474
_HB_GSUB_Free_SubTable( HB_GSUB_SubTable* st,
475
HB_UShort lookup_type );
477
#ifdef HB_USE_PACKED_STRUCTS
483
#endif /* HARFBUZZ_GSUB_PRIVATE_H */