Mac OS 9
SFNTLayoutTypes.h
Go to the documentation of this file.
1 
19 #ifndef __SFNTLAYOUTTYPES__
20 #define __SFNTLAYOUTTYPES__
21 
22 #ifndef __MACTYPES__
23 #include <MacTypes.h>
24 #endif
25 
26 #if PRAGMA_ONCE
27 #pragma once
28 #endif
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 #if PRAGMA_IMPORT
35 #pragma import on
36 #endif
37 
38 #if PRAGMA_STRUCT_ALIGN
39 #pragma options align = mac68k
40 #elif PRAGMA_STRUCT_PACKPUSH
41 #pragma pack(push, 2)
42 #elif PRAGMA_STRUCT_PACK
43 #pragma pack(2)
44 #endif
45 
46 /* -----------------------------------------------------------------------------------------
47  */
48 /* CONSTANTS */
60 enum {
61  kAllTypographicFeaturesType = 0,
62  kLigaturesType = 1,
63  kCursiveConnectionType = 2,
64  kLetterCaseType = 3,
65  kVerticalSubstitutionType = 4,
66  kLinguisticRearrangementType = 5,
67  kNumberSpacingType = 6,
68  kSmartSwashType = 8,
69  kDiacriticsType = 9,
70  kVerticalPositionType = 10,
71  kFractionsType = 11,
72  kOverlappingCharactersType = 13,
73  kTypographicExtrasType = 14,
74  kMathematicalExtrasType = 15,
75  kOrnamentSetsType = 16,
76  kCharacterAlternativesType = 17,
77  kDesignComplexityType = 18,
78  kStyleOptionsType = 19,
79  kCharacterShapeType = 20,
80  kNumberCaseType = 21,
81  kTextSpacingType = 22,
82  kTransliterationType = 23,
83  kAnnotationType = 24,
84  kKanaSpacingType = 25,
85  kIdeographicSpacingType = 26,
86  kUnicodeDecompositionType = 27,
87  kRubyKanaType = 28,
88  kCJKSymbolAlternativesType = 29,
89  kIdeographicAlternativesType = 30,
90  kCJKVerticalRomanPlacementType = 31,
91  kItalicCJKRomanType = 32,
92  kCJKRomanSpacingType = 103,
93  kLastFeatureType = -1
94 };
95 
100 enum { kAllTypeFeaturesOnSelector = 0, kAllTypeFeaturesOffSelector = 1 };
101 
106 enum {
107  kRequiredLigaturesOnSelector = 0,
108  kRequiredLigaturesOffSelector = 1,
109  kCommonLigaturesOnSelector = 2,
110  kCommonLigaturesOffSelector = 3,
111  kRareLigaturesOnSelector = 4,
112  kRareLigaturesOffSelector = 5,
113  kLogosOnSelector = 6,
114  kLogosOffSelector = 7,
115  kRebusPicturesOnSelector = 8,
116  kRebusPicturesOffSelector = 9,
117  kDiphthongLigaturesOnSelector = 10,
118  kDiphthongLigaturesOffSelector = 11,
119  kSquaredLigaturesOnSelector = 12,
120  kSquaredLigaturesOffSelector = 13,
121  kAbbrevSquaredLigaturesOnSelector = 14,
122  kAbbrevSquaredLigaturesOffSelector = 15,
123  kSymbolLigaturesOnSelector = 16,
124  kSymbolLigaturesOffSelector = 17
125 };
126 
131 enum {
132  kUnconnectedSelector = 0,
133  kPartiallyConnectedSelector = 1,
134  kCursiveSelector = 2
135 };
136 
141 enum {
142  kUpperAndLowerCaseSelector = 0,
143  kAllCapsSelector = 1,
144  kAllLowerCaseSelector = 2,
145  kSmallCapsSelector = 3,
146  kInitialCapsSelector = 4,
147  kInitialCapsAndSmallCapsSelector = 5
148 };
149 
154 enum {
155  kSubstituteVerticalFormsOnSelector = 0,
156  kSubstituteVerticalFormsOffSelector = 1
157 };
158 
163 enum {
164  kLinguisticRearrangementOnSelector = 0,
165  kLinguisticRearrangementOffSelector = 1
166 };
167 
172 enum {
173  kMonospacedNumbersSelector = 0,
174  kProportionalNumbersSelector = 1,
175  kThirdWidthNumbersSelector = 2,
176  kQuarterWidthNumbersSelector = 3
177 };
178 
183 enum {
184  kWordInitialSwashesOnSelector = 0,
185  kWordInitialSwashesOffSelector = 1,
186  kWordFinalSwashesOnSelector = 2,
187  kWordFinalSwashesOffSelector = 3,
188  kLineInitialSwashesOnSelector = 4,
189  kLineInitialSwashesOffSelector = 5,
190  kLineFinalSwashesOnSelector = 6,
191  kLineFinalSwashesOffSelector = 7,
192  kNonFinalSwashesOnSelector = 8,
193  kNonFinalSwashesOffSelector = 9
194 };
195 
200 enum {
201  kShowDiacriticsSelector = 0,
202  kHideDiacriticsSelector = 1,
203  kDecomposeDiacriticsSelector = 2
204 };
205 
210 enum {
211  kNormalPositionSelector = 0,
212  kSuperiorsSelector = 1,
213  kInferiorsSelector = 2,
214  kOrdinalsSelector = 3
215 };
216 
221 enum {
222  kNoFractionsSelector = 0,
223  kVerticalFractionsSelector = 1,
224  kDiagonalFractionsSelector = 2
225 };
226 
231 enum { kPreventOverlapOnSelector = 0, kPreventOverlapOffSelector = 1 };
232 
237 enum {
238  kHyphensToEmDashOnSelector = 0,
239  kHyphensToEmDashOffSelector = 1,
240  kHyphenToEnDashOnSelector = 2,
241  kHyphenToEnDashOffSelector = 3,
242  kSlashedZeroOnSelector = 4,
243  kSlashedZeroOffSelector = 5,
244  kFormInterrobangOnSelector = 6,
245  kFormInterrobangOffSelector = 7,
246  kSmartQuotesOnSelector = 8,
247  kSmartQuotesOffSelector = 9,
248  kPeriodsToEllipsisOnSelector = 10,
249  kPeriodsToEllipsisOffSelector = 11
250 };
251 
256 enum {
257  kHyphenToMinusOnSelector = 0,
258  kHyphenToMinusOffSelector = 1,
259  kAsteriskToMultiplyOnSelector = 2,
260  kAsteriskToMultiplyOffSelector = 3,
261  kSlashToDivideOnSelector = 4,
262  kSlashToDivideOffSelector = 5,
263  kInequalityLigaturesOnSelector = 6,
264  kInequalityLigaturesOffSelector = 7,
265  kExponentsOnSelector = 8,
266  kExponentsOffSelector = 9
267 };
268 
273 enum {
274  kNoOrnamentsSelector = 0,
275  kDingbatsSelector = 1,
276  kPiCharactersSelector = 2,
277  kFleuronsSelector = 3,
278  kDecorativeBordersSelector = 4,
279  kInternationalSymbolsSelector = 5,
280  kMathSymbolsSelector = 6
281 };
282 
287 enum { kNoAlternatesSelector = 0 };
288 
293 enum {
294  kDesignLevel1Selector = 0,
295  kDesignLevel2Selector = 1,
296  kDesignLevel3Selector = 2,
297  kDesignLevel4Selector = 3,
298  kDesignLevel5Selector = 4
299 };
300 
305 enum {
306  kNoStyleOptionsSelector = 0,
307  kDisplayTextSelector = 1,
308  kEngravedTextSelector = 2,
309  kIlluminatedCapsSelector = 3,
310  kTitlingCapsSelector = 4,
311  kTallCapsSelector = 5
312 };
313 
318 enum {
319  kTraditionalCharactersSelector = 0,
320  kSimplifiedCharactersSelector = 1,
321  kJIS1978CharactersSelector = 2,
322  kJIS1983CharactersSelector = 3,
323  kJIS1990CharactersSelector = 4,
324  kTraditionalAltOneSelector = 5,
325  kTraditionalAltTwoSelector = 6,
326  kTraditionalAltThreeSelector = 7,
327  kTraditionalAltFourSelector = 8,
328  kTraditionalAltFiveSelector = 9,
329  kExpertCharactersSelector = 10
330 };
331 
336 enum { kLowerCaseNumbersSelector = 0, kUpperCaseNumbersSelector = 1 };
337 
342 enum {
343  kProportionalTextSelector = 0,
344  kMonospacedTextSelector = 1,
345  kHalfWidthTextSelector = 2,
346  kNormallySpacedTextSelector = 3
347 };
348 
353 enum {
354  kNoTransliterationSelector = 0,
355  kHanjaToHangulSelector = 1,
356  kHiraganaToKatakanaSelector = 2,
357  kKatakanaToHiraganaSelector = 3,
358  kKanaToRomanizationSelector = 4,
359  kRomanizationToHiraganaSelector = 5,
360  kRomanizationToKatakanaSelector = 6,
361  kHanjaToHangulAltOneSelector = 7,
362  kHanjaToHangulAltTwoSelector = 8,
363  kHanjaToHangulAltThreeSelector = 9
364 };
365 
370 enum {
371  kNoAnnotationSelector = 0,
372  kBoxAnnotationSelector = 1,
373  kRoundedBoxAnnotationSelector = 2,
374  kCircleAnnotationSelector = 3,
375  kInvertedCircleAnnotationSelector = 4,
376  kParenthesisAnnotationSelector = 5,
377  kPeriodAnnotationSelector = 6,
378  kRomanNumeralAnnotationSelector = 7,
379  kDiamondAnnotationSelector = 8,
380  kInvertedBoxAnnotationSelector = 9,
381  kInvertedRoundedBoxAnnotationSelector = 10
382 };
383 
388 enum { kFullWidthKanaSelector = 0, kProportionalKanaSelector = 1 };
389 
394 enum {
395  kFullWidthIdeographsSelector = 0,
396  kProportionalIdeographsSelector = 1,
397  kHalfWidthIdeographsSelector = 2
398 };
399 
404 enum {
405  kCanonicalCompositionOnSelector = 0,
406  kCanonicalCompositionOffSelector = 1,
407  kCompatibilityCompositionOnSelector = 2,
408  kCompatibilityCompositionOffSelector = 3,
409  kTranscodingCompositionOnSelector = 4,
410  kTranscodingCompositionOffSelector = 5
411 };
412 
417 enum { kNoRubyKanaSelector = 0, kRubyKanaSelector = 1 };
418 
423 enum {
424  kNoCJKSymbolAlternativesSelector = 0,
425  kCJKSymbolAltOneSelector = 1,
426  kCJKSymbolAltTwoSelector = 2,
427  kCJKSymbolAltThreeSelector = 3,
428  kCJKSymbolAltFourSelector = 4,
429  kCJKSymbolAltFiveSelector = 5
430 };
431 
436 enum {
437  kNoIdeographicAlternativesSelector = 0,
438  kIdeographicAltOneSelector = 1,
439  kIdeographicAltTwoSelector = 2,
440  kIdeographicAltThreeSelector = 3,
441  kIdeographicAltFourSelector = 4,
442  kIdeographicAltFiveSelector = 5
443 };
444 
449 enum {
450  kCJKVerticalRomanCenteredSelector = 0,
451  kCJKVerticalRomanHBaselineSelector = 1
452 };
453 
458 enum { kNoCJKItalicRomanSelector = 0, kCJKItalicRomanSelector = 1 };
459 
464 enum {
465  kHalfWidthCJKRomanSelector = 0,
466  kProportionalCJKRomanSelector = 1,
467  kDefaultCJKRomanSelector = 2,
468  kFullWidthCJKRomanSelector = 3
469 };
470 
471 /* ---------------------------------------------------------------------------
472  */
473 /* ---------------- Table Specific Typedefs and Constants --------------------
474  */
475 /* ---------------------------------------------------------------------------
476  */
477 /* FORMATS FOR TABLE: lookup tables - used within various other tables */
478 enum {
479  kSFNTLookupSimpleArray = 0, /* a simple array indexed by glyph code */
480  kSFNTLookupSegmentSingle = 2, /* segment mapping to single value */
481  kSFNTLookupSegmentArray = 4, /* segment mapping to lookup array */
482  kSFNTLookupSingleTable = 6, /* sorted list of glyph, value pairs */
483  kSFNTLookupTrimmedArray = 8 /* a simple trimmed array indexed by glyph code */
484 };
485 
486 typedef UInt16 SFNTLookupTableFormat;
487 typedef UInt16 SFNTLookupValue;
488 typedef UInt16 SFNTLookupOffset;
489 typedef UInt32 SFNTLookupKind;
497  UInt16 unitSize; /* size of a unit in bytes */
498  UInt16 nUnits; /* number of units in table */
499  UInt16 searchRange; /* (largest power of two <= nUnits) * unitSize */
500  UInt16 entrySelector; /* log2 (largest power of two <= nUnits) */
501  UInt16 rangeShift; /* (nUnits - largest power of two <= nUnits) * unitSize */
502 };
504 /* A format 0 lookup table maps all glyphs in the font to lookup values */
506  SFNTLookupValue lookupValues[1];
507 };
509 /* A format 8 lookup table maps some range of glyphs in the font to lookup
510  * values */
512  UInt16 firstGlyph;
513  UInt16 count;
514  SFNTLookupValue valueArray[1];
515 };
524  UInt16 lastGlyph;
525  UInt16 firstGlyph;
526  UInt16 value[1];
527 };
528 typedef struct SFNTLookupSegment SFNTLookupSegment;
531  SFNTLookupSegment segments[1];
532 };
534 /* A format 6 lookup table maps single glyphs to lookup values. */
536  UInt16 glyph;
537  UInt16 value[1];
538 };
539 typedef struct SFNTLookupSingle SFNTLookupSingle;
542  SFNTLookupSingle entries[1];
543 };
545 /* The format-specific part of the subtable header */
547  SFNTLookupArrayHeader theArray;
548  SFNTLookupSegmentHeader segment;
549  SFNTLookupSingleHeader single;
550  SFNTLookupTrimmedArrayHeader trimmedArray;
551 };
553 /* The overall subtable header */
555  SFNTLookupTableFormat format; /* table format */
556  SFNTLookupFormatSpecificHeader fsHeader; /* format specific header */
557 };
558 typedef struct SFNTLookupTable SFNTLookupTable;
561 /* ---------------------------------------------------------------------------
562  */
563 /* GENERAL FORMATS FOR STATE TABLES -- prefix "ST" */
564 enum {
565  kSTClassEndOfText = 0,
566  kSTClassOutOfBounds = 1,
567  kSTClassDeletedGlyph = 2,
568  kSTClassEndOfLine = 3,
569  kSTSetMark = 0x8000,
570  kSTNoAdvance = 0x4000,
571  kSTMarkEnd = 0x2000,
572  kSTLigActionMask = 0x3FFF,
573  kSTRearrVerbMask = 0x000F
574 };
575 
576 typedef UInt8 STClass;
577 typedef UInt8 STEntryIndex;
578 struct STHeader {
579  UInt8 filler;
580  STClass nClasses;
581  UInt16 classTableOffset;
582  UInt16 stateArrayOffset;
583  UInt16 entryTableOffset;
584 };
585 typedef struct STHeader STHeader;
586 struct STClassTable {
587  UInt16 firstGlyph;
588  UInt16 nGlyphs;
589  STClass classes[1];
590 };
591 typedef struct STClassTable STClassTable;
592 struct STEntryZero {
593  UInt16 newState;
594  UInt16 flags;
595 };
596 typedef struct STEntryZero STEntryZero;
597 struct STEntryOne {
598  UInt16 newState;
599  UInt16 flags;
600  UInt16 offset1;
601 };
602 typedef struct STEntryOne STEntryOne;
603 struct STEntryTwo {
604  UInt16 newState;
605  UInt16 flags;
606  UInt16 offset1;
607  UInt16 offset2;
608 };
609 typedef struct STEntryTwo STEntryTwo;
610 /* ---------------------------------------------------------------------------
611  */
612 /* GENERAL FORMATS FOR STATE TABLES to be used with 'morx' tables -- prefix
613  * "STX" */
614 enum { kSTXHasLigAction = 0x2000 };
615 
616 typedef UInt16 STXClass;
617 typedef UInt16 STXStateIndex;
618 typedef UInt16 STXEntryIndex;
619 struct STXHeader {
620  UInt32 nClasses;
621  UInt32 classTableOffset;
622  UInt32 stateArrayOffset;
623  UInt32 entryTableOffset;
624 };
625 typedef struct STXHeader STXHeader;
626 
628 struct STXEntryZero {
629  STXStateIndex newState;
630  UInt16 flags;
631 };
632 typedef struct STXEntryZero STXEntryZero;
633 struct STXEntryOne {
634  STXStateIndex newState;
635  UInt16 flags;
636  UInt16 index1;
637 };
638 typedef struct STXEntryOne STXEntryOne;
639 struct STXEntryTwo {
640  STXStateIndex newState;
641  UInt16 flags;
642  UInt16 index1;
643  UInt16 index2;
644 };
645 typedef struct STXEntryTwo STXEntryTwo;
646 /* ---------------------------------------------------------------------------
647  */
648 /* FORMATS FOR TABLE: 'lcar' */
649 /* CONSTANTS */
650 enum {
651  kLCARTag = 0x6C636172, /* 'lcar' */
652  kLCARCurrentVersion =
653  0x00010000, /* current version number for 'lcar' table */
654  kLCARLinearFormat = 0,
655  kLCARCtlPointFormat = 1
656 };
657 
658 /* TYPES */
660  UInt16 count;
661  UInt16 partials[1]; /* these are either FUnits or control-point numbers */
662 };
665  Fixed version;
666  UInt16 format;
667  SFNTLookupTable lookup;
668 };
669 typedef struct LcarCaretTable LcarCaretTable;
671 /* ---------------------------------------------------------------------------
672  */
673 /* FORMATS FOR TABLE: 'just' */
674 /* CONSTANTS */
675 enum {
676  kJUSTTag = 0x6A757374, /* 'just' */
677  kJUSTCurrentVersion = 0x00010000,
678  kJUSTStandardFormat = 0,
679  kJUSTnoGlyphcode = 0xFFFF, /* used in a pcConditionalAddAction */
680  kJUSTpcDecompositionAction = 0,
681  kJUSTpcUnconditionalAddAction = 1,
682  kJUSTpcConditionalAddAction = 2,
683  kJUSTpcGlyphStretchAction = 3,
684  kJUSTpcDuctilityAction = 4,
685  kJUSTpcGlyphRepeatAddAction = 5
686 };
687 
688 /* Justification priority levels */
689 enum {
690  kJUSTKashidaPriority = 0,
691  kJUSTSpacePriority = 1,
692  kJUSTLetterPriority = 2,
693  kJUSTNullPriority = 3,
694  kJUSTPriorityCount = 4
695 };
696 
697 /* Justification flags */
698 enum {
699  kJUSTOverridePriority = 0x8000,
700  kJUSTOverrideLimits = 0x4000,
701  kJUSTOverrideUnlimited = 0x2000,
702  kJUSTUnlimited = 0x1000,
703  kJUSTPriorityMask = 0x0003
704 };
705 
706 /* TYPES */
707 typedef UInt16 JustPCActionType;
708 typedef UInt16 JustificationFlags;
709 /* A JustPCDecompositionAction defines a ligature decomposition action. */
711  Fixed lowerLimit;
712  Fixed upperLimit;
713  UInt16 order;
714  UInt16 count;
715  UInt16 glyphs[1];
716 };
718 /* A JUSTPCUnconditionalAddAction defines an unconditional glyph add action. */
719 
720 typedef UInt16 JustPCUnconditionalAddAction;
727  Fixed substThreshhold; /* threshhold of growth factor at which subst occurs */
728  UInt16 addGlyph;
729  UInt16 substGlyph;
730 };
732 /* A PCDuctilityAction defines a ductile axis along which the glyph will be
733  * varied. */
735  UInt32 ductilityAxis;
736  Fixed minimumLimit;
737  Fixed noStretchValue;
738  Fixed maximumLimit;
739 };
747  UInt16 flags;
748  UInt16 glyph;
749 };
751 /* PCActionSubrecords contain the actual postcompensation actions. */
753  UInt16 theClass; /* justification class value associated with this rec */
754  JustPCActionType theType;
755  UInt32 length;
756  UInt32 data; /* not really a UInt32; cast as ptr to appropriate action */
757 };
759 /* The set of postcompensation records is defined in a PCAction struct. */
760 struct JustPCAction {
761  UInt32 actionCount; /* long for alignment purposes */
762  JustPCActionSubrecord actions[1];
763 };
764 typedef struct JustPCAction JustPCAction;
771  UInt32 justClass;
772  Fixed beforeGrowLimit; /* ems AW can grow by at most on LT */
773  Fixed beforeShrinkLimit; /* ems AW can shrink by at most on LT */
774  Fixed afterGrowLimit; /* ems AW can grow by at most on RB */
775  Fixed afterShrinkLimit; /* ems AW can shrink by at most on RB */
776  JustificationFlags growFlags; /* flags controlling grow case */
777  JustificationFlags shrinkFlags; /* flags controlling shrink case */
778 };
781  UInt32 count;
782  JustWidthDeltaEntry entries[1];
783 };
785 /* Overall structure of a postcompensation table is defined in PostcompTable. */
787  SFNTLookupTable lookupTable;
788  /* action records here */
789 };
790 typedef struct JustPostcompTable JustPostcompTable;
792  UInt16 justClass; /* offset to state table (0=none) */
793  UInt16 widthDeltaClusters; /* offset to clusters */
794  UInt16 postcomp; /* offset to postcomp table (0=none) */
795  SFNTLookupTable lookup;
796 };
798 struct JustTable {
799  Fixed version;
800  UInt16 format;
801  UInt16 horizHeaderOffset;
802  UInt16 vertHeaderOffset;
803 };
804 typedef struct JustTable JustTable;
805 /* ---------------------------------------------------------------------------
806  */
807 /* FORMATS FOR TABLE: 'opbd' */
808 /* CONSTANTS */
809 enum {
810  kOPBDTag = 0x6F706264, /* 'opbd' */
811  kOPBDCurrentVersion = 0x00010000,
812  kOPBDDistanceFormat = 0,
813  kOPBDControlPointFormat = 1
814 };
815 
816 /* TYPES */
817 
818 typedef UInt16 OpbdTableFormat;
825  SInt16 leftSideShift;
826  SInt16 topSideShift;
827  SInt16 rightSideShift;
828  SInt16 bottomSideShift;
829 };
830 typedef struct OpbdSideValues OpbdSideValues;
831 struct OpbdTable {
832  Fixed version;
833  OpbdTableFormat format;
834  SFNTLookupTable lookupTable;
835 };
836 typedef struct OpbdTable OpbdTable;
837 /* ---------------------------------------------------------------------------
838  */
839 /* FORMATS FOR TABLE: 'mort' */
840 /* CONSTANTS */
841 enum {
842  kMORTTag = 0x6D6F7274, /* 'mort' */
843  kMORTCurrentVersion =
844  0x00010000, /* current version number for 'mort' table */
845  /* Coverage masks */
846  kMORTCoverVertical = 0x8000,
847  kMORTCoverDescending = 0x4000,
848  kMORTCoverIgnoreVertical = 0x2000,
849  kMORTCoverTypeMask = 0x000F, /* Subtable types */
850  kMORTRearrangementType = 0,
851  kMORTContextualType = 1,
852  kMORTLigatureType = 2,
853  kMORTSwashType = 4,
854  kMORTInsertionType = 5, /* Ligature subtable constants */
855  kMORTLigLastAction = (long)0x80000000,
856  kMORTLigStoreLigature = 0x40000000,
857  kMORTLigFormOffsetMask = 0x3FFFFFFF,
858  kMORTLigFormOffsetShift = 2, /* Rearrangement subtable actions */
859  kMORTraNoAction = 0, /* no action */
860  kMORTraxA = 1, /* Ax => xA */
861  kMORTraDx = 2, /* xD => Dx */
862  kMORTraDxA = 3, /* AxD => DxA */
863  kMORTraxAB = 4, /* ABx => xAB */
864  kMORTraxBA = 5, /* ABx => xBA */
865  kMORTraCDx = 6, /* xCD => CDx */
866  kMORTraDCx = 7, /* xCD => DCx */
867  kMORTraCDxA = 8, /* AxCD => CDxA */
868  kMORTraDCxA = 9, /* AxCD => DCxA */
869  kMORTraDxAB = 10, /* ABxD => DxAB */
870  kMORTraDxBA = 11, /* ABxD => DxBA */
871  kMORTraCDxAB = 12, /* ABxCD => CDxAB */
872  kMORTraCDxBA = 13, /* ABxCD => CDxBA */
873  kMORTraDCxAB = 14, /* ABxCD => DCxAB */
874  kMORTraDCxBA = 15, /* ABxCD => DCxBA */
875  /* Insertion subtable constants */
876  kMORTDoInsertionsBefore = 0x80,
877  kMORTIsSplitVowelPiece = 0x40,
878  kMORTInsertionsCountMask = 0x3F,
879  kMORTCurrInsertKashidaLike = 0x2000,
880  kMORTMarkInsertKashidaLike = 0x1000,
881  kMORTCurrInsertBefore = 0x0800,
882  kMORTMarkInsertBefore = 0x0400,
883  kMORTMarkJustTableCountMask = 0x3F80,
884  kMORTMarkJustTableCountShift = 7, /* JustTableIndex for marked character */
885  kMORTCurrJustTableCountMask = 0x007F,
886  kMORTCurrJustTableCountShift = 0, /* JustTableIndex for current character */
887  kMORTCurrInsertCountMask = 0x03E0,
888  kMORTCurrInsertCountShift = 5, /* count to insert after current glyphRec */
889  kMORTMarkInsertCountMask = 0x001F,
890  kMORTMarkInsertCountShift = 0 /* count to insert after marked glyphRec */
891 };
892 
893 /* TYPES */
894 
895 typedef UInt32 MortSubtableMaskFlags;
896 typedef UInt32 MortLigatureActionEntry;
899 };
903  UInt16 substitutionTableOffset;
904 };
908  UInt16 ligatureActionTableOffset;
909  UInt16 componentTableOffset;
910  UInt16 ligatureTableOffset;
911 };
914  SFNTLookupTable lookup;
915 };
916 typedef struct MortSwashSubtable MortSwashSubtable;
919 };
922  MortRearrangementSubtable rearrangement;
923  MortContextualSubtable contextual;
924  MortLigatureSubtable ligature;
925  MortSwashSubtable swash;
926  MortInsertionSubtable insertion;
927 };
929 struct MortSubtable {
930  UInt16 length;
931  UInt16 coverage;
932  MortSubtableMaskFlags flags;
934 };
935 typedef struct MortSubtable MortSubtable;
937  UInt16 featureType;
938  UInt16 featureSelector;
939  MortSubtableMaskFlags enableFlags;
940  MortSubtableMaskFlags disableFlags;
941 };
942 typedef struct MortFeatureEntry MortFeatureEntry;
943 struct MortChain {
944  MortSubtableMaskFlags defaultFlags; /* default flags for this chain */
945  UInt32 length; /* byte length of this chain */
946  UInt16 nFeatures; /* number of feature entries */
947  UInt16 nSubtables; /* number of subtables */
948  MortFeatureEntry featureEntries[1];
949  /* the subtables follow */
950 };
951 typedef struct MortChain MortChain;
952 struct MortTable {
953  Fixed version;
954  UInt32 nChains;
955  MortChain chains[1];
956 };
957 typedef struct MortTable MortTable;
958 /* ---------------------------------------------------------------------------
959  */
960 /* FORMATS FOR TABLE: 'morx' (version 2 and beyond metamorphosis tables) */
961 /* CONSTANTS */
962 enum {
963  kMORXTag = 0x6D6F7278, /* 'morx' */
964  kMORXCurrentVersion =
965  0x00020000, /* version number for current 'morx' table */
966  /* Coverage masks */
967  kMORXCoverVertical = (long)0x80000000,
968  kMORXCoverDescending = 0x40000000,
969  kMORXCoverIgnoreVertical = 0x20000000,
970  kMORXCoverTypeMask = 0x000000FF
971 };
972 
973 /* TYPES */
976 };
980  UInt32 substitutionTableOffset;
981 };
985  UInt32 ligatureActionTableOffset;
986  UInt32 componentTableOffset;
987  UInt32 ligatureTableOffset;
988 };
992  UInt32 insertionGlyphTableOffset;
993 };
996  MorxRearrangementSubtable rearrangement;
997  MorxContextualSubtable contextual;
998  MorxLigatureSubtable ligature;
999  MortSwashSubtable swash;
1000  MorxInsertionSubtable insertion;
1001 };
1004  UInt32 length;
1005  UInt32 coverage;
1006  MortSubtableMaskFlags flags;
1008 };
1009 typedef struct MorxSubtable MorxSubtable;
1010 struct MorxChain {
1011  MortSubtableMaskFlags defaultFlags; /* default flags for this chain */
1012  UInt32 length; /* byte length of this chain */
1013  UInt32 nFeatures; /* number of feature entries */
1014  UInt32 nSubtables; /* number of subtables */
1015  MortFeatureEntry featureEntries[1];
1016  /* the subtables follow */
1017 };
1018 typedef struct MorxChain MorxChain;
1019 struct MorxTable {
1020  Fixed version;
1021  UInt32 nChains;
1022  MorxChain chains[1];
1023 };
1024 typedef struct MorxTable MorxTable;
1025 /* ---------------------------------------------------------------------------
1026  */
1027 /* FORMATS FOR TABLE: 'prop' */
1028 /* CONSTANTS */
1029 enum {
1030  kPROPTag = 0x70726F70, /* 'prop' */
1031  kPROPCurrentVersion =
1032  0x00020000, /* current version number for 'prop' table */
1033  kPROPPairOffsetShift = 8,
1034  kPROPPairOffsetSign = 7,
1035  kPROPIsFloaterMask = 0x8000, /* glyph is floater */
1036  kPROPCanHangLTMask = 0x4000, /* glyph can hang left/top */
1037  kPROPCanHangRBMask = 0x2000, /* glyph can hang right/bottom */
1038  kPROPUseRLPairMask =
1039  0x1000, /* if glyph lands in RL streak, use paired glyph */
1040  kPROPPairOffsetMask = 0x0F00, /* 4-bit signed offset to other pair member */
1041  kPROPRightConnectMask = 0x0080, /* glyph connects to glyph on right */
1042  kPROPZeroReserved = 0x0060, /* must be zero */
1043  kPROPDirectionMask = 0x001F /* direction bits */
1044 };
1045 
1046 /* These are the Unicode direction classes (plus the Special European Number
1047  * class). */
1048 enum {
1049  kPROPLDirectionClass = 0, /* Left-to-Right */
1050  kPROPRDirectionClass = 1, /* Right-to-Left */
1051  kPROPALDirectionClass = 2, /* Right-to-Left Arabic Letter */
1052  kPROPENDirectionClass = 3, /* European Number */
1053  kPROPESDirectionClass = 4, /* European Number Seperator */
1054  kPROPETDirectionClass = 5, /* European Number Terminator */
1055  kPROPANDirectionClass = 6, /* Arabic Number */
1056  kPROPCSDirectionClass = 7, /* Common Number Seperator */
1057  kPROPPSDirectionClass =
1058  8, /* Paragraph Seperator (also referred to as Block Separator) */
1059  kPROPSDirectionClass = 9, /* Segment Seperator */
1060  kPROPWSDirectionClass = 10, /* Whitespace */
1061  kPROPONDirectionClass = 11, /* Other Neutral */
1062  kPROPSENDirectionClass =
1063  12, /* Special European Number (not a Unicode class) */
1064  kPROPLREDirectionClass = 13, /* Left-to-Right Embeding */
1065  kPROPLRODirectionClass = 14, /* Left-to-Right Override */
1066  kPROPRLEDirectionClass = 15, /* Right-to-Left Embeding */
1067  kPROPRLODirectionClass = 16, /* Right-to-Left Override */
1068  kPROPPDFDirectionClass = 17, /* Pop Directional Format */
1069  kPROPNSMDirectionClass = 18, /* Non-Spacing Mark */
1070  kPROPBNDirectionClass = 19, /* Boundary Neutral */
1071  kPROPNumDirectionClasses =
1072  20 /* Number of Unicode directional types + Special European Number */
1073 };
1074 
1075 /* TYPES */
1076 
1077 typedef UInt16 PropCharProperties;
1078 struct PropTable {
1079  Fixed version;
1080  UInt16 format;
1081  PropCharProperties defaultProps;
1082  SFNTLookupTable lookup;
1083 };
1084 typedef struct PropTable PropTable;
1086  UInt16 lastGlyph;
1087  UInt16 firstGlyph;
1088  UInt16 value;
1089 };
1090 typedef struct PropLookupSegment PropLookupSegment;
1092  UInt16 glyph;
1093  PropCharProperties props;
1094 };
1095 typedef struct PropLookupSingle PropLookupSingle;
1096 /* ---------------------------------------------------------------------------
1097  */
1098 /* FORMATS FOR TABLE: 'trak' */
1099 /* CONSTANTS */
1100 enum {
1101  kTRAKTag = 0x7472616B, /* 'trak' */
1102  kTRAKCurrentVersion =
1103  0x00010000, /* current version number for 'trak' table */
1104  kTRAKUniformFormat = 0 /* kTRAKPerGlyphFormat = 2*/
1105 };
1106 
1107 /* TYPES */
1108 
1109 typedef SInt16 TrakValue;
1111  Fixed track;
1112  UInt16 nameTableIndex;
1113  UInt16 sizesOffset; /* offset to array of TrackingValues */
1114 };
1115 typedef struct TrakTableEntry TrakTableEntry;
1117  UInt16 nTracks;
1118  UInt16 nSizes;
1119  UInt32 sizeTableOffset;
1120  TrakTableEntry trakTable[1];
1121 };
1122 typedef struct TrakTableData TrakTableData;
1123 struct TrakTable {
1124  Fixed version;
1125  UInt16 format;
1126  UInt16 horizOffset;
1127  UInt16 vertOffset;
1128 };
1129 typedef struct TrakTable TrakTable;
1130 /* ---------------------------------------------------------------------------
1131  */
1132 /* FORMATS FOR TABLE: 'kern' */
1133 /* CONSTANTS */
1134 enum {
1135  kKERNTag = 0x6B65726E, /* 'kern' */
1136  kKERNCurrentVersion = 0x00010000,
1137  kKERNVertical =
1138  0x8000, /* set if this table has vertical kerning information */
1139  kKERNResetCrossStream =
1140  0x8000, /* this value in a cross-stream table means reset to zero */
1141  kKERNCrossStream =
1142  0x4000, /* set if this table contains cross-stream kerning values */
1143  kKERNVariation =
1144  0x2000, /* set if this table contains variation kerning values */
1145  kKERNUnusedBits = 0x1F00, /* UNUSED, MUST BE ZERO */
1146  kKERNFormatMask = 0x00FF /* format of this subtable */
1147 };
1148 
1149 enum {
1150  kKERNOrderedList = 0, /* ordered list of kerning pairs */
1151  kKERNStateTable = 1, /* state table for n-way contextual kerning */
1152  kKERNSimpleArray = 2, /* simple n X m array of kerning values */
1153  kKERNIndexArray = 3 /* modifed version of SimpleArray */
1154 };
1155 
1156 /* Message Type Flags */
1157 enum {
1158  kKERNLineStart = 0x00000001, /* Array of glyphs starts a line */
1159  kKERNLineEndKerning = 0x00000002, /* Array of glyphs ends a line */
1160  kKERNNoCrossKerning = 0x00000004, /* Prohibit cross kerning */
1161  kKERNNotesRequested = 0x00000008, /* Caller wants kerning notes */
1162  kKERNNoStakeNote =
1163  1, /* Indicates a glyph was involved in a kerning pair/group */
1164  kKERNCrossStreamResetNote =
1165  2, /* Indicates a return-to-baseline in cross-stream kerning */
1166  kKERNNotApplied =
1167  0x00000001 /* All kerning values were zero, kerning call had no effect */
1168 };
1169 
1170 /* TYPES */
1171 
1172 typedef UInt8 KernTableFormat;
1173 typedef UInt16 KernSubtableInfo;
1174 typedef SInt16 KernKerningValue;
1175 typedef UInt16 KernArrayOffset;
1176 /* header for version 0 kerning table */
1178  UInt16 version; /* font version number (will be 0!) */
1179  UInt16 nTables; /* number of subtables present */
1180  UInt16 firstSubtable[1]; /* first subtable starts here */
1181 };
1182 typedef struct KernVersion0Header KernVersion0Header;
1183 /* Header for a kerning table */
1185  Fixed version; /* font version number (currently 1.0) */
1186  SInt32 nTables; /* number of subtables present */
1187  UInt16 firstSubtable[1]; /* first subtable starts here */
1188 };
1189 typedef struct KernTableHeader KernTableHeader;
1201 /* defines a single kerning pair of Glyphcodes */
1203  UInt16 left;
1204  UInt16 right;
1205 };
1206 typedef struct KernKerningPair KernKerningPair;
1207 /* a single list entry */
1209  KernKerningPair pair; /* the kerning pair */
1210  KernKerningValue value; /* the kerning value for the above pair */
1211 };
1214 /* the header information for binary searching the list */
1216  UInt16 nPairs; /* number of kerning pairs in table */
1217  UInt16 searchRange; /* (largest power of two <= nPairs) * entry size */
1218  UInt16 entrySelector; /* log2 (largest power of two <= nPairs) */
1219  UInt16
1220  rangeShift; /* (nPairs - largest power of two <= nPairs) * entry size */
1221  UInt16 table[1]; /* entries are first glyph, second glyph, and value */
1222 };
1224 /* KernStateTable: like the the generic state tables */
1226  STHeader header; /* state table header */
1227  UInt16 valueTable; /* offset to kerning value table */
1228  UInt8 firstTable[1]; /* first table starts here */
1229 };
1230 typedef struct KernStateHeader KernStateHeader;
1232  UInt16 newState;
1233  UInt16 flags; /* flags per above enum */
1234 };
1235 typedef struct KernStateEntry KernStateEntry;
1243  UInt16 firstGlyph; /* first glyph in class range */
1244  UInt16 nGlyphs; /* number of glyphs in class range */
1245  KernArrayOffset offsetTable[1]; /* offset table starts here */
1246 };
1247 typedef struct KernOffsetTable KernOffsetTable;
1249 /* Header information for accessing offset tables and kerning array */
1263 /* Kern offset table header. */
1264 /* The offset table is a trimmed array from firstGlyph to limitGlyph. */
1265 /* Glyphs outside of this range should get zero for right-hand glyphs */
1266 /* and the offset of the beginning of the kerning array for left- */
1267 /* hand glyphs. */
1269  UInt16 rowWidth; /* width, in bytes, of a row in the table */
1270  UInt16 leftOffsetTable; /* offset to left-hand offset table */
1271  UInt16 rightOffsetTable; /* offset to right-hand offset table */
1272  KernArrayOffset theArray; /* offset to start of kerning array */
1273  UInt16 firstTable[1]; /* first offset table starts here... */
1274 };
1276 /* Index Array */
1278  UInt16 glyphCount;
1279  UInt8 kernValueCount;
1280  UInt8 leftClassCount;
1281  UInt8 rightClassCount;
1282  UInt8 flags; /* set to 0 for now */
1283  SInt16
1284  kernValue[1]; /* actual kerning values reference by index in kernIndex */
1285  UInt8 leftClass[1]; /* maps left glyph to offset into kern index */
1286  UInt8 rightClass[1]; /* maps right glyph to offset into kern index */
1287  UInt8 kernIndex[1]; /* contains indicies into kernValue */
1288 };
1290 /* format specific part of subtable header */
1292  KernOrderedListHeader orderedList;
1293  KernStateHeader stateTable;
1294  KernSimpleArrayHeader simpleArray;
1295  KernIndexArrayHeader indexArray;
1296 };
1298 /* version 0 subtable header */
1300  UInt16 version; /* kerning table version number */
1301  UInt16 length; /* length in bytes (including this header) */
1302  KernSubtableInfo stInfo; /* sub-table info */
1303  KernFormatSpecificHeader fsHeader; /* format specific sub-header */
1304 };
1306 /* Overall Subtable header format */
1308  SInt32 length; /* length in bytes (including this header) */
1309  KernSubtableInfo stInfo; /* subtable info */
1310  SInt16 tupleIndex; /* tuple index for variation subtables */
1311  KernFormatSpecificHeader fsHeader; /* format specific sub-header */
1312 };
1313 typedef struct KernSubtableHeader KernSubtableHeader;
1315 /* ---------------------------------------------------------------------------
1316  */
1317 /* FORMATS FOR TABLE: 'bsln' */
1318 /* CONSTANTS */
1319 enum {
1320  kBSLNTag = 0x62736C6E, /* 'bsln' */
1321  kBSLNCurrentVersion =
1322  0x00010000, /* current version number for 'bsln' table */
1323  kBSLNDistanceFormatNoMap = 0,
1324  kBSLNDistanceFormatWithMap = 1,
1325  kBSLNControlPointFormatNoMap = 2,
1326  kBSLNControlPointFormatWithMap = 3
1327 };
1328 
1329 /* Baseline classes and constants */
1330 enum {
1331  kBSLNRomanBaseline = 0,
1332  kBSLNIdeographicCenterBaseline = 1,
1333  kBSLNIdeographicLowBaseline = 2,
1334  kBSLNHangingBaseline = 3,
1335  kBSLNMathBaseline = 4,
1336  kBSLNLastBaseline = 31,
1337  kBSLNNumBaselineClasses = kBSLNLastBaseline + 1,
1338  kBSLNNoBaselineOverride = 255
1339 };
1340 
1341 /* TYPES */
1342 typedef UInt32 BslnBaselineClass;
1343 /* The BslnBaselineRecord array defines the baseline deltas for the line. */
1344 typedef Fixed BslnBaselineRecord[32];
1350  SInt16 deltas[32];
1351 };
1352 typedef struct BslnFormat0Part BslnFormat0Part;
1353 /* BslnFormat1Part is the format-specific data for a distance table with a
1354  * gxMapping. */
1356  SInt16 deltas[32];
1357  SFNTLookupTable mappingData;
1358 };
1359 typedef struct BslnFormat1Part BslnFormat1Part;
1367  UInt16 stdGlyph;
1368  SInt16 ctlPoints[32];
1369 };
1370 typedef struct BslnFormat2Part BslnFormat2Part;
1377  UInt16 stdGlyph;
1378  SInt16 ctlPoints[32];
1379  SFNTLookupTable mappingData;
1380 };
1381 typedef struct BslnFormat3Part BslnFormat3Part;
1382 /* The BslnFormatUnion is a union containing the format-specific parts of the
1383  * baseline table. */
1385  BslnFormat0Part fmt0Part;
1386  BslnFormat1Part fmt1Part;
1387  BslnFormat2Part fmt2Part;
1388  BslnFormat3Part fmt3Part;
1389 };
1390 typedef union BslnFormatUnion BslnFormatUnion;
1391 /* The table format used in BaselineTable */
1392 
1393 typedef UInt16 BslnTableFormat;
1394 /* BaselineTable defines the top-level format of the baseline table in the font.
1395  */
1396 struct BslnTable {
1397  Fixed version;
1398  BslnTableFormat format;
1399  UInt16 defaultBaseline;
1400  BslnFormatUnion parts;
1401 };
1402 typedef struct BslnTable BslnTable;
1403 typedef BslnTable *BslnTablePtr;
1404 /* ---------------------------------------------------------------------------
1405  */
1406 
1407 #if PRAGMA_STRUCT_ALIGN
1408 #pragma options align = reset
1409 #elif PRAGMA_STRUCT_PACKPUSH
1410 #pragma pack(pop)
1411 #elif PRAGMA_STRUCT_PACK
1412 #pragma pack()
1413 #endif
1414 
1415 #ifdef PRAGMA_IMPORT_OFF
1416 #pragma import off
1417 #elif PRAGMA_IMPORT
1418 #pragma import reset
1419 #endif
1420 
1421 #ifdef __cplusplus
1422 }
1423 #endif
1424 
1425 #endif /* __SFNTLAYOUTTYPES__ */
Basic Macintosh data types.
long Fixed
Definition: MacTypes.h:153
Definition: SFNTLayoutTypes.h:1349
Definition: SFNTLayoutTypes.h:1355
Definition: SFNTLayoutTypes.h:1366
Definition: SFNTLayoutTypes.h:1376
Definition: SFNTLayoutTypes.h:1396
Definition: Components.h:266
Definition: SFNTLayoutTypes.h:791
Definition: SFNTLayoutTypes.h:752
Definition: SFNTLayoutTypes.h:760
Definition: SFNTLayoutTypes.h:726
Definition: SFNTLayoutTypes.h:710
Definition: SFNTLayoutTypes.h:734
Definition: SFNTLayoutTypes.h:746
Definition: SFNTLayoutTypes.h:786
Definition: SFNTLayoutTypes.h:798
Definition: SFNTLayoutTypes.h:770
Definition: SFNTLayoutTypes.h:780
Definition: SFNTLayoutTypes.h:1277
Definition: SFNTLayoutTypes.h:1202
Definition: SFNTLayoutTypes.h:1242
Definition: SFNTLayoutTypes.h:1208
Definition: SFNTLayoutTypes.h:1215
Definition: SFNTLayoutTypes.h:1268
Definition: SFNTLayoutTypes.h:1231
Definition: SFNTLayoutTypes.h:1225
Definition: SFNTLayoutTypes.h:1307
Definition: SFNTLayoutTypes.h:1184
Definition: SFNTLayoutTypes.h:1177
Definition: SFNTLayoutTypes.h:1299
Definition: SFNTLayoutTypes.h:659
Definition: SFNTLayoutTypes.h:664
Definition: SFNTLayoutTypes.h:943
Definition: SFNTLayoutTypes.h:901
Definition: SFNTLayoutTypes.h:936
Definition: SFNTLayoutTypes.h:917
Definition: SFNTLayoutTypes.h:906
Definition: SFNTLayoutTypes.h:897
Definition: SFNTLayoutTypes.h:929
Definition: SFNTLayoutTypes.h:913
Definition: SFNTLayoutTypes.h:952
Definition: SFNTLayoutTypes.h:1010
Definition: SFNTLayoutTypes.h:978
Definition: SFNTLayoutTypes.h:990
Definition: SFNTLayoutTypes.h:983
Definition: SFNTLayoutTypes.h:974
Definition: SFNTLayoutTypes.h:1003
Definition: SFNTLayoutTypes.h:1019
Definition: SFNTLayoutTypes.h:824
Definition: SFNTLayoutTypes.h:831
Definition: SFNTLayoutTypes.h:1085
Definition: SFNTLayoutTypes.h:1091
Definition: SFNTLayoutTypes.h:1078
Definition: SFNTLayoutTypes.h:505
Definition: SFNTLayoutTypes.h:496
Definition: SFNTLayoutTypes.h:529
Definition: SFNTLayoutTypes.h:523
Definition: SFNTLayoutTypes.h:540
Definition: SFNTLayoutTypes.h:535
Definition: SFNTLayoutTypes.h:554
Definition: SFNTLayoutTypes.h:511
Definition: SFNTLayoutTypes.h:586
Definition: SFNTLayoutTypes.h:597
Definition: SFNTLayoutTypes.h:603
Definition: SFNTLayoutTypes.h:592
Definition: SFNTLayoutTypes.h:578
Definition: SFNTLayoutTypes.h:633
Definition: SFNTLayoutTypes.h:639
Definition: SFNTLayoutTypes.h:628
Definition: SFNTLayoutTypes.h:619
Definition: SFNTLayoutTypes.h:1116
Definition: SFNTLayoutTypes.h:1110
Definition: SFNTLayoutTypes.h:1123
Definition: SFNTLayoutTypes.h:1384
Definition: SFNTLayoutTypes.h:1291
Definition: SFNTLayoutTypes.h:921
Definition: SFNTLayoutTypes.h:995
Definition: SFNTLayoutTypes.h:546