Home | History | Annotate | Download | only in src
      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 #ifdef HB_USE_PACKED_STRUCTS
     36 #pragma pack(push, 1)
     37 #endif
     38 
     39 /* shared tables */
     40 
     41 #define VR_X_PLACEMENT_DEVICE 0
     42 #define VR_Y_PLACEMENT_DEVICE 1
     43 #define VR_X_ADVANCE_DEVICE   2
     44 #define VR_Y_ADVANCE_DEVICE   3
     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   HB_PairValueRecord*  PairValueRecord;
    223 				      /* array of PairValueRecord tables  */
    224 };
    225 
    226 typedef struct HB_PairSet_  HB_PairSet;
    227 
    228 
    229 struct  HB_PairPosFormat1_
    230 {
    231   HB_UShort     PairSetCount;         /* number of PairSet tables    */
    232   HB_PairSet*  PairSet;              /* array of PairSet tables     */
    233 };
    234 
    235 typedef struct HB_PairPosFormat1_  HB_PairPosFormat1;
    236 
    237 
    238 struct  HB_Class2Record_
    239 {
    240   HB_ValueRecord  Value1;            /* pos. data for first glyph  */
    241   HB_ValueRecord  Value2;            /* pos. data for second glyph */
    242 };
    243 
    244 typedef struct HB_Class2Record_  HB_Class2Record;
    245 
    246 
    247 struct  HB_Class1Record_
    248 {
    249   HB_Class2Record*  Class2Record;    /* array of Class2Record tables */
    250 };
    251 
    252 typedef struct HB_Class1Record_  HB_Class1Record;
    253 
    254 
    255 struct  HB_PairPosFormat2_
    256 {
    257   HB_ClassDefinition  ClassDef1;     /* class def. for first glyph     */
    258   HB_ClassDefinition  ClassDef2;     /* class def. for second glyph    */
    259   HB_UShort            Class1Count;   /* number of classes in ClassDef1
    260 					 table                          */
    261   HB_UShort            Class2Count;   /* number of classes in ClassDef2
    262 					 table                          */
    263   HB_Class1Record*    Class1Record;  /* array of Class1Record tables   */
    264 };
    265 
    266 typedef struct HB_PairPosFormat2_  HB_PairPosFormat2;
    267 
    268 
    269 struct  HB_PairPos_
    270 {
    271   HB_Byte       PosFormat;            /* 1 or 2         */
    272   HB_Coverage  Coverage;             /* Coverage table */
    273   HB_UShort     ValueFormat1;         /* format of ValueRecord table
    274 					 for first glyph             */
    275   HB_UShort     ValueFormat2;         /* format of ValueRecord table
    276 					 for second glyph            */
    277 
    278   union
    279   {
    280     HB_PairPosFormat1  ppf1;
    281     HB_PairPosFormat2  ppf2;
    282   } ppf;
    283 };
    284 
    285 typedef struct HB_PairPos_  HB_PairPos;
    286 
    287 
    288 /* LookupType 3 */
    289 
    290 struct  HB_EntryExitRecord_
    291 {
    292   HB_Anchor  EntryAnchor;            /* entry Anchor table */
    293   HB_Anchor  ExitAnchor;             /* exit Anchor table  */
    294 };
    295 
    296 
    297 typedef struct HB_EntryExitRecord_  HB_EntryExitRecord;
    298 
    299 struct  HB_CursivePos_
    300 {
    301   HB_UShort             PosFormat;    /* always 1                         */
    302   HB_Coverage          Coverage;     /* Coverage table                   */
    303   HB_UShort             EntryExitCount;
    304 				      /* number of EntryExitRecord tables */
    305   HB_EntryExitRecord*  EntryExitRecord;
    306 				      /* array of EntryExitRecord tables  */
    307 };
    308 
    309 typedef struct HB_CursivePos_  HB_CursivePos;
    310 
    311 
    312 /* LookupType 4 */
    313 
    314 struct  HB_BaseRecord_
    315 {
    316   HB_Anchor*  BaseAnchor;            /* array of base glyph anchor
    317 					 tables                     */
    318 };
    319 
    320 typedef struct HB_BaseRecord_  HB_BaseRecord;
    321 
    322 
    323 struct  HB_BaseArray_
    324 {
    325   HB_UShort        BaseCount;         /* number of BaseRecord tables */
    326   HB_BaseRecord*  BaseRecord;        /* array of BaseRecord tables  */
    327 };
    328 
    329 typedef struct HB_BaseArray_  HB_BaseArray;
    330 
    331 
    332 struct  HB_MarkBasePos_
    333 {
    334   HB_UShort      PosFormat;           /* always 1                  */
    335   HB_Coverage   MarkCoverage;        /* mark glyph coverage table */
    336   HB_Coverage   BaseCoverage;        /* base glyph coverage table */
    337   HB_UShort      ClassCount;          /* number of mark classes    */
    338   HB_MarkArray  MarkArray;           /* mark array table          */
    339   HB_BaseArray  BaseArray;           /* base array table          */
    340 };
    341 
    342 typedef struct HB_MarkBasePos_  HB_MarkBasePos;
    343 
    344 
    345 /* LookupType 5 */
    346 
    347 struct  HB_ComponentRecord_
    348 {
    349   HB_Anchor*  LigatureAnchor;        /* array of ligature glyph anchor
    350 					 tables                         */
    351 };
    352 
    353 typedef struct HB_ComponentRecord_  HB_ComponentRecord;
    354 
    355 
    356 struct  HB_LigatureAttach_
    357 {
    358   HB_UShort             ComponentCount;
    359 				      /* number of ComponentRecord tables */
    360   HB_ComponentRecord*  ComponentRecord;
    361 				      /* array of ComponentRecord tables  */
    362 };
    363 
    364 typedef struct HB_LigatureAttach_  HB_LigatureAttach;
    365 
    366 
    367 struct  HB_LigatureArray_
    368 {
    369   HB_UShort            LigatureCount; /* number of LigatureAttach tables */
    370   HB_LigatureAttach*  LigatureAttach;
    371 				      /* array of LigatureAttach tables  */
    372 };
    373 
    374 typedef struct HB_LigatureArray_  HB_LigatureArray;
    375 
    376 
    377 struct  HB_MarkLigPos_
    378 {
    379   HB_UShort          PosFormat;       /* always 1                      */
    380   HB_Coverage       MarkCoverage;    /* mark glyph coverage table     */
    381   HB_Coverage       LigatureCoverage;
    382 				      /* ligature glyph coverage table */
    383   HB_UShort          ClassCount;      /* number of mark classes        */
    384   HB_MarkArray      MarkArray;       /* mark array table              */
    385   HB_LigatureArray  LigatureArray;   /* ligature array table          */
    386 };
    387 
    388 typedef struct HB_MarkLigPos_  HB_MarkLigPos;
    389 
    390 
    391 /* LookupType 6 */
    392 
    393 struct  HB_Mark2Record_
    394 {
    395   HB_Anchor*  Mark2Anchor;           /* array of mark glyph anchor
    396 					 tables                     */
    397 };
    398 
    399 typedef struct HB_Mark2Record_  HB_Mark2Record;
    400 
    401 
    402 struct  HB_Mark2Array_
    403 {
    404   HB_UShort         Mark2Count;       /* number of Mark2Record tables */
    405   HB_Mark2Record*  Mark2Record;      /* array of Mark2Record tables  */
    406 };
    407 
    408 typedef struct HB_Mark2Array_  HB_Mark2Array;
    409 
    410 
    411 struct  HB_MarkMarkPos_
    412 {
    413   HB_UShort       PosFormat;          /* always 1                         */
    414   HB_Coverage    Mark1Coverage;      /* first mark glyph coverage table  */
    415   HB_Coverage    Mark2Coverage;      /* second mark glyph coverave table */
    416   HB_UShort       ClassCount;         /* number of combining mark classes */
    417   HB_MarkArray   Mark1Array;         /* MarkArray table for first mark   */
    418   HB_Mark2Array  Mark2Array;         /* MarkArray table for second mark  */
    419 };
    420 
    421 typedef struct HB_MarkMarkPos_  HB_MarkMarkPos;
    422 
    423 
    424 /* needed by both lookup type 7 and 8 */
    425 
    426 struct  HB_PosLookupRecord_
    427 {
    428   HB_UShort  SequenceIndex;           /* index into current
    429 					 glyph sequence               */
    430   HB_UShort  LookupListIndex;         /* Lookup to apply to that pos. */
    431 };
    432 
    433 typedef struct HB_PosLookupRecord_  HB_PosLookupRecord;
    434 
    435 
    436 /* LookupType 7 */
    437 
    438 struct  HB_PosRule_
    439 {
    440   HB_UShort             GlyphCount;   /* total number of input glyphs     */
    441   HB_UShort             PosCount;     /* number of PosLookupRecord tables */
    442   HB_UShort*            Input;        /* array of input glyph IDs         */
    443   HB_PosLookupRecord*  PosLookupRecord;
    444 				      /* array of PosLookupRecord tables  */
    445 };
    446 
    447 typedef struct HB_PosRule_  HB_PosRule;
    448 
    449 
    450 struct  HB_PosRuleSet_
    451 {
    452   HB_UShort     PosRuleCount;         /* number of PosRule tables */
    453   HB_PosRule*  PosRule;              /* array of PosRule tables  */
    454 };
    455 
    456 typedef struct HB_PosRuleSet_  HB_PosRuleSet;
    457 
    458 
    459 struct  HB_ContextPosFormat1_
    460 {
    461   HB_Coverage     Coverage;          /* Coverage table              */
    462   HB_UShort        PosRuleSetCount;   /* number of PosRuleSet tables */
    463   HB_PosRuleSet*  PosRuleSet;        /* array of PosRuleSet tables  */
    464 };
    465 
    466 typedef struct HB_ContextPosFormat1_  HB_ContextPosFormat1;
    467 
    468 
    469 struct  HB_PosClassRule_
    470 {
    471   HB_UShort             GlyphCount;   /* total number of context classes  */
    472   HB_UShort             PosCount;     /* number of PosLookupRecord tables */
    473   HB_UShort*            Class;        /* array of classes                 */
    474   HB_PosLookupRecord*  PosLookupRecord;
    475 				      /* array of PosLookupRecord tables  */
    476 };
    477 
    478 typedef struct HB_PosClassRule_  HB_PosClassRule;
    479 
    480 
    481 struct  HB_PosClassSet_
    482 {
    483   HB_UShort          PosClassRuleCount;
    484 				      /* number of PosClassRule tables */
    485   HB_PosClassRule*  PosClassRule;    /* array of PosClassRule tables  */
    486 };
    487 
    488 typedef struct HB_PosClassSet_  HB_PosClassSet;
    489 
    490 
    491 /* The `MaxContextLength' field is not defined in the TTO specification
    492    but simplifies the implementation of this format.  It holds the
    493    maximal context length used in the context rules.                    */
    494 
    495 struct  HB_ContextPosFormat2_
    496 {
    497   HB_UShort            MaxContextLength;
    498 				      /* maximal context length       */
    499   HB_Coverage         Coverage;      /* Coverage table               */
    500   HB_ClassDefinition  ClassDef;      /* ClassDef table               */
    501   HB_UShort            PosClassSetCount;
    502 				      /* number of PosClassSet tables */
    503   HB_PosClassSet*     PosClassSet;   /* array of PosClassSet tables  */
    504 };
    505 
    506 typedef struct HB_ContextPosFormat2_  HB_ContextPosFormat2;
    507 
    508 
    509 struct  HB_ContextPosFormat3_
    510 {
    511   HB_UShort             GlyphCount;   /* number of input glyphs           */
    512   HB_UShort             PosCount;     /* number of PosLookupRecord tables */
    513   HB_Coverage*         Coverage;     /* array of Coverage tables         */
    514   HB_PosLookupRecord*  PosLookupRecord;
    515 				      /* array of PosLookupRecord tables  */
    516 };
    517 
    518 typedef struct HB_ContextPosFormat3_  HB_ContextPosFormat3;
    519 
    520 
    521 struct  HB_ContextPos_
    522 {
    523   HB_Byte  PosFormat;                 /* 1, 2, or 3     */
    524 
    525   union
    526   {
    527     HB_ContextPosFormat1  cpf1;
    528     HB_ContextPosFormat2  cpf2;
    529     HB_ContextPosFormat3  cpf3;
    530   } cpf;
    531 };
    532 
    533 typedef struct HB_ContextPos_  HB_ContextPos;
    534 
    535 
    536 /* LookupType 8 */
    537 
    538 struct  HB_ChainPosRule_
    539 {
    540   HB_UShort*            Backtrack;    /* array of backtrack glyph IDs     */
    541   HB_UShort*            Input;        /* array of input glyph IDs         */
    542   HB_UShort*            Lookahead;    /* array of lookahead glyph IDs     */
    543   HB_PosLookupRecord*  PosLookupRecord;
    544 				      /* array of PosLookupRecords       */
    545   HB_UShort             BacktrackGlyphCount;
    546 				      /* total number of backtrack glyphs */
    547   HB_UShort             InputGlyphCount;
    548 				      /* total number of input glyphs     */
    549   HB_UShort             LookaheadGlyphCount;
    550 				      /* total number of lookahead glyphs */
    551   HB_UShort             PosCount;     /* number of PosLookupRecords       */
    552 };
    553 
    554 typedef struct HB_ChainPosRule_  HB_ChainPosRule;
    555 
    556 
    557 struct  HB_ChainPosRuleSet_
    558 {
    559   HB_UShort          ChainPosRuleCount;
    560 				      /* number of ChainPosRule tables */
    561   HB_ChainPosRule*  ChainPosRule;    /* array of ChainPosRule tables  */
    562 };
    563 
    564 typedef struct HB_ChainPosRuleSet_  HB_ChainPosRuleSet;
    565 
    566 
    567 struct  HB_ChainContextPosFormat1_
    568 {
    569   HB_Coverage          Coverage;     /* Coverage table                   */
    570   HB_UShort             ChainPosRuleSetCount;
    571 				      /* number of ChainPosRuleSet tables */
    572   HB_ChainPosRuleSet*  ChainPosRuleSet;
    573 				      /* array of ChainPosRuleSet tables  */
    574 };
    575 
    576 typedef struct HB_ChainContextPosFormat1_  HB_ChainContextPosFormat1;
    577 
    578 
    579 struct  HB_ChainPosClassRule_
    580 {
    581   HB_UShort*            Backtrack;    /* array of backtrack classes      */
    582   HB_UShort*            Input;        /* array of context classes        */
    583   HB_UShort*            Lookahead;    /* array of lookahead classes      */
    584   HB_PosLookupRecord*  PosLookupRecord;
    585 				      /* array of substitution lookups   */
    586   HB_UShort             BacktrackGlyphCount;
    587 				      /* total number of backtrack
    588 					 classes                         */
    589   HB_UShort             InputGlyphCount;
    590 				      /* total number of context classes */
    591   HB_UShort             LookaheadGlyphCount;
    592 				      /* total number of lookahead
    593 					 classes                         */
    594   HB_UShort             PosCount;     /* number of PosLookupRecords      */
    595 };
    596 
    597 typedef struct HB_ChainPosClassRule_  HB_ChainPosClassRule;
    598 
    599 
    600 struct  HB_ChainPosClassSet_
    601 {
    602   HB_UShort               ChainPosClassRuleCount;
    603 				      /* number of ChainPosClassRule
    604 					 tables                      */
    605   HB_ChainPosClassRule*  ChainPosClassRule;
    606 				      /* array of ChainPosClassRule
    607 					 tables                      */
    608 };
    609 
    610 typedef struct HB_ChainPosClassSet_  HB_ChainPosClassSet;
    611 
    612 
    613 /* The `MaxXXXLength' fields are not defined in the TTO specification
    614    but simplifies the implementation of this format.  It holds the
    615    maximal context length used in the specific context rules.         */
    616 
    617 struct  HB_ChainContextPosFormat2_
    618 {
    619   HB_Coverage           Coverage;    /* Coverage table             */
    620 
    621   HB_UShort              MaxBacktrackLength;
    622 				      /* maximal backtrack length   */
    623   HB_ClassDefinition    BacktrackClassDef;
    624 				      /* BacktrackClassDef table    */
    625   HB_UShort              MaxInputLength;
    626 				      /* maximal input length       */
    627   HB_ClassDefinition    InputClassDef;
    628 				      /* InputClassDef table        */
    629   HB_UShort              MaxLookaheadLength;
    630 				      /* maximal lookahead length   */
    631   HB_ClassDefinition    LookaheadClassDef;
    632 				      /* LookaheadClassDef table    */
    633 
    634   HB_UShort              ChainPosClassSetCount;
    635 				      /* number of ChainPosClassSet
    636 					 tables                     */
    637   HB_ChainPosClassSet*  ChainPosClassSet;
    638 				      /* array of ChainPosClassSet
    639 					 tables                     */
    640 };
    641 
    642 typedef struct HB_ChainContextPosFormat2_  HB_ChainContextPosFormat2;
    643 
    644 
    645 struct  HB_ChainContextPosFormat3_
    646 {
    647   HB_UShort             BacktrackGlyphCount;
    648 				      /* number of backtrack glyphs    */
    649   HB_Coverage*         BacktrackCoverage;
    650 				      /* array of backtrack Coverage
    651 					 tables                        */
    652   HB_UShort             InputGlyphCount;
    653 				      /* number of input glyphs        */
    654   HB_Coverage*         InputCoverage;
    655 				      /* array of input coverage
    656 					 tables                        */
    657   HB_UShort             LookaheadGlyphCount;
    658 				      /* number of lookahead glyphs    */
    659   HB_Coverage*         LookaheadCoverage;
    660 				      /* array of lookahead coverage
    661 					 tables                        */
    662   HB_UShort             PosCount;     /* number of PosLookupRecords    */
    663   HB_PosLookupRecord*  PosLookupRecord;
    664 				      /* array of substitution lookups */
    665 };
    666 
    667 typedef struct HB_ChainContextPosFormat3_  HB_ChainContextPosFormat3;
    668 
    669 
    670 struct  HB_ChainContextPos_
    671 {
    672   HB_Byte  PosFormat;               /* 1, 2, or 3 */
    673 
    674   union
    675   {
    676     HB_ChainContextPosFormat1  ccpf1;
    677     HB_ChainContextPosFormat2  ccpf2;
    678     HB_ChainContextPosFormat3  ccpf3;
    679   } ccpf;
    680 };
    681 
    682 typedef struct HB_ChainContextPos_  HB_ChainContextPos;
    683 
    684 
    685 #if 0
    686 /* LookupType 10 */
    687 struct HB_ExtensionPos_
    688 {
    689   HB_UShort      PosFormat;           /* always 1 */
    690   HB_UShort      LookuptType;         /* lookup-type of referenced subtable */
    691   HB_GPOS_SubTable *subtable;         /* referenced subtable */
    692 };
    693 
    694 typedef struct HB_ExtensionPos_  HB_ExtensionPos;
    695 #endif
    696 
    697 
    698 union  HB_GPOS_SubTable_
    699 {
    700   HB_SinglePos        single;
    701   HB_PairPos          pair;
    702   HB_CursivePos       cursive;
    703   HB_MarkBasePos      markbase;
    704   HB_MarkLigPos       marklig;
    705   HB_MarkMarkPos      markmark;
    706   HB_ContextPos       context;
    707   HB_ChainContextPos  chain;
    708 };
    709 
    710 typedef union HB_GPOS_SubTable_  HB_GPOS_SubTable;
    711 
    712 
    713 
    714 HB_INTERNAL HB_Error
    715 _HB_GPOS_Load_SubTable( HB_GPOS_SubTable* st,
    716 				  HB_Stream     stream,
    717 				  HB_UShort     lookup_type );
    718 
    719 HB_INTERNAL void
    720 _HB_GPOS_Free_SubTable( HB_GPOS_SubTable* st,
    721 			      HB_UShort     lookup_type );
    722 
    723 #ifdef HB_USE_PACKED_STRUCTS
    724 #pragma pack(pop)
    725 #endif
    726 
    727 HB_END_HEADER
    728 
    729 #endif /* HARFBUZZ_GPOS_PRIVATE_H */
    730