OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1998-2004 David Turner and Werner Lemberg | 2 * Copyright (C) 1998-2004 David Turner and Werner Lemberg |
3 * Copyright (C) 2006 Behdad Esfahbod | 3 * Copyright (C) 2006 Behdad Esfahbod |
4 * | 4 * |
5 * This is part of HarfBuzz, an OpenType Layout engine library. | 5 * This is part of HarfBuzz, an OpenType Layout engine library. |
6 * | 6 * |
7 * Permission is hereby granted, without written agreement and without | 7 * Permission is hereby granted, without written agreement and without |
8 * license or royalty fees, to use, copy, modify, and distribute this | 8 * license or royalty fees, to use, copy, modify, and distribute this |
9 * software and its documentation for any purpose, provided that the | 9 * software and its documentation for any purpose, provided that the |
10 * above copyright notice and the following two paragraphs appear in | 10 * above copyright notice and the following two paragraphs appear in |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 #ifndef HARFBUZZ_GPOS_PRIVATE_H | 26 #ifndef HARFBUZZ_GPOS_PRIVATE_H |
27 #define HARFBUZZ_GPOS_PRIVATE_H | 27 #define HARFBUZZ_GPOS_PRIVATE_H |
28 | 28 |
29 #include "harfbuzz-impl.h" | 29 #include "harfbuzz-impl.h" |
30 #include "harfbuzz-stream-private.h" | 30 #include "harfbuzz-stream-private.h" |
31 #include "harfbuzz-gpos.h" | 31 #include "harfbuzz-gpos.h" |
32 | 32 |
33 HB_BEGIN_HEADER | 33 HB_BEGIN_HEADER |
34 | 34 |
| 35 #ifdef HB_USE_PACKED_STRUCTS |
| 36 #pragma pack(push, 1) |
| 37 #endif |
35 | 38 |
36 /* shared tables */ | 39 /* shared tables */ |
37 | 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 |
38 struct HB_ValueRecord_ | 46 struct HB_ValueRecord_ |
39 { | 47 { |
40 HB_Short XPlacement; /* horizontal adjustment for | 48 HB_Short XPlacement; /* horizontal adjustment for |
41 placement */ | 49 placement */ |
42 HB_Short YPlacement; /* vertical adjustment for | 50 HB_Short YPlacement; /* vertical adjustment for |
43 placement */ | 51 placement */ |
44 HB_Short XAdvance; /* horizontal adjustment for | 52 HB_Short XAdvance; /* horizontal adjustment for |
45 advance */ | 53 advance */ |
46 HB_Short YAdvance; /* vertical adjustment for | 54 HB_Short YAdvance; /* vertical adjustment for |
47 advance */ | 55 advance */ |
48 HB_Device XPlacementDevice; /* device table for horizontal | 56 |
49 » » » » » placement */ | 57 HB_Device** DeviceTables; /* device tables for placement |
50 HB_Device YPlacementDevice; /* device table for vertical | 58 » » » » » and advance */ |
51 » » » » » placement */ | 59 |
52 HB_Device XAdvanceDevice; /* device table for horizontal | 60 #ifdef HB_SUPPORT_MULTIPLE_MASTER |
53 » » » » » advance */ | |
54 HB_Device YAdvanceDevice; /* device table for vertical | |
55 » » » » » advance */ | |
56 HB_UShort XIdPlacement; /* horizontal placement metric ID */ | 61 HB_UShort XIdPlacement; /* horizontal placement metric ID */ |
57 HB_UShort YIdPlacement; /* vertical placement metric ID */ | 62 HB_UShort YIdPlacement; /* vertical placement metric ID */ |
58 HB_UShort XIdAdvance; /* horizontal advance metric ID */ | 63 HB_UShort XIdAdvance; /* horizontal advance metric ID */ |
59 HB_UShort YIdAdvance; /* vertical advance metric ID */ | 64 HB_UShort YIdAdvance; /* vertical advance metric ID */ |
| 65 #endif |
60 }; | 66 }; |
61 | 67 |
62 typedef struct HB_ValueRecord_ HB_ValueRecord; | 68 typedef struct HB_ValueRecord_ HB_ValueRecord; |
63 | 69 |
64 | 70 |
65 /* Mask values to scan the value format of the ValueRecord structure. | 71 /* Mask values to scan the value format of the ValueRecord structure. |
66 We always expand compressed ValueRecords of the font. */ | 72 We always expand compressed ValueRecords of the font. */ |
67 | 73 |
| 74 #define HB_GPOS_FORMAT_HAVE_DEVICE_TABLES 0x00F0 |
| 75 |
68 #define HB_GPOS_FORMAT_HAVE_X_PLACEMENT 0x0001 | 76 #define HB_GPOS_FORMAT_HAVE_X_PLACEMENT 0x0001 |
69 #define HB_GPOS_FORMAT_HAVE_Y_PLACEMENT 0x0002 | 77 #define HB_GPOS_FORMAT_HAVE_Y_PLACEMENT 0x0002 |
70 #define HB_GPOS_FORMAT_HAVE_X_ADVANCE 0x0004 | 78 #define HB_GPOS_FORMAT_HAVE_X_ADVANCE 0x0004 |
71 #define HB_GPOS_FORMAT_HAVE_Y_ADVANCE 0x0008 | 79 #define HB_GPOS_FORMAT_HAVE_Y_ADVANCE 0x0008 |
72 #define HB_GPOS_FORMAT_HAVE_X_PLACEMENT_DEVICE 0x0010 | 80 #define HB_GPOS_FORMAT_HAVE_X_PLACEMENT_DEVICE 0x0010 |
73 #define HB_GPOS_FORMAT_HAVE_Y_PLACEMENT_DEVICE 0x0020 | 81 #define HB_GPOS_FORMAT_HAVE_Y_PLACEMENT_DEVICE 0x0020 |
74 #define HB_GPOS_FORMAT_HAVE_X_ADVANCE_DEVICE 0x0040 | 82 #define HB_GPOS_FORMAT_HAVE_X_ADVANCE_DEVICE 0x0040 |
75 #define HB_GPOS_FORMAT_HAVE_Y_ADVANCE_DEVICE 0x0080 | 83 #define HB_GPOS_FORMAT_HAVE_Y_ADVANCE_DEVICE 0x0080 |
76 #define HB_GPOS_FORMAT_HAVE_X_ID_PLACEMENT 0x0100 | 84 #define HB_GPOS_FORMAT_HAVE_X_ID_PLACEMENT 0x0100 |
77 #define HB_GPOS_FORMAT_HAVE_Y_ID_PLACEMENT 0x0200 | 85 #define HB_GPOS_FORMAT_HAVE_Y_ID_PLACEMENT 0x0200 |
(...skipping 12 matching lines...) Expand all Loading... |
90 | 98 |
91 struct HB_AnchorFormat2_ | 99 struct HB_AnchorFormat2_ |
92 { | 100 { |
93 HB_Short XCoordinate; /* horizontal value */ | 101 HB_Short XCoordinate; /* horizontal value */ |
94 HB_Short YCoordinate; /* vertical value */ | 102 HB_Short YCoordinate; /* vertical value */ |
95 HB_UShort AnchorPoint; /* index to glyph contour point */ | 103 HB_UShort AnchorPoint; /* index to glyph contour point */ |
96 }; | 104 }; |
97 | 105 |
98 typedef struct HB_AnchorFormat2_ HB_AnchorFormat2; | 106 typedef struct HB_AnchorFormat2_ HB_AnchorFormat2; |
99 | 107 |
| 108 #define AF3_X_DEVICE_TABLE 0 |
| 109 #define AF3_Y_DEVICE_TABLE 1 |
100 | 110 |
101 struct HB_AnchorFormat3_ | 111 struct HB_AnchorFormat3_ |
102 { | 112 { |
103 HB_Short XCoordinate; /* horizontal value */ | 113 HB_Short XCoordinate; /* horizontal value */ |
104 HB_Short YCoordinate; /* vertical value */ | 114 HB_Short YCoordinate; /* vertical value */ |
105 HB_Device XDeviceTable; /* device table for X coordinate */ | 115 HB_Device** DeviceTables; /* device tables for coordinates */ |
106 HB_Device YDeviceTable; /* device table for Y coordinate */ | |
107 }; | 116 }; |
108 | 117 |
109 typedef struct HB_AnchorFormat3_ HB_AnchorFormat3; | 118 typedef struct HB_AnchorFormat3_ HB_AnchorFormat3; |
110 | 119 |
111 | 120 |
| 121 #ifdef HB_SUPPORT_MULTIPLE_MASTER |
112 struct HB_AnchorFormat4_ | 122 struct HB_AnchorFormat4_ |
113 { | 123 { |
114 HB_UShort XIdAnchor; /* horizontal metric ID */ | 124 HB_UShort XIdAnchor; /* horizontal metric ID */ |
115 HB_UShort YIdAnchor; /* vertical metric ID */ | 125 HB_UShort YIdAnchor; /* vertical metric ID */ |
116 }; | 126 }; |
117 | 127 |
118 typedef struct HB_AnchorFormat4_ HB_AnchorFormat4; | 128 typedef struct HB_AnchorFormat4_ HB_AnchorFormat4; |
| 129 #endif |
119 | 130 |
120 | 131 |
121 struct HB_Anchor_ | 132 struct HB_Anchor_ |
122 { | 133 { |
123 HB_UShort PosFormat; /* 1, 2, 3, or 4 -- 0 indicates | 134 HB_Byte PosFormat; /* 1, 2, 3, or 4 -- 0 indicates |
124 that there is no Anchor table */ | 135 that there is no Anchor table */ |
125 | 136 |
126 union | 137 union |
127 { | 138 { |
128 HB_AnchorFormat1 af1; | 139 HB_AnchorFormat1 af1; |
129 HB_AnchorFormat2 af2; | 140 HB_AnchorFormat2 af2; |
130 HB_AnchorFormat3 af3; | 141 HB_AnchorFormat3 af3; |
| 142 #ifdef HB_SUPPORT_MULTIPLE_MASTER |
131 HB_AnchorFormat4 af4; | 143 HB_AnchorFormat4 af4; |
| 144 #endif |
132 } af; | 145 } af; |
133 }; | 146 }; |
134 | 147 |
135 typedef struct HB_Anchor_ HB_Anchor; | 148 typedef struct HB_Anchor_ HB_Anchor; |
136 | 149 |
137 | 150 |
138 struct HB_MarkRecord_ | 151 struct HB_MarkRecord_ |
139 { | 152 { |
140 HB_UShort Class; /* mark class */ | 153 HB_UShort Class; /* mark class */ |
141 HB_Anchor MarkAnchor; /* anchor table */ | 154 HB_Anchor MarkAnchor; /* anchor table */ |
(...skipping 26 matching lines...) Expand all Loading... |
168 { | 181 { |
169 HB_UShort ValueCount; /* number of ValueRecord tables */ | 182 HB_UShort ValueCount; /* number of ValueRecord tables */ |
170 HB_ValueRecord* Value; /* array of ValueRecord tables */ | 183 HB_ValueRecord* Value; /* array of ValueRecord tables */ |
171 }; | 184 }; |
172 | 185 |
173 typedef struct HB_SinglePosFormat2_ HB_SinglePosFormat2; | 186 typedef struct HB_SinglePosFormat2_ HB_SinglePosFormat2; |
174 | 187 |
175 | 188 |
176 struct HB_SinglePos_ | 189 struct HB_SinglePos_ |
177 { | 190 { |
178 HB_UShort PosFormat; /* 1 or 2 */ | 191 HB_Byte PosFormat; /* 1 or 2 */ |
179 HB_Coverage Coverage; /* Coverage table */ | 192 HB_Coverage Coverage; /* Coverage table */ |
180 | 193 |
181 HB_UShort ValueFormat; /* format of ValueRecord table */ | 194 HB_UShort ValueFormat; /* format of ValueRecord table */ |
182 | 195 |
183 union | 196 union |
184 { | 197 { |
185 HB_SinglePosFormat1 spf1; | 198 HB_SinglePosFormat1 spf1; |
186 HB_SinglePosFormat2 spf2; | 199 HB_SinglePosFormat2 spf2; |
187 } spf; | 200 } spf; |
188 }; | 201 }; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 HB_UShort Class2Count; /* number of classes in ClassDef2 | 261 HB_UShort Class2Count; /* number of classes in ClassDef2 |
249 table */ | 262 table */ |
250 HB_Class1Record* Class1Record; /* array of Class1Record tables */ | 263 HB_Class1Record* Class1Record; /* array of Class1Record tables */ |
251 }; | 264 }; |
252 | 265 |
253 typedef struct HB_PairPosFormat2_ HB_PairPosFormat2; | 266 typedef struct HB_PairPosFormat2_ HB_PairPosFormat2; |
254 | 267 |
255 | 268 |
256 struct HB_PairPos_ | 269 struct HB_PairPos_ |
257 { | 270 { |
258 HB_UShort PosFormat; /* 1 or 2 */ | 271 HB_Byte PosFormat; /* 1 or 2 */ |
259 HB_Coverage Coverage; /* Coverage table */ | 272 HB_Coverage Coverage; /* Coverage table */ |
260 HB_UShort ValueFormat1; /* format of ValueRecord table | 273 HB_UShort ValueFormat1; /* format of ValueRecord table |
261 for first glyph */ | 274 for first glyph */ |
262 HB_UShort ValueFormat2; /* format of ValueRecord table | 275 HB_UShort ValueFormat2; /* format of ValueRecord table |
263 for second glyph */ | 276 for second glyph */ |
264 | 277 |
265 union | 278 union |
266 { | 279 { |
267 HB_PairPosFormat1 ppf1; | 280 HB_PairPosFormat1 ppf1; |
268 HB_PairPosFormat2 ppf2; | 281 HB_PairPosFormat2 ppf2; |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 HB_Coverage* Coverage; /* array of Coverage tables */ | 513 HB_Coverage* Coverage; /* array of Coverage tables */ |
501 HB_PosLookupRecord* PosLookupRecord; | 514 HB_PosLookupRecord* PosLookupRecord; |
502 /* array of PosLookupRecord tables */ | 515 /* array of PosLookupRecord tables */ |
503 }; | 516 }; |
504 | 517 |
505 typedef struct HB_ContextPosFormat3_ HB_ContextPosFormat3; | 518 typedef struct HB_ContextPosFormat3_ HB_ContextPosFormat3; |
506 | 519 |
507 | 520 |
508 struct HB_ContextPos_ | 521 struct HB_ContextPos_ |
509 { | 522 { |
510 HB_UShort PosFormat; /* 1, 2, or 3 */ | 523 HB_Byte PosFormat; /* 1, 2, or 3 */ |
511 | 524 |
512 union | 525 union |
513 { | 526 { |
514 HB_ContextPosFormat1 cpf1; | 527 HB_ContextPosFormat1 cpf1; |
515 HB_ContextPosFormat2 cpf2; | 528 HB_ContextPosFormat2 cpf2; |
516 HB_ContextPosFormat3 cpf3; | 529 HB_ContextPosFormat3 cpf3; |
517 } cpf; | 530 } cpf; |
518 }; | 531 }; |
519 | 532 |
520 typedef struct HB_ContextPos_ HB_ContextPos; | 533 typedef struct HB_ContextPos_ HB_ContextPos; |
521 | 534 |
522 | 535 |
523 /* LookupType 8 */ | 536 /* LookupType 8 */ |
524 | 537 |
525 struct HB_ChainPosRule_ | 538 struct HB_ChainPosRule_ |
526 { | 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 */ |
527 HB_UShort BacktrackGlyphCount; | 545 HB_UShort BacktrackGlyphCount; |
528 /* total number of backtrack glyphs */ | 546 /* total number of backtrack glyphs */ |
529 HB_UShort* Backtrack; /* array of backtrack glyph IDs */ | |
530 HB_UShort InputGlyphCount; | 547 HB_UShort InputGlyphCount; |
531 /* total number of input glyphs */ | 548 /* total number of input glyphs */ |
532 HB_UShort* Input; /* array of input glyph IDs */ | |
533 HB_UShort LookaheadGlyphCount; | 549 HB_UShort LookaheadGlyphCount; |
534 /* total number of lookahead glyphs */ | 550 /* total number of lookahead glyphs */ |
535 HB_UShort* Lookahead; /* array of lookahead glyph IDs */ | |
536 HB_UShort PosCount; /* number of PosLookupRecords */ | 551 HB_UShort PosCount; /* number of PosLookupRecords */ |
537 HB_PosLookupRecord* PosLookupRecord; | |
538 /* array of PosLookupRecords */ | |
539 }; | 552 }; |
540 | 553 |
541 typedef struct HB_ChainPosRule_ HB_ChainPosRule; | 554 typedef struct HB_ChainPosRule_ HB_ChainPosRule; |
542 | 555 |
543 | 556 |
544 struct HB_ChainPosRuleSet_ | 557 struct HB_ChainPosRuleSet_ |
545 { | 558 { |
546 HB_UShort ChainPosRuleCount; | 559 HB_UShort ChainPosRuleCount; |
547 /* number of ChainPosRule tables */ | 560 /* number of ChainPosRule tables */ |
548 HB_ChainPosRule* ChainPosRule; /* array of ChainPosRule tables */ | 561 HB_ChainPosRule* ChainPosRule; /* array of ChainPosRule tables */ |
549 }; | 562 }; |
550 | 563 |
551 typedef struct HB_ChainPosRuleSet_ HB_ChainPosRuleSet; | 564 typedef struct HB_ChainPosRuleSet_ HB_ChainPosRuleSet; |
552 | 565 |
553 | 566 |
554 struct HB_ChainContextPosFormat1_ | 567 struct HB_ChainContextPosFormat1_ |
555 { | 568 { |
556 HB_Coverage Coverage; /* Coverage table */ | 569 HB_Coverage Coverage; /* Coverage table */ |
557 HB_UShort ChainPosRuleSetCount; | 570 HB_UShort ChainPosRuleSetCount; |
558 /* number of ChainPosRuleSet tables */ | 571 /* number of ChainPosRuleSet tables */ |
559 HB_ChainPosRuleSet* ChainPosRuleSet; | 572 HB_ChainPosRuleSet* ChainPosRuleSet; |
560 /* array of ChainPosRuleSet tables */ | 573 /* array of ChainPosRuleSet tables */ |
561 }; | 574 }; |
562 | 575 |
563 typedef struct HB_ChainContextPosFormat1_ HB_ChainContextPosFormat1; | 576 typedef struct HB_ChainContextPosFormat1_ HB_ChainContextPosFormat1; |
564 | 577 |
565 | 578 |
566 struct HB_ChainPosClassRule_ | 579 struct HB_ChainPosClassRule_ |
567 { | 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 */ |
568 HB_UShort BacktrackGlyphCount; | 586 HB_UShort BacktrackGlyphCount; |
569 /* total number of backtrack | 587 /* total number of backtrack |
570 classes */ | 588 classes */ |
571 HB_UShort* Backtrack; /* array of backtrack classes */ | |
572 HB_UShort InputGlyphCount; | 589 HB_UShort InputGlyphCount; |
573 /* total number of context classes */ | 590 /* total number of context classes */ |
574 HB_UShort* Input; /* array of context classes */ | |
575 HB_UShort LookaheadGlyphCount; | 591 HB_UShort LookaheadGlyphCount; |
576 /* total number of lookahead | 592 /* total number of lookahead |
577 classes */ | 593 classes */ |
578 HB_UShort* Lookahead; /* array of lookahead classes */ | |
579 HB_UShort PosCount; /* number of PosLookupRecords */ | 594 HB_UShort PosCount; /* number of PosLookupRecords */ |
580 HB_PosLookupRecord* PosLookupRecord; | |
581 /* array of substitution lookups */ | |
582 }; | 595 }; |
583 | 596 |
584 typedef struct HB_ChainPosClassRule_ HB_ChainPosClassRule; | 597 typedef struct HB_ChainPosClassRule_ HB_ChainPosClassRule; |
585 | 598 |
586 | 599 |
587 struct HB_ChainPosClassSet_ | 600 struct HB_ChainPosClassSet_ |
588 { | 601 { |
589 HB_UShort ChainPosClassRuleCount; | 602 HB_UShort ChainPosClassRuleCount; |
590 /* number of ChainPosClassRule | 603 /* number of ChainPosClassRule |
591 tables */ | 604 tables */ |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
649 HB_UShort PosCount; /* number of PosLookupRecords */ | 662 HB_UShort PosCount; /* number of PosLookupRecords */ |
650 HB_PosLookupRecord* PosLookupRecord; | 663 HB_PosLookupRecord* PosLookupRecord; |
651 /* array of substitution lookups */ | 664 /* array of substitution lookups */ |
652 }; | 665 }; |
653 | 666 |
654 typedef struct HB_ChainContextPosFormat3_ HB_ChainContextPosFormat3; | 667 typedef struct HB_ChainContextPosFormat3_ HB_ChainContextPosFormat3; |
655 | 668 |
656 | 669 |
657 struct HB_ChainContextPos_ | 670 struct HB_ChainContextPos_ |
658 { | 671 { |
659 HB_UShort PosFormat; /* 1, 2, or 3 */ | 672 HB_Byte PosFormat; /* 1, 2, or 3 */ |
660 | 673 |
661 union | 674 union |
662 { | 675 { |
663 HB_ChainContextPosFormat1 ccpf1; | 676 HB_ChainContextPosFormat1 ccpf1; |
664 HB_ChainContextPosFormat2 ccpf2; | 677 HB_ChainContextPosFormat2 ccpf2; |
665 HB_ChainContextPosFormat3 ccpf3; | 678 HB_ChainContextPosFormat3 ccpf3; |
666 } ccpf; | 679 } ccpf; |
667 }; | 680 }; |
668 | 681 |
669 typedef struct HB_ChainContextPos_ HB_ChainContextPos; | 682 typedef struct HB_ChainContextPos_ HB_ChainContextPos; |
(...skipping 30 matching lines...) Expand all Loading... |
700 | 713 |
701 HB_INTERNAL HB_Error | 714 HB_INTERNAL HB_Error |
702 _HB_GPOS_Load_SubTable( HB_GPOS_SubTable* st, | 715 _HB_GPOS_Load_SubTable( HB_GPOS_SubTable* st, |
703 HB_Stream stream, | 716 HB_Stream stream, |
704 HB_UShort lookup_type ); | 717 HB_UShort lookup_type ); |
705 | 718 |
706 HB_INTERNAL void | 719 HB_INTERNAL void |
707 _HB_GPOS_Free_SubTable( HB_GPOS_SubTable* st, | 720 _HB_GPOS_Free_SubTable( HB_GPOS_SubTable* st, |
708 HB_UShort lookup_type ); | 721 HB_UShort lookup_type ); |
709 | 722 |
| 723 #ifdef HB_USE_PACKED_STRUCTS |
| 724 #pragma pack(pop) |
| 725 #endif |
| 726 |
710 HB_END_HEADER | 727 HB_END_HEADER |
711 | 728 |
712 #endif /* HARFBUZZ_GPOS_PRIVATE_H */ | 729 #endif /* HARFBUZZ_GPOS_PRIVATE_H */ |
OLD | NEW |