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