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_GPOS_PRIVATE_H
27
#define HARFBUZZ_GPOS_PRIVATE_H
29
#include "harfbuzz-impl.h"
30
#include "harfbuzz-stream-private.h"
31
#include "harfbuzz-gpos.h"
38
struct HB_ValueRecord_
40
HB_Short XPlacement; /* horizontal adjustment for
42
HB_Short YPlacement; /* vertical adjustment for
44
HB_Short XAdvance; /* horizontal adjustment for
46
HB_Short YAdvance; /* vertical adjustment for
48
HB_Device XPlacementDevice; /* device table for horizontal
50
HB_Device YPlacementDevice; /* device table for vertical
52
HB_Device XAdvanceDevice; /* device table for horizontal
54
HB_Device YAdvanceDevice; /* device table for vertical
56
HB_UShort XIdPlacement; /* horizontal placement metric ID */
57
HB_UShort YIdPlacement; /* vertical placement metric ID */
58
HB_UShort XIdAdvance; /* horizontal advance metric ID */
59
HB_UShort YIdAdvance; /* vertical advance metric ID */
62
typedef struct HB_ValueRecord_ HB_ValueRecord;
65
/* Mask values to scan the value format of the ValueRecord structure.
66
We always expand compressed ValueRecords of the font. */
68
#define HB_GPOS_FORMAT_HAVE_X_PLACEMENT 0x0001
69
#define HB_GPOS_FORMAT_HAVE_Y_PLACEMENT 0x0002
70
#define HB_GPOS_FORMAT_HAVE_X_ADVANCE 0x0004
71
#define HB_GPOS_FORMAT_HAVE_Y_ADVANCE 0x0008
72
#define HB_GPOS_FORMAT_HAVE_X_PLACEMENT_DEVICE 0x0010
73
#define HB_GPOS_FORMAT_HAVE_Y_PLACEMENT_DEVICE 0x0020
74
#define HB_GPOS_FORMAT_HAVE_X_ADVANCE_DEVICE 0x0040
75
#define HB_GPOS_FORMAT_HAVE_Y_ADVANCE_DEVICE 0x0080
76
#define HB_GPOS_FORMAT_HAVE_X_ID_PLACEMENT 0x0100
77
#define HB_GPOS_FORMAT_HAVE_Y_ID_PLACEMENT 0x0200
78
#define HB_GPOS_FORMAT_HAVE_X_ID_ADVANCE 0x0400
79
#define HB_GPOS_FORMAT_HAVE_Y_ID_ADVANCE 0x0800
82
struct HB_AnchorFormat1_
84
HB_Short XCoordinate; /* horizontal value */
85
HB_Short YCoordinate; /* vertical value */
88
typedef struct HB_AnchorFormat1_ HB_AnchorFormat1;
91
struct HB_AnchorFormat2_
93
HB_Short XCoordinate; /* horizontal value */
94
HB_Short YCoordinate; /* vertical value */
95
HB_UShort AnchorPoint; /* index to glyph contour point */
98
typedef struct HB_AnchorFormat2_ HB_AnchorFormat2;
101
struct HB_AnchorFormat3_
103
HB_Short XCoordinate; /* horizontal value */
104
HB_Short YCoordinate; /* vertical value */
105
HB_Device XDeviceTable; /* device table for X coordinate */
106
HB_Device YDeviceTable; /* device table for Y coordinate */
109
typedef struct HB_AnchorFormat3_ HB_AnchorFormat3;
112
struct HB_AnchorFormat4_
114
HB_UShort XIdAnchor; /* horizontal metric ID */
115
HB_UShort YIdAnchor; /* vertical metric ID */
118
typedef struct HB_AnchorFormat4_ HB_AnchorFormat4;
123
HB_UShort PosFormat; /* 1, 2, 3, or 4 -- 0 indicates
124
that there is no Anchor table */
128
HB_AnchorFormat1 af1;
129
HB_AnchorFormat2 af2;
130
HB_AnchorFormat3 af3;
131
HB_AnchorFormat4 af4;
135
typedef struct HB_Anchor_ HB_Anchor;
138
struct HB_MarkRecord_
140
HB_UShort Class; /* mark class */
141
HB_Anchor MarkAnchor; /* anchor table */
144
typedef struct HB_MarkRecord_ HB_MarkRecord;
149
HB_UShort MarkCount; /* number of MarkRecord tables */
150
HB_MarkRecord* MarkRecord; /* array of MarkRecord tables */
153
typedef struct HB_MarkArray_ HB_MarkArray;
158
struct HB_SinglePosFormat1_
160
HB_ValueRecord Value; /* ValueRecord for all covered
164
typedef struct HB_SinglePosFormat1_ HB_SinglePosFormat1;
167
struct HB_SinglePosFormat2_
169
HB_UShort ValueCount; /* number of ValueRecord tables */
170
HB_ValueRecord* Value; /* array of ValueRecord tables */
173
typedef struct HB_SinglePosFormat2_ HB_SinglePosFormat2;
178
HB_UShort PosFormat; /* 1 or 2 */
179
HB_Coverage Coverage; /* Coverage table */
181
HB_UShort ValueFormat; /* format of ValueRecord table */
185
HB_SinglePosFormat1 spf1;
186
HB_SinglePosFormat2 spf2;
190
typedef struct HB_SinglePos_ HB_SinglePos;
195
struct HB_PairValueRecord_
197
HB_UShort SecondGlyph; /* glyph ID for second glyph */
198
HB_ValueRecord Value1; /* pos. data for first glyph */
199
HB_ValueRecord Value2; /* pos. data for second glyph */
202
typedef struct HB_PairValueRecord_ HB_PairValueRecord;
207
HB_UShort PairValueCount;
208
/* number of PairValueRecord tables */
209
HB_PairValueRecord* PairValueRecord;
210
/* array of PairValueRecord tables */
213
typedef struct HB_PairSet_ HB_PairSet;
216
struct HB_PairPosFormat1_
218
HB_UShort PairSetCount; /* number of PairSet tables */
219
HB_PairSet* PairSet; /* array of PairSet tables */
222
typedef struct HB_PairPosFormat1_ HB_PairPosFormat1;
225
struct HB_Class2Record_
227
HB_ValueRecord Value1; /* pos. data for first glyph */
228
HB_ValueRecord Value2; /* pos. data for second glyph */
231
typedef struct HB_Class2Record_ HB_Class2Record;
234
struct HB_Class1Record_
236
HB_Class2Record* Class2Record; /* array of Class2Record tables */
239
typedef struct HB_Class1Record_ HB_Class1Record;
242
struct HB_PairPosFormat2_
244
HB_ClassDefinition ClassDef1; /* class def. for first glyph */
245
HB_ClassDefinition ClassDef2; /* class def. for second glyph */
246
HB_UShort Class1Count; /* number of classes in ClassDef1
248
HB_UShort Class2Count; /* number of classes in ClassDef2
250
HB_Class1Record* Class1Record; /* array of Class1Record tables */
253
typedef struct HB_PairPosFormat2_ HB_PairPosFormat2;
258
HB_UShort PosFormat; /* 1 or 2 */
259
HB_Coverage Coverage; /* Coverage table */
260
HB_UShort ValueFormat1; /* format of ValueRecord table
262
HB_UShort ValueFormat2; /* format of ValueRecord table
267
HB_PairPosFormat1 ppf1;
268
HB_PairPosFormat2 ppf2;
272
typedef struct HB_PairPos_ HB_PairPos;
277
struct HB_EntryExitRecord_
279
HB_Anchor EntryAnchor; /* entry Anchor table */
280
HB_Anchor ExitAnchor; /* exit Anchor table */
284
typedef struct HB_EntryExitRecord_ HB_EntryExitRecord;
286
struct HB_CursivePos_
288
HB_UShort PosFormat; /* always 1 */
289
HB_Coverage Coverage; /* Coverage table */
290
HB_UShort EntryExitCount;
291
/* number of EntryExitRecord tables */
292
HB_EntryExitRecord* EntryExitRecord;
293
/* array of EntryExitRecord tables */
296
typedef struct HB_CursivePos_ HB_CursivePos;
301
struct HB_BaseRecord_
303
HB_Anchor* BaseAnchor; /* array of base glyph anchor
307
typedef struct HB_BaseRecord_ HB_BaseRecord;
312
HB_UShort BaseCount; /* number of BaseRecord tables */
313
HB_BaseRecord* BaseRecord; /* array of BaseRecord tables */
316
typedef struct HB_BaseArray_ HB_BaseArray;
319
struct HB_MarkBasePos_
321
HB_UShort PosFormat; /* always 1 */
322
HB_Coverage MarkCoverage; /* mark glyph coverage table */
323
HB_Coverage BaseCoverage; /* base glyph coverage table */
324
HB_UShort ClassCount; /* number of mark classes */
325
HB_MarkArray MarkArray; /* mark array table */
326
HB_BaseArray BaseArray; /* base array table */
329
typedef struct HB_MarkBasePos_ HB_MarkBasePos;
334
struct HB_ComponentRecord_
336
HB_Anchor* LigatureAnchor; /* array of ligature glyph anchor
340
typedef struct HB_ComponentRecord_ HB_ComponentRecord;
343
struct HB_LigatureAttach_
345
HB_UShort ComponentCount;
346
/* number of ComponentRecord tables */
347
HB_ComponentRecord* ComponentRecord;
348
/* array of ComponentRecord tables */
351
typedef struct HB_LigatureAttach_ HB_LigatureAttach;
354
struct HB_LigatureArray_
356
HB_UShort LigatureCount; /* number of LigatureAttach tables */
357
HB_LigatureAttach* LigatureAttach;
358
/* array of LigatureAttach tables */
361
typedef struct HB_LigatureArray_ HB_LigatureArray;
364
struct HB_MarkLigPos_
366
HB_UShort PosFormat; /* always 1 */
367
HB_Coverage MarkCoverage; /* mark glyph coverage table */
368
HB_Coverage LigatureCoverage;
369
/* ligature glyph coverage table */
370
HB_UShort ClassCount; /* number of mark classes */
371
HB_MarkArray MarkArray; /* mark array table */
372
HB_LigatureArray LigatureArray; /* ligature array table */
375
typedef struct HB_MarkLigPos_ HB_MarkLigPos;
380
struct HB_Mark2Record_
382
HB_Anchor* Mark2Anchor; /* array of mark glyph anchor
386
typedef struct HB_Mark2Record_ HB_Mark2Record;
389
struct HB_Mark2Array_
391
HB_UShort Mark2Count; /* number of Mark2Record tables */
392
HB_Mark2Record* Mark2Record; /* array of Mark2Record tables */
395
typedef struct HB_Mark2Array_ HB_Mark2Array;
398
struct HB_MarkMarkPos_
400
HB_UShort PosFormat; /* always 1 */
401
HB_Coverage Mark1Coverage; /* first mark glyph coverage table */
402
HB_Coverage Mark2Coverage; /* second mark glyph coverave table */
403
HB_UShort ClassCount; /* number of combining mark classes */
404
HB_MarkArray Mark1Array; /* MarkArray table for first mark */
405
HB_Mark2Array Mark2Array; /* MarkArray table for second mark */
408
typedef struct HB_MarkMarkPos_ HB_MarkMarkPos;
411
/* needed by both lookup type 7 and 8 */
413
struct HB_PosLookupRecord_
415
HB_UShort SequenceIndex; /* index into current
417
HB_UShort LookupListIndex; /* Lookup to apply to that pos. */
420
typedef struct HB_PosLookupRecord_ HB_PosLookupRecord;
427
HB_UShort GlyphCount; /* total number of input glyphs */
428
HB_UShort PosCount; /* number of PosLookupRecord tables */
429
HB_UShort* Input; /* array of input glyph IDs */
430
HB_PosLookupRecord* PosLookupRecord;
431
/* array of PosLookupRecord tables */
434
typedef struct HB_PosRule_ HB_PosRule;
437
struct HB_PosRuleSet_
439
HB_UShort PosRuleCount; /* number of PosRule tables */
440
HB_PosRule* PosRule; /* array of PosRule tables */
443
typedef struct HB_PosRuleSet_ HB_PosRuleSet;
446
struct HB_ContextPosFormat1_
448
HB_Coverage Coverage; /* Coverage table */
449
HB_UShort PosRuleSetCount; /* number of PosRuleSet tables */
450
HB_PosRuleSet* PosRuleSet; /* array of PosRuleSet tables */
453
typedef struct HB_ContextPosFormat1_ HB_ContextPosFormat1;
456
struct HB_PosClassRule_
458
HB_UShort GlyphCount; /* total number of context classes */
459
HB_UShort PosCount; /* number of PosLookupRecord tables */
460
HB_UShort* Class; /* array of classes */
461
HB_PosLookupRecord* PosLookupRecord;
462
/* array of PosLookupRecord tables */
465
typedef struct HB_PosClassRule_ HB_PosClassRule;
468
struct HB_PosClassSet_
470
HB_UShort PosClassRuleCount;
471
/* number of PosClassRule tables */
472
HB_PosClassRule* PosClassRule; /* array of PosClassRule tables */
475
typedef struct HB_PosClassSet_ HB_PosClassSet;
478
/* The `MaxContextLength' field is not defined in the TTO specification
479
but simplifies the implementation of this format. It holds the
480
maximal context length used in the context rules. */
482
struct HB_ContextPosFormat2_
484
HB_UShort MaxContextLength;
485
/* maximal context length */
486
HB_Coverage Coverage; /* Coverage table */
487
HB_ClassDefinition ClassDef; /* ClassDef table */
488
HB_UShort PosClassSetCount;
489
/* number of PosClassSet tables */
490
HB_PosClassSet* PosClassSet; /* array of PosClassSet tables */
493
typedef struct HB_ContextPosFormat2_ HB_ContextPosFormat2;
496
struct HB_ContextPosFormat3_
498
HB_UShort GlyphCount; /* number of input glyphs */
499
HB_UShort PosCount; /* number of PosLookupRecord tables */
500
HB_Coverage* Coverage; /* array of Coverage tables */
501
HB_PosLookupRecord* PosLookupRecord;
502
/* array of PosLookupRecord tables */
505
typedef struct HB_ContextPosFormat3_ HB_ContextPosFormat3;
508
struct HB_ContextPos_
510
HB_UShort PosFormat; /* 1, 2, or 3 */
514
HB_ContextPosFormat1 cpf1;
515
HB_ContextPosFormat2 cpf2;
516
HB_ContextPosFormat3 cpf3;
520
typedef struct HB_ContextPos_ HB_ContextPos;
525
struct HB_ChainPosRule_
527
HB_UShort BacktrackGlyphCount;
528
/* total number of backtrack glyphs */
529
HB_UShort* Backtrack; /* array of backtrack glyph IDs */
530
HB_UShort InputGlyphCount;
531
/* total number of input glyphs */
532
HB_UShort* Input; /* array of input glyph IDs */
533
HB_UShort LookaheadGlyphCount;
534
/* total number of lookahead glyphs */
535
HB_UShort* Lookahead; /* array of lookahead glyph IDs */
536
HB_UShort PosCount; /* number of PosLookupRecords */
537
HB_PosLookupRecord* PosLookupRecord;
538
/* array of PosLookupRecords */
541
typedef struct HB_ChainPosRule_ HB_ChainPosRule;
544
struct HB_ChainPosRuleSet_
546
HB_UShort ChainPosRuleCount;
547
/* number of ChainPosRule tables */
548
HB_ChainPosRule* ChainPosRule; /* array of ChainPosRule tables */
551
typedef struct HB_ChainPosRuleSet_ HB_ChainPosRuleSet;
554
struct HB_ChainContextPosFormat1_
556
HB_Coverage Coverage; /* Coverage table */
557
HB_UShort ChainPosRuleSetCount;
558
/* number of ChainPosRuleSet tables */
559
HB_ChainPosRuleSet* ChainPosRuleSet;
560
/* array of ChainPosRuleSet tables */
563
typedef struct HB_ChainContextPosFormat1_ HB_ChainContextPosFormat1;
566
struct HB_ChainPosClassRule_
568
HB_UShort BacktrackGlyphCount;
569
/* total number of backtrack
571
HB_UShort* Backtrack; /* array of backtrack classes */
572
HB_UShort InputGlyphCount;
573
/* total number of context classes */
574
HB_UShort* Input; /* array of context classes */
575
HB_UShort LookaheadGlyphCount;
576
/* total number of lookahead
578
HB_UShort* Lookahead; /* array of lookahead classes */
579
HB_UShort PosCount; /* number of PosLookupRecords */
580
HB_PosLookupRecord* PosLookupRecord;
581
/* array of substitution lookups */
584
typedef struct HB_ChainPosClassRule_ HB_ChainPosClassRule;
587
struct HB_ChainPosClassSet_
589
HB_UShort ChainPosClassRuleCount;
590
/* number of ChainPosClassRule
592
HB_ChainPosClassRule* ChainPosClassRule;
593
/* array of ChainPosClassRule
597
typedef struct HB_ChainPosClassSet_ HB_ChainPosClassSet;
600
/* The `MaxXXXLength' fields are not defined in the TTO specification
601
but simplifies the implementation of this format. It holds the
602
maximal context length used in the specific context rules. */
604
struct HB_ChainContextPosFormat2_
606
HB_Coverage Coverage; /* Coverage table */
608
HB_UShort MaxBacktrackLength;
609
/* maximal backtrack length */
610
HB_ClassDefinition BacktrackClassDef;
611
/* BacktrackClassDef table */
612
HB_UShort MaxInputLength;
613
/* maximal input length */
614
HB_ClassDefinition InputClassDef;
615
/* InputClassDef table */
616
HB_UShort MaxLookaheadLength;
617
/* maximal lookahead length */
618
HB_ClassDefinition LookaheadClassDef;
619
/* LookaheadClassDef table */
621
HB_UShort ChainPosClassSetCount;
622
/* number of ChainPosClassSet
624
HB_ChainPosClassSet* ChainPosClassSet;
625
/* array of ChainPosClassSet
629
typedef struct HB_ChainContextPosFormat2_ HB_ChainContextPosFormat2;
632
struct HB_ChainContextPosFormat3_
634
HB_UShort BacktrackGlyphCount;
635
/* number of backtrack glyphs */
636
HB_Coverage* BacktrackCoverage;
637
/* array of backtrack Coverage
639
HB_UShort InputGlyphCount;
640
/* number of input glyphs */
641
HB_Coverage* InputCoverage;
642
/* array of input coverage
644
HB_UShort LookaheadGlyphCount;
645
/* number of lookahead glyphs */
646
HB_Coverage* LookaheadCoverage;
647
/* array of lookahead coverage
649
HB_UShort PosCount; /* number of PosLookupRecords */
650
HB_PosLookupRecord* PosLookupRecord;
651
/* array of substitution lookups */
654
typedef struct HB_ChainContextPosFormat3_ HB_ChainContextPosFormat3;
657
struct HB_ChainContextPos_
659
HB_UShort PosFormat; /* 1, 2, or 3 */
663
HB_ChainContextPosFormat1 ccpf1;
664
HB_ChainContextPosFormat2 ccpf2;
665
HB_ChainContextPosFormat3 ccpf3;
669
typedef struct HB_ChainContextPos_ HB_ChainContextPos;
674
struct HB_ExtensionPos_
676
HB_UShort PosFormat; /* always 1 */
677
HB_UShort LookuptType; /* lookup-type of referenced subtable */
678
HB_GPOS_SubTable *subtable; /* referenced subtable */
681
typedef struct HB_ExtensionPos_ HB_ExtensionPos;
685
union HB_GPOS_SubTable_
689
HB_CursivePos cursive;
690
HB_MarkBasePos markbase;
691
HB_MarkLigPos marklig;
692
HB_MarkMarkPos markmark;
693
HB_ContextPos context;
694
HB_ChainContextPos chain;
697
typedef union HB_GPOS_SubTable_ HB_GPOS_SubTable;
702
_HB_GPOS_Load_SubTable( HB_GPOS_SubTable* st,
704
HB_UShort lookup_type );
707
_HB_GPOS_Free_SubTable( HB_GPOS_SubTable* st,
708
HB_UShort lookup_type );
712
#endif /* HARFBUZZ_GPOS_PRIVATE_H */