Revert "Merged all Chromoting Host code into remoting_core.dll (Windows)."
[chromium-blink-merge.git] / third_party / harfbuzz / src / harfbuzz-gpos-private.h
blob39f315998749666cf99e4e158cd95c10dc225161
1 /*
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
17 * DAMAGE.
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"
33 HB_BEGIN_HEADER
35 #ifdef HB_USE_PACKED_STRUCTS
36 #pragma pack(push, 1)
37 #endif
39 /* shared tables */
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
46 struct HB_ValueRecord_
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 */
57 HB_Device** DeviceTables; /* device tables for placement
58 and advance */
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
68 typedef struct HB_ValueRecord_ HB_ValueRecord;
71 /* Mask values to scan the value format of the ValueRecord structure.
72 We always expand compressed ValueRecords of the font. */
74 #define HB_GPOS_FORMAT_HAVE_DEVICE_TABLES 0x00F0
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
90 struct HB_AnchorFormat1_
92 HB_Short XCoordinate; /* horizontal value */
93 HB_Short YCoordinate; /* vertical value */
96 typedef struct HB_AnchorFormat1_ HB_AnchorFormat1;
99 struct HB_AnchorFormat2_
101 HB_Short XCoordinate; /* horizontal value */
102 HB_Short YCoordinate; /* vertical value */
103 HB_UShort AnchorPoint; /* index to glyph contour point */
106 typedef struct HB_AnchorFormat2_ HB_AnchorFormat2;
108 #define AF3_X_DEVICE_TABLE 0
109 #define AF3_Y_DEVICE_TABLE 1
111 struct HB_AnchorFormat3_
113 HB_Short XCoordinate; /* horizontal value */
114 HB_Short YCoordinate; /* vertical value */
115 HB_Device** DeviceTables; /* device tables for coordinates */
118 typedef struct HB_AnchorFormat3_ HB_AnchorFormat3;
121 #ifdef HB_SUPPORT_MULTIPLE_MASTER
122 struct HB_AnchorFormat4_
124 HB_UShort XIdAnchor; /* horizontal metric ID */
125 HB_UShort YIdAnchor; /* vertical metric ID */
128 typedef struct HB_AnchorFormat4_ HB_AnchorFormat4;
129 #endif
132 struct HB_Anchor_
134 HB_Byte PosFormat; /* 1, 2, 3, or 4 -- 0 indicates
135 that there is no Anchor table */
137 union
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;
148 typedef struct HB_Anchor_ HB_Anchor;
151 struct HB_MarkRecord_
153 HB_UShort Class; /* mark class */
154 HB_Anchor MarkAnchor; /* anchor table */
157 typedef struct HB_MarkRecord_ HB_MarkRecord;
160 struct HB_MarkArray_
162 HB_UShort MarkCount; /* number of MarkRecord tables */
163 HB_MarkRecord* MarkRecord; /* array of MarkRecord tables */
166 typedef struct HB_MarkArray_ HB_MarkArray;
169 /* LookupType 1 */
171 struct HB_SinglePosFormat1_
173 HB_ValueRecord Value; /* ValueRecord for all covered
174 glyphs */
177 typedef struct HB_SinglePosFormat1_ HB_SinglePosFormat1;
180 struct HB_SinglePosFormat2_
182 HB_UShort ValueCount; /* number of ValueRecord tables */
183 HB_ValueRecord* Value; /* array of ValueRecord tables */
186 typedef struct HB_SinglePosFormat2_ HB_SinglePosFormat2;
189 struct HB_SinglePos_
191 HB_Byte PosFormat; /* 1 or 2 */
192 HB_Coverage Coverage; /* Coverage table */
194 HB_UShort ValueFormat; /* format of ValueRecord table */
196 union
198 HB_SinglePosFormat1 spf1;
199 HB_SinglePosFormat2 spf2;
200 } spf;
203 typedef struct HB_SinglePos_ HB_SinglePos;
206 /* LookupType 2 */
208 struct HB_PairValueRecord_
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 */
215 typedef struct HB_PairValueRecord_ HB_PairValueRecord;
218 struct HB_PairSet_
220 HB_UShort PairValueCount;
221 /* number of PairValueRecord tables */
222 HB_PairValueRecord* PairValueRecord;
223 /* array of PairValueRecord tables */
226 typedef struct HB_PairSet_ HB_PairSet;
229 struct HB_PairPosFormat1_
231 HB_UShort PairSetCount; /* number of PairSet tables */
232 HB_PairSet* PairSet; /* array of PairSet tables */
235 typedef struct HB_PairPosFormat1_ HB_PairPosFormat1;
238 struct HB_Class2Record_
240 HB_ValueRecord Value1; /* pos. data for first glyph */
241 HB_ValueRecord Value2; /* pos. data for second glyph */
244 typedef struct HB_Class2Record_ HB_Class2Record;
247 struct HB_Class1Record_
249 HB_Class2Record* Class2Record; /* array of Class2Record tables */
252 typedef struct HB_Class1Record_ HB_Class1Record;
255 struct HB_PairPosFormat2_
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 */
266 typedef struct HB_PairPosFormat2_ HB_PairPosFormat2;
269 struct HB_PairPos_
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 */
278 union
280 HB_PairPosFormat1 ppf1;
281 HB_PairPosFormat2 ppf2;
282 } ppf;
285 typedef struct HB_PairPos_ HB_PairPos;
288 /* LookupType 3 */
290 struct HB_EntryExitRecord_
292 HB_Anchor EntryAnchor; /* entry Anchor table */
293 HB_Anchor ExitAnchor; /* exit Anchor table */
297 typedef struct HB_EntryExitRecord_ HB_EntryExitRecord;
299 struct HB_CursivePos_
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 */
309 typedef struct HB_CursivePos_ HB_CursivePos;
312 /* LookupType 4 */
314 struct HB_BaseRecord_
316 HB_Anchor* BaseAnchor; /* array of base glyph anchor
317 tables */
320 typedef struct HB_BaseRecord_ HB_BaseRecord;
323 struct HB_BaseArray_
325 HB_UShort BaseCount; /* number of BaseRecord tables */
326 HB_BaseRecord* BaseRecord; /* array of BaseRecord tables */
329 typedef struct HB_BaseArray_ HB_BaseArray;
332 struct HB_MarkBasePos_
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 */
342 typedef struct HB_MarkBasePos_ HB_MarkBasePos;
345 /* LookupType 5 */
347 struct HB_ComponentRecord_
349 HB_Anchor* LigatureAnchor; /* array of ligature glyph anchor
350 tables */
353 typedef struct HB_ComponentRecord_ HB_ComponentRecord;
356 struct HB_LigatureAttach_
358 HB_UShort ComponentCount;
359 /* number of ComponentRecord tables */
360 HB_ComponentRecord* ComponentRecord;
361 /* array of ComponentRecord tables */
364 typedef struct HB_LigatureAttach_ HB_LigatureAttach;
367 struct HB_LigatureArray_
369 HB_UShort LigatureCount; /* number of LigatureAttach tables */
370 HB_LigatureAttach* LigatureAttach;
371 /* array of LigatureAttach tables */
374 typedef struct HB_LigatureArray_ HB_LigatureArray;
377 struct HB_MarkLigPos_
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 */
388 typedef struct HB_MarkLigPos_ HB_MarkLigPos;
391 /* LookupType 6 */
393 struct HB_Mark2Record_
395 HB_Anchor* Mark2Anchor; /* array of mark glyph anchor
396 tables */
399 typedef struct HB_Mark2Record_ HB_Mark2Record;
402 struct HB_Mark2Array_
404 HB_UShort Mark2Count; /* number of Mark2Record tables */
405 HB_Mark2Record* Mark2Record; /* array of Mark2Record tables */
408 typedef struct HB_Mark2Array_ HB_Mark2Array;
411 struct HB_MarkMarkPos_
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 */
421 typedef struct HB_MarkMarkPos_ HB_MarkMarkPos;
424 /* needed by both lookup type 7 and 8 */
426 struct HB_PosLookupRecord_
428 HB_UShort SequenceIndex; /* index into current
429 glyph sequence */
430 HB_UShort LookupListIndex; /* Lookup to apply to that pos. */
433 typedef struct HB_PosLookupRecord_ HB_PosLookupRecord;
436 /* LookupType 7 */
438 struct HB_PosRule_
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 */
447 typedef struct HB_PosRule_ HB_PosRule;
450 struct HB_PosRuleSet_
452 HB_UShort PosRuleCount; /* number of PosRule tables */
453 HB_PosRule* PosRule; /* array of PosRule tables */
456 typedef struct HB_PosRuleSet_ HB_PosRuleSet;
459 struct HB_ContextPosFormat1_
461 HB_Coverage Coverage; /* Coverage table */
462 HB_UShort PosRuleSetCount; /* number of PosRuleSet tables */
463 HB_PosRuleSet* PosRuleSet; /* array of PosRuleSet tables */
466 typedef struct HB_ContextPosFormat1_ HB_ContextPosFormat1;
469 struct HB_PosClassRule_
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 */
478 typedef struct HB_PosClassRule_ HB_PosClassRule;
481 struct HB_PosClassSet_
483 HB_UShort PosClassRuleCount;
484 /* number of PosClassRule tables */
485 HB_PosClassRule* PosClassRule; /* array of PosClassRule tables */
488 typedef struct HB_PosClassSet_ HB_PosClassSet;
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. */
495 struct HB_ContextPosFormat2_
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 */
506 typedef struct HB_ContextPosFormat2_ HB_ContextPosFormat2;
509 struct HB_ContextPosFormat3_
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 */
518 typedef struct HB_ContextPosFormat3_ HB_ContextPosFormat3;
521 struct HB_ContextPos_
523 HB_Byte PosFormat; /* 1, 2, or 3 */
525 union
527 HB_ContextPosFormat1 cpf1;
528 HB_ContextPosFormat2 cpf2;
529 HB_ContextPosFormat3 cpf3;
530 } cpf;
533 typedef struct HB_ContextPos_ HB_ContextPos;
536 /* LookupType 8 */
538 struct HB_ChainPosRule_
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 */
554 typedef struct HB_ChainPosRule_ HB_ChainPosRule;
557 struct HB_ChainPosRuleSet_
559 HB_UShort ChainPosRuleCount;
560 /* number of ChainPosRule tables */
561 HB_ChainPosRule* ChainPosRule; /* array of ChainPosRule tables */
564 typedef struct HB_ChainPosRuleSet_ HB_ChainPosRuleSet;
567 struct HB_ChainContextPosFormat1_
569 HB_Coverage Coverage; /* Coverage table */
570 HB_UShort ChainPosRuleSetCount;
571 /* number of ChainPosRuleSet tables */
572 HB_ChainPosRuleSet* ChainPosRuleSet;
573 /* array of ChainPosRuleSet tables */
576 typedef struct HB_ChainContextPosFormat1_ HB_ChainContextPosFormat1;
579 struct HB_ChainPosClassRule_
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 */
597 typedef struct HB_ChainPosClassRule_ HB_ChainPosClassRule;
600 struct HB_ChainPosClassSet_
602 HB_UShort ChainPosClassRuleCount;
603 /* number of ChainPosClassRule
604 tables */
605 HB_ChainPosClassRule* ChainPosClassRule;
606 /* array of ChainPosClassRule
607 tables */
610 typedef struct HB_ChainPosClassSet_ HB_ChainPosClassSet;
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. */
617 struct HB_ChainContextPosFormat2_
619 HB_Coverage Coverage; /* Coverage table */
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 */
634 HB_UShort ChainPosClassSetCount;
635 /* number of ChainPosClassSet
636 tables */
637 HB_ChainPosClassSet* ChainPosClassSet;
638 /* array of ChainPosClassSet
639 tables */
642 typedef struct HB_ChainContextPosFormat2_ HB_ChainContextPosFormat2;
645 struct HB_ChainContextPosFormat3_
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 */
667 typedef struct HB_ChainContextPosFormat3_ HB_ChainContextPosFormat3;
670 struct HB_ChainContextPos_
672 HB_Byte PosFormat; /* 1, 2, or 3 */
674 union
676 HB_ChainContextPosFormat1 ccpf1;
677 HB_ChainContextPosFormat2 ccpf2;
678 HB_ChainContextPosFormat3 ccpf3;
679 } ccpf;
682 typedef struct HB_ChainContextPos_ HB_ChainContextPos;
685 #if 0
686 /* LookupType 10 */
687 struct HB_ExtensionPos_
689 HB_UShort PosFormat; /* always 1 */
690 HB_UShort LookuptType; /* lookup-type of referenced subtable */
691 HB_GPOS_SubTable *subtable; /* referenced subtable */
694 typedef struct HB_ExtensionPos_ HB_ExtensionPos;
695 #endif
698 union HB_GPOS_SubTable_
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;
710 typedef union HB_GPOS_SubTable_ HB_GPOS_SubTable;
714 HB_INTERNAL HB_Error
715 _HB_GPOS_Load_SubTable( HB_GPOS_SubTable* st,
716 HB_Stream stream,
717 HB_UShort lookup_type );
719 HB_INTERNAL void
720 _HB_GPOS_Free_SubTable( HB_GPOS_SubTable* st,
721 HB_UShort lookup_type );
723 #ifdef HB_USE_PACKED_STRUCTS
724 #pragma pack(pop)
725 #endif
727 HB_END_HEADER
729 #endif /* HARFBUZZ_GPOS_PRIVATE_H */