1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
|
/*******************************************************************
*
* Copyright 1996-2000 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* Copyright 2006 Behdad Esfahbod
*
* This is part of HarfBuzz, an OpenType Layout engine library.
*
* See the file name COPYING for licensing information.
*
******************************************************************/
#ifndef HARFBUZZ_GPOS_PRIVATE_H
#define HARFBUZZ_GPOS_PRIVATE_H
#include "harfbuzz-stream.h"
#include "harfbuzz-gpos.h"
HB_BEGIN_HEADER
/* shared tables */
struct HB_ValueRecord_
{
HB_Short XPlacement; /* horizontal adjustment for
placement */
HB_Short YPlacement; /* vertical adjustment for
placement */
HB_Short XAdvance; /* horizontal adjustment for
advance */
HB_Short YAdvance; /* vertical adjustment for
advance */
HB_Device XPlacementDevice; /* device table for horizontal
placement */
HB_Device YPlacementDevice; /* device table for vertical
placement */
HB_Device XAdvanceDevice; /* device table for horizontal
advance */
HB_Device YAdvanceDevice; /* device table for vertical
advance */
HB_UShort XIdPlacement; /* horizontal placement metric ID */
HB_UShort YIdPlacement; /* vertical placement metric ID */
HB_UShort XIdAdvance; /* horizontal advance metric ID */
HB_UShort YIdAdvance; /* vertical advance metric ID */
};
typedef struct HB_ValueRecord_ HB_ValueRecord;
/* Mask values to scan the value format of the ValueRecord structure.
We always expand compressed ValueRecords of the font. */
#define HB_GPOS_FORMAT_HAVE_X_PLACEMENT 0x0001
#define HB_GPOS_FORMAT_HAVE_Y_PLACEMENT 0x0002
#define HB_GPOS_FORMAT_HAVE_X_ADVANCE 0x0004
#define HB_GPOS_FORMAT_HAVE_Y_ADVANCE 0x0008
#define HB_GPOS_FORMAT_HAVE_X_PLACEMENT_DEVICE 0x0010
#define HB_GPOS_FORMAT_HAVE_Y_PLACEMENT_DEVICE 0x0020
#define HB_GPOS_FORMAT_HAVE_X_ADVANCE_DEVICE 0x0040
#define HB_GPOS_FORMAT_HAVE_Y_ADVANCE_DEVICE 0x0080
#define HB_GPOS_FORMAT_HAVE_X_ID_PLACEMENT 0x0100
#define HB_GPOS_FORMAT_HAVE_Y_ID_PLACEMENT 0x0200
#define HB_GPOS_FORMAT_HAVE_X_ID_ADVANCE 0x0400
#define HB_GPOS_FORMAT_HAVE_Y_ID_ADVANCE 0x0800
struct HB_AnchorFormat1_
{
HB_Short XCoordinate; /* horizontal value */
HB_Short YCoordinate; /* vertical value */
};
typedef struct HB_AnchorFormat1_ HB_AnchorFormat1;
struct HB_AnchorFormat2_
{
HB_Short XCoordinate; /* horizontal value */
HB_Short YCoordinate; /* vertical value */
HB_UShort AnchorPoint; /* index to glyph contour point */
};
typedef struct HB_AnchorFormat2_ HB_AnchorFormat2;
struct HB_AnchorFormat3_
{
HB_Short XCoordinate; /* horizontal value */
HB_Short YCoordinate; /* vertical value */
HB_Device XDeviceTable; /* device table for X coordinate */
HB_Device YDeviceTable; /* device table for Y coordinate */
};
typedef struct HB_AnchorFormat3_ HB_AnchorFormat3;
struct HB_AnchorFormat4_
{
HB_UShort XIdAnchor; /* horizontal metric ID */
HB_UShort YIdAnchor; /* vertical metric ID */
};
typedef struct HB_AnchorFormat4_ HB_AnchorFormat4;
struct HB_Anchor_
{
HB_UShort PosFormat; /* 1, 2, 3, or 4 -- 0 indicates
that there is no Anchor table */
union
{
HB_AnchorFormat1 af1;
HB_AnchorFormat2 af2;
HB_AnchorFormat3 af3;
HB_AnchorFormat4 af4;
} af;
};
typedef struct HB_Anchor_ HB_Anchor;
struct HB_MarkRecord_
{
HB_UShort Class; /* mark class */
HB_Anchor MarkAnchor; /* anchor table */
};
typedef struct HB_MarkRecord_ HB_MarkRecord;
struct HB_MarkArray_
{
HB_UShort MarkCount; /* number of MarkRecord tables */
HB_MarkRecord* MarkRecord; /* array of MarkRecord tables */
};
typedef struct HB_MarkArray_ HB_MarkArray;
/* LookupType 1 */
struct HB_SinglePosFormat1_
{
HB_ValueRecord Value; /* ValueRecord for all covered
glyphs */
};
typedef struct HB_SinglePosFormat1_ HB_SinglePosFormat1;
struct HB_SinglePosFormat2_
{
HB_UShort ValueCount; /* number of ValueRecord tables */
HB_ValueRecord* Value; /* array of ValueRecord tables */
};
typedef struct HB_SinglePosFormat2_ HB_SinglePosFormat2;
struct HB_SinglePos_
{
HB_UShort PosFormat; /* 1 or 2 */
HB_Coverage Coverage; /* Coverage table */
HB_UShort ValueFormat; /* format of ValueRecord table */
union
{
HB_SinglePosFormat1 spf1;
HB_SinglePosFormat2 spf2;
} spf;
};
typedef struct HB_SinglePos_ HB_SinglePos;
/* LookupType 2 */
struct HB_PairValueRecord_
{
HB_UShort SecondGlyph; /* glyph ID for second glyph */
HB_ValueRecord Value1; /* pos. data for first glyph */
HB_ValueRecord Value2; /* pos. data for second glyph */
};
typedef struct HB_PairValueRecord_ HB_PairValueRecord;
struct HB_PairSet_
{
HB_UShort PairValueCount;
/* number of PairValueRecord tables */
HB_PairValueRecord* PairValueRecord;
/* array of PairValueRecord tables */
};
typedef struct HB_PairSet_ HB_PairSet;
struct HB_PairPosFormat1_
{
HB_UShort PairSetCount; /* number of PairSet tables */
HB_PairSet* PairSet; /* array of PairSet tables */
};
typedef struct HB_PairPosFormat1_ HB_PairPosFormat1;
struct HB_Class2Record_
{
HB_ValueRecord Value1; /* pos. data for first glyph */
HB_ValueRecord Value2; /* pos. data for second glyph */
};
typedef struct HB_Class2Record_ HB_Class2Record;
struct HB_Class1Record_
{
HB_Class2Record* Class2Record; /* array of Class2Record tables */
};
typedef struct HB_Class1Record_ HB_Class1Record;
struct HB_PairPosFormat2_
{
HB_ClassDefinition ClassDef1; /* class def. for first glyph */
HB_ClassDefinition ClassDef2; /* class def. for second glyph */
HB_UShort Class1Count; /* number of classes in ClassDef1
table */
HB_UShort Class2Count; /* number of classes in ClassDef2
table */
HB_Class1Record* Class1Record; /* array of Class1Record tables */
};
typedef struct HB_PairPosFormat2_ HB_PairPosFormat2;
struct HB_PairPos_
{
HB_UShort PosFormat; /* 1 or 2 */
HB_Coverage Coverage; /* Coverage table */
HB_UShort ValueFormat1; /* format of ValueRecord table
for first glyph */
HB_UShort ValueFormat2; /* format of ValueRecord table
for second glyph */
union
{
HB_PairPosFormat1 ppf1;
HB_PairPosFormat2 ppf2;
} ppf;
};
typedef struct HB_PairPos_ HB_PairPos;
/* LookupType 3 */
struct HB_EntryExitRecord_
{
HB_Anchor EntryAnchor; /* entry Anchor table */
HB_Anchor ExitAnchor; /* exit Anchor table */
};
typedef struct HB_EntryExitRecord_ HB_EntryExitRecord;
struct HB_CursivePos_
{
HB_UShort PosFormat; /* always 1 */
HB_Coverage Coverage; /* Coverage table */
HB_UShort EntryExitCount;
/* number of EntryExitRecord tables */
HB_EntryExitRecord* EntryExitRecord;
/* array of EntryExitRecord tables */
};
typedef struct HB_CursivePos_ HB_CursivePos;
/* LookupType 4 */
struct HB_BaseRecord_
{
HB_Anchor* BaseAnchor; /* array of base glyph anchor
tables */
};
typedef struct HB_BaseRecord_ HB_BaseRecord;
struct HB_BaseArray_
{
HB_UShort BaseCount; /* number of BaseRecord tables */
HB_BaseRecord* BaseRecord; /* array of BaseRecord tables */
};
typedef struct HB_BaseArray_ HB_BaseArray;
struct HB_MarkBasePos_
{
HB_UShort PosFormat; /* always 1 */
HB_Coverage MarkCoverage; /* mark glyph coverage table */
HB_Coverage BaseCoverage; /* base glyph coverage table */
HB_UShort ClassCount; /* number of mark classes */
HB_MarkArray MarkArray; /* mark array table */
HB_BaseArray BaseArray; /* base array table */
};
typedef struct HB_MarkBasePos_ HB_MarkBasePos;
/* LookupType 5 */
struct HB_ComponentRecord_
{
HB_Anchor* LigatureAnchor; /* array of ligature glyph anchor
tables */
};
typedef struct HB_ComponentRecord_ HB_ComponentRecord;
struct HB_LigatureAttach_
{
HB_UShort ComponentCount;
/* number of ComponentRecord tables */
HB_ComponentRecord* ComponentRecord;
/* array of ComponentRecord tables */
};
typedef struct HB_LigatureAttach_ HB_LigatureAttach;
struct HB_LigatureArray_
{
HB_UShort LigatureCount; /* number of LigatureAttach tables */
HB_LigatureAttach* LigatureAttach;
/* array of LigatureAttach tables */
};
typedef struct HB_LigatureArray_ HB_LigatureArray;
struct HB_MarkLigPos_
{
HB_UShort PosFormat; /* always 1 */
HB_Coverage MarkCoverage; /* mark glyph coverage table */
HB_Coverage LigatureCoverage;
/* ligature glyph coverage table */
HB_UShort ClassCount; /* number of mark classes */
HB_MarkArray MarkArray; /* mark array table */
HB_LigatureArray LigatureArray; /* ligature array table */
};
typedef struct HB_MarkLigPos_ HB_MarkLigPos;
/* LookupType 6 */
struct HB_Mark2Record_
{
HB_Anchor* Mark2Anchor; /* array of mark glyph anchor
tables */
};
typedef struct HB_Mark2Record_ HB_Mark2Record;
struct HB_Mark2Array_
{
HB_UShort Mark2Count; /* number of Mark2Record tables */
HB_Mark2Record* Mark2Record; /* array of Mark2Record tables */
};
typedef struct HB_Mark2Array_ HB_Mark2Array;
struct HB_MarkMarkPos_
{
HB_UShort PosFormat; /* always 1 */
HB_Coverage Mark1Coverage; /* first mark glyph coverage table */
HB_Coverage Mark2Coverage; /* second mark glyph coverave table */
HB_UShort ClassCount; /* number of combining mark classes */
HB_MarkArray Mark1Array; /* MarkArray table for first mark */
HB_Mark2Array Mark2Array; /* MarkArray table for second mark */
};
typedef struct HB_MarkMarkPos_ HB_MarkMarkPos;
/* needed by both lookup type 7 and 8 */
struct HB_PosLookupRecord_
{
HB_UShort SequenceIndex; /* index into current
glyph sequence */
HB_UShort LookupListIndex; /* Lookup to apply to that pos. */
};
typedef struct HB_PosLookupRecord_ HB_PosLookupRecord;
/* LookupType 7 */
struct HB_PosRule_
{
HB_UShort GlyphCount; /* total number of input glyphs */
HB_UShort PosCount; /* number of PosLookupRecord tables */
HB_UShort* Input; /* array of input glyph IDs */
HB_PosLookupRecord* PosLookupRecord;
/* array of PosLookupRecord tables */
};
typedef struct HB_PosRule_ HB_PosRule;
struct HB_PosRuleSet_
{
HB_UShort PosRuleCount; /* number of PosRule tables */
HB_PosRule* PosRule; /* array of PosRule tables */
};
typedef struct HB_PosRuleSet_ HB_PosRuleSet;
struct HB_ContextPosFormat1_
{
HB_Coverage Coverage; /* Coverage table */
HB_UShort PosRuleSetCount; /* number of PosRuleSet tables */
HB_PosRuleSet* PosRuleSet; /* array of PosRuleSet tables */
};
typedef struct HB_ContextPosFormat1_ HB_ContextPosFormat1;
struct HB_PosClassRule_
{
HB_UShort GlyphCount; /* total number of context classes */
HB_UShort PosCount; /* number of PosLookupRecord tables */
HB_UShort* Class; /* array of classes */
HB_PosLookupRecord* PosLookupRecord;
/* array of PosLookupRecord tables */
};
typedef struct HB_PosClassRule_ HB_PosClassRule;
struct HB_PosClassSet_
{
HB_UShort PosClassRuleCount;
/* number of PosClassRule tables */
HB_PosClassRule* PosClassRule; /* array of PosClassRule tables */
};
typedef struct HB_PosClassSet_ HB_PosClassSet;
/* The `MaxContextLength' field is not defined in the TTO specification
but simplifies the implementation of this format. It holds the
maximal context length used in the context rules. */
struct HB_ContextPosFormat2_
{
HB_UShort MaxContextLength;
/* maximal context length */
HB_Coverage Coverage; /* Coverage table */
HB_ClassDefinition ClassDef; /* ClassDef table */
HB_UShort PosClassSetCount;
/* number of PosClassSet tables */
HB_PosClassSet* PosClassSet; /* array of PosClassSet tables */
};
typedef struct HB_ContextPosFormat2_ HB_ContextPosFormat2;
struct HB_ContextPosFormat3_
{
HB_UShort GlyphCount; /* number of input glyphs */
HB_UShort PosCount; /* number of PosLookupRecord tables */
HB_Coverage* Coverage; /* array of Coverage tables */
HB_PosLookupRecord* PosLookupRecord;
/* array of PosLookupRecord tables */
};
typedef struct HB_ContextPosFormat3_ HB_ContextPosFormat3;
struct HB_ContextPos_
{
HB_UShort PosFormat; /* 1, 2, or 3 */
union
{
HB_ContextPosFormat1 cpf1;
HB_ContextPosFormat2 cpf2;
HB_ContextPosFormat3 cpf3;
} cpf;
};
typedef struct HB_ContextPos_ HB_ContextPos;
/* LookupType 8 */
struct HB_ChainPosRule_
{
HB_UShort BacktrackGlyphCount;
/* total number of backtrack glyphs */
HB_UShort* Backtrack; /* array of backtrack glyph IDs */
HB_UShort InputGlyphCount;
/* total number of input glyphs */
HB_UShort* Input; /* array of input glyph IDs */
HB_UShort LookaheadGlyphCount;
/* total number of lookahead glyphs */
HB_UShort* Lookahead; /* array of lookahead glyph IDs */
HB_UShort PosCount; /* number of PosLookupRecords */
HB_PosLookupRecord* PosLookupRecord;
/* array of PosLookupRecords */
};
typedef struct HB_ChainPosRule_ HB_ChainPosRule;
struct HB_ChainPosRuleSet_
{
HB_UShort ChainPosRuleCount;
/* number of ChainPosRule tables */
HB_ChainPosRule* ChainPosRule; /* array of ChainPosRule tables */
};
typedef struct HB_ChainPosRuleSet_ HB_ChainPosRuleSet;
struct HB_ChainContextPosFormat1_
{
HB_Coverage Coverage; /* Coverage table */
HB_UShort ChainPosRuleSetCount;
/* number of ChainPosRuleSet tables */
HB_ChainPosRuleSet* ChainPosRuleSet;
/* array of ChainPosRuleSet tables */
};
typedef struct HB_ChainContextPosFormat1_ HB_ChainContextPosFormat1;
struct HB_ChainPosClassRule_
{
HB_UShort BacktrackGlyphCount;
/* total number of backtrack
classes */
HB_UShort* Backtrack; /* array of backtrack classes */
HB_UShort InputGlyphCount;
/* total number of context classes */
HB_UShort* Input; /* array of context classes */
HB_UShort LookaheadGlyphCount;
/* total number of lookahead
classes */
HB_UShort* Lookahead; /* array of lookahead classes */
HB_UShort PosCount; /* number of PosLookupRecords */
HB_PosLookupRecord* PosLookupRecord;
/* array of substitution lookups */
};
typedef struct HB_ChainPosClassRule_ HB_ChainPosClassRule;
struct HB_ChainPosClassSet_
{
HB_UShort ChainPosClassRuleCount;
/* number of ChainPosClassRule
tables */
HB_ChainPosClassRule* ChainPosClassRule;
/* array of ChainPosClassRule
tables */
};
typedef struct HB_ChainPosClassSet_ HB_ChainPosClassSet;
/* The `MaxXXXLength' fields are not defined in the TTO specification
but simplifies the implementation of this format. It holds the
maximal context length used in the specific context rules. */
struct HB_ChainContextPosFormat2_
{
HB_Coverage Coverage; /* Coverage table */
HB_UShort MaxBacktrackLength;
/* maximal backtrack length */
HB_ClassDefinition BacktrackClassDef;
/* BacktrackClassDef table */
HB_UShort MaxInputLength;
/* maximal input length */
HB_ClassDefinition InputClassDef;
/* InputClassDef table */
HB_UShort MaxLookaheadLength;
/* maximal lookahead length */
HB_ClassDefinition LookaheadClassDef;
/* LookaheadClassDef table */
HB_UShort ChainPosClassSetCount;
/* number of ChainPosClassSet
tables */
HB_ChainPosClassSet* ChainPosClassSet;
/* array of ChainPosClassSet
tables */
};
typedef struct HB_ChainContextPosFormat2_ HB_ChainContextPosFormat2;
struct HB_ChainContextPosFormat3_
{
HB_UShort BacktrackGlyphCount;
/* number of backtrack glyphs */
HB_Coverage* BacktrackCoverage;
/* array of backtrack Coverage
tables */
HB_UShort InputGlyphCount;
/* number of input glyphs */
HB_Coverage* InputCoverage;
/* array of input coverage
tables */
HB_UShort LookaheadGlyphCount;
/* number of lookahead glyphs */
HB_Coverage* LookaheadCoverage;
/* array of lookahead coverage
tables */
HB_UShort PosCount; /* number of PosLookupRecords */
HB_PosLookupRecord* PosLookupRecord;
/* array of substitution lookups */
};
typedef struct HB_ChainContextPosFormat3_ HB_ChainContextPosFormat3;
struct HB_ChainContextPos_
{
HB_UShort PosFormat; /* 1, 2, or 3 */
union
{
HB_ChainContextPosFormat1 ccpf1;
HB_ChainContextPosFormat2 ccpf2;
HB_ChainContextPosFormat3 ccpf3;
} ccpf;
};
typedef struct HB_ChainContextPos_ HB_ChainContextPos;
union HB_GPOS_SubTable_
{
HB_SinglePos single;
HB_PairPos pair;
HB_CursivePos cursive;
HB_MarkBasePos markbase;
HB_MarkLigPos marklig;
HB_MarkMarkPos markmark;
HB_ContextPos context;
HB_ChainContextPos chain;
};
typedef union HB_GPOS_SubTable_ HB_GPOS_SubTable;
HB_Error _HB_GPOS_Load_SubTable( HB_GPOS_SubTable* st,
HB_Stream stream,
HB_UShort lookup_type );
void _HB_GPOS_Free_SubTable( HB_GPOS_SubTable* st,
HB_UShort lookup_type );
HB_END_HEADER
#endif /* HARFBUZZ_GPOS_PRIVATE_H */
|