1 {
2      File:       ATS/SFNTLayoutTypes.h
3 
4      Contains:   SFNT file layout structures and constants.
5 
6      Version:    ATS
7 
8      Copyright:  � 1994-2012 by Apple Inc., all rights reserved.
9 
10      Bugs?:      For bug reports, consult the following page on
11                  the World Wide Web:
12 
13                      http://bugs.freepascal.org
14 
15 }
16 
17 {  Pascal Translation Updated: Gorazd Krosl <gorazd_1957@yahoo.ca>, October 2009 }
18 {  Pascal Translation Updated:  Jonas Maebe, <jonas@freepascal.org>, October 2012 }
19 {  Pascal Translation Updated:  Jonas Maebe, <jonas@freepascal.org>, August 2015 }
20 
21 {
22     Modified for use with Free Pascal
23     Version 308
24     Please report any bugs to <gpc@microbizz.nl>
25 }
26 
27 {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
28 {$mode macpas}
29 {$modeswitch cblocks}
30 {$packenum 1}
31 {$macro on}
32 {$inline on}
33 {$calling mwpascal}
34 
35 unit SFNTLayoutTypes;
36 interface
37 {$setc UNIVERSAL_INTERFACES_VERSION := $0400}
38 {$setc GAP_INTERFACES_VERSION := $0308}
39 
40 {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
41     {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
42 {$endc}
43 
44 {$ifc defined CPUPOWERPC and defined CPUI386}
45 	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
46 {$endc}
47 {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
48 	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
49 {$endc}
50 
51 {$ifc not defined __ppc__ and defined CPUPOWERPC32}
52 	{$setc __ppc__ := 1}
53 {$elsec}
54 	{$setc __ppc__ := 0}
55 {$endc}
56 {$ifc not defined __ppc64__ and defined CPUPOWERPC64}
57 	{$setc __ppc64__ := 1}
58 {$elsec}
59 	{$setc __ppc64__ := 0}
60 {$endc}
61 {$ifc not defined __i386__ and defined CPUI386}
62 	{$setc __i386__ := 1}
63 {$elsec}
64 	{$setc __i386__ := 0}
65 {$endc}
66 {$ifc not defined __x86_64__ and defined CPUX86_64}
67 	{$setc __x86_64__ := 1}
68 {$elsec}
69 	{$setc __x86_64__ := 0}
70 {$endc}
71 {$ifc not defined __arm__ and defined CPUARM}
72 	{$setc __arm__ := 1}
73 {$elsec}
74 	{$setc __arm__ := 0}
75 {$endc}
76 {$ifc not defined __arm64__ and defined CPUAARCH64}
77   {$setc __arm64__ := 1}
78 {$elsec}
79   {$setc __arm64__ := 0}
80 {$endc}
81 
82 {$ifc defined cpu64}
83   {$setc __LP64__ := 1}
84 {$elsec}
85   {$setc __LP64__ := 0}
86 {$endc}
87 
88 
89 {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
90 	{$error Conflicting definitions for __ppc__ and __i386__}
91 {$endc}
92 
93 {$ifc defined __ppc__ and __ppc__}
94 	{$setc TARGET_CPU_PPC := TRUE}
95 	{$setc TARGET_CPU_PPC64 := FALSE}
96 	{$setc TARGET_CPU_X86 := FALSE}
97 	{$setc TARGET_CPU_X86_64 := FALSE}
98 	{$setc TARGET_CPU_ARM := FALSE}
99 	{$setc TARGET_CPU_ARM64 := FALSE}
100 	{$setc TARGET_OS_MAC := TRUE}
101 	{$setc TARGET_OS_IPHONE := FALSE}
102 	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
103 	{$setc TARGET_OS_EMBEDDED := FALSE}
104 {$elifc defined __ppc64__ and __ppc64__}
105 	{$setc TARGET_CPU_PPC := FALSE}
106 	{$setc TARGET_CPU_PPC64 := TRUE}
107 	{$setc TARGET_CPU_X86 := FALSE}
108 	{$setc TARGET_CPU_X86_64 := FALSE}
109 	{$setc TARGET_CPU_ARM := FALSE}
110 	{$setc TARGET_CPU_ARM64 := FALSE}
111 	{$setc TARGET_OS_MAC := TRUE}
112 	{$setc TARGET_OS_IPHONE := FALSE}
113 	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
114 	{$setc TARGET_OS_EMBEDDED := FALSE}
115 {$elifc defined __i386__ and __i386__}
116 	{$setc TARGET_CPU_PPC := FALSE}
117 	{$setc TARGET_CPU_PPC64 := FALSE}
118 	{$setc TARGET_CPU_X86 := TRUE}
119 	{$setc TARGET_CPU_X86_64 := FALSE}
120 	{$setc TARGET_CPU_ARM := FALSE}
121 	{$setc TARGET_CPU_ARM64 := FALSE}
122 {$ifc defined iphonesim}
123  	{$setc TARGET_OS_MAC := FALSE}
124 	{$setc TARGET_OS_IPHONE := TRUE}
125 	{$setc TARGET_IPHONE_SIMULATOR := TRUE}
126 {$elsec}
127 	{$setc TARGET_OS_MAC := TRUE}
128 	{$setc TARGET_OS_IPHONE := FALSE}
129 	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
130 {$endc}
131 	{$setc TARGET_OS_EMBEDDED := FALSE}
132 {$elifc defined __x86_64__ and __x86_64__}
133 	{$setc TARGET_CPU_PPC := FALSE}
134 	{$setc TARGET_CPU_PPC64 := FALSE}
135 	{$setc TARGET_CPU_X86 := FALSE}
136 	{$setc TARGET_CPU_X86_64 := TRUE}
137 	{$setc TARGET_CPU_ARM := FALSE}
138 	{$setc TARGET_CPU_ARM64 := FALSE}
139 {$ifc defined iphonesim}
140  	{$setc TARGET_OS_MAC := FALSE}
141 	{$setc TARGET_OS_IPHONE := TRUE}
142 	{$setc TARGET_IPHONE_SIMULATOR := TRUE}
143 {$elsec}
144 	{$setc TARGET_OS_MAC := TRUE}
145 	{$setc TARGET_OS_IPHONE := FALSE}
146 	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
147 {$endc}
148 	{$setc TARGET_OS_EMBEDDED := FALSE}
149 {$elifc defined __arm__ and __arm__}
150 	{$setc TARGET_CPU_PPC := FALSE}
151 	{$setc TARGET_CPU_PPC64 := FALSE}
152 	{$setc TARGET_CPU_X86 := FALSE}
153 	{$setc TARGET_CPU_X86_64 := FALSE}
154 	{$setc TARGET_CPU_ARM := TRUE}
155 	{$setc TARGET_CPU_ARM64 := FALSE}
156 	{$setc TARGET_OS_MAC := FALSE}
157 	{$setc TARGET_OS_IPHONE := TRUE}
158 	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
159 	{$setc TARGET_OS_EMBEDDED := TRUE}
160 {$elifc defined __arm64__ and __arm64__}
161 	{$setc TARGET_CPU_PPC := FALSE}
162 	{$setc TARGET_CPU_PPC64 := FALSE}
163 	{$setc TARGET_CPU_X86 := FALSE}
164 	{$setc TARGET_CPU_X86_64 := FALSE}
165 	{$setc TARGET_CPU_ARM := FALSE}
166 	{$setc TARGET_CPU_ARM64 := TRUE}
167 {$ifc defined ios}
168 	{$setc TARGET_OS_MAC := FALSE}
169 	{$setc TARGET_OS_IPHONE := TRUE}
170 	{$setc TARGET_OS_EMBEDDED := TRUE}
171 {$elsec}
172 	{$setc TARGET_OS_MAC := TRUE}
173 	{$setc TARGET_OS_IPHONE := FALSE}
174 	{$setc TARGET_OS_EMBEDDED := FALSE}
175 {$endc}
176 	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
177 {$elsec}
178 	{$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ nor __arm64__ is defined.}
179 {$endc}
180 
181 {$ifc defined __LP64__ and __LP64__ }
182   {$setc TARGET_CPU_64 := TRUE}
183 {$elsec}
184   {$setc TARGET_CPU_64 := FALSE}
185 {$endc}
186 
187 {$ifc defined FPC_BIG_ENDIAN}
188 	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
189 	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
190 {$elifc defined FPC_LITTLE_ENDIAN}
191 	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
192 	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
193 {$elsec}
194 	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
195 {$endc}
196 {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
197 {$setc CALL_NOT_IN_CARBON := FALSE}
198 {$setc OLDROUTINENAMES := FALSE}
199 {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
200 {$setc OPAQUE_UPP_TYPES := TRUE}
201 {$setc OTCARBONAPPLICATION := TRUE}
202 {$setc OTKERNEL := FALSE}
203 {$setc PM_USE_SESSION_APIS := TRUE}
204 {$setc TARGET_API_MAC_CARBON := TRUE}
205 {$setc TARGET_API_MAC_OS8 := FALSE}
206 {$setc TARGET_API_MAC_OSX := TRUE}
207 {$setc TARGET_CARBON := TRUE}
208 {$setc TARGET_CPU_68K := FALSE}
209 {$setc TARGET_CPU_MIPS := FALSE}
210 {$setc TARGET_CPU_SPARC := FALSE}
211 {$setc TARGET_OS_UNIX := FALSE}
212 {$setc TARGET_OS_WIN32 := FALSE}
213 {$setc TARGET_RT_MAC_68881 := FALSE}
214 {$setc TARGET_RT_MAC_CFM := FALSE}
215 {$setc TARGET_RT_MAC_MACHO := TRUE}
216 {$setc TYPED_FUNCTION_POINTERS := TRUE}
217 {$setc TYPE_BOOL := FALSE}
218 {$setc TYPE_EXTENDED := FALSE}
219 {$setc TYPE_LONGLONG := TRUE}
220 uses MacTypes;
221 {$endc} {not MACOSALLINCLUDE}
222 
223 
224 {$ifc TARGET_OS_MAC}
225 
226 //#pragma pack(push, 2)
227 {$ALIGN MAC68K}
228 
229 { ----------------------------------------------------------------------------------------- }
230 { CONSTANTS }
231 {
232     The following values can be used to set run feature values. Note that unless the
233     feature is defaulted differently in different fonts, the zero value for the
234     selectors represents the default value. Consult the following URL for further info:
235     <http://developer.apple.com/fonts/registry/>
236 }
237 
238 
239 {
240  *  Summary:
241  *    Feature types
242  }
243 const
244 	kAllTypographicFeaturesType = 0;
245 	kLigaturesType = 1;
246 	kCursiveConnectionType = 2;
247 	kLetterCaseType = 3;    { deprecated - use kLowerCaseType or kUpperCaseType instead }
248 	kVerticalSubstitutionType = 4;
249 	kLinguisticRearrangementType = 5;
250 	kNumberSpacingType = 6;
251 	kSmartSwashType = 8;
252 	kDiacriticsType = 9;
253 	kVerticalPositionType = 10;
254 	kFractionsType = 11;
255 	kOverlappingCharactersType = 13;
256 	kTypographicExtrasType = 14;
257 	kMathematicalExtrasType = 15;
258 	kOrnamentSetsType = 16;
259 	kCharacterAlternativesType = 17;
260 	kDesignComplexityType = 18;
261 	kStyleOptionsType = 19;
262 	kCharacterShapeType = 20;
263 	kNumberCaseType = 21;
264 	kTextSpacingType = 22;
265 	kTransliterationType = 23;
266 	kAnnotationType = 24;
267 	kKanaSpacingType = 25;
268 	kIdeographicSpacingType = 26;
269 	kUnicodeDecompositionType = 27;
270 	kRubyKanaType = 28;
271 	kCJKSymbolAlternativesType = 29;
272 	kIdeographicAlternativesType = 30;
273 	kCJKVerticalRomanPlacementType = 31;
274 	kItalicCJKRomanType = 32;
275 	kCaseSensitiveLayoutType = 33;
276 	kAlternateKanaType = 34;
277 	kStylisticAlternativesType = 35;
278 	kContextualAlternatesType = 36;
279 	kLowerCaseType = 37;
280 	kUpperCaseType = 38;
281 	kCJKRomanSpacingType = 103;
282 	kLastFeatureType = -1;
283 
284 
285 {
286  *  Summary:
287  *    Selectors for feature type kAllTypographicFeaturesType
288  }
289 const
290 	kAllTypeFeaturesOnSelector = 0;
291 	kAllTypeFeaturesOffSelector = 1;
292 
293 
294 {
295  *  Summary:
296  *    Selectors for feature type kLigaturesType
297  }
298 const
299 	kRequiredLigaturesOnSelector = 0;
300 	kRequiredLigaturesOffSelector = 1;
301 	kCommonLigaturesOnSelector = 2;
302 	kCommonLigaturesOffSelector = 3;
303 	kRareLigaturesOnSelector = 4;
304 	kRareLigaturesOffSelector = 5;
305 	kLogosOnSelector = 6;
306 	kLogosOffSelector = 7;
307 	kRebusPicturesOnSelector = 8;
308 	kRebusPicturesOffSelector = 9;
309 	kDiphthongLigaturesOnSelector = 10;
310 	kDiphthongLigaturesOffSelector = 11;
311 	kSquaredLigaturesOnSelector = 12;
312 	kSquaredLigaturesOffSelector = 13;
313 	kAbbrevSquaredLigaturesOnSelector = 14;
314 	kAbbrevSquaredLigaturesOffSelector = 15;
315 	kSymbolLigaturesOnSelector = 16;
316 	kSymbolLigaturesOffSelector = 17;
317 	kContextualLigaturesOnSelector = 18;
318 	kContextualLigaturesOffSelector = 19;
319 	kHistoricalLigaturesOnSelector = 20;
320 	kHistoricalLigaturesOffSelector = 21;
321 
322 
323 {
324  *  Summary:
325  *    Selectors for feature type kCursiveConnectionType
326  }
327 const
328 	kUnconnectedSelector = 0;
329 	kPartiallyConnectedSelector = 1;
330 	kCursiveSelector = 2;
331 
332 
333 {
334  *  Summary:
335  *    Selectors for feature type kLetterCaseType
336  }
337 const
338 	kUpperAndLowerCaseSelector = 0;    { deprecated }
339 	kAllCapsSelector = 1;    { deprecated }
340 	kAllLowerCaseSelector = 2;    { deprecated }
341 	kSmallCapsSelector = 3;    { deprecated }
342 	kInitialCapsSelector = 4;    { deprecated }
343 	kInitialCapsAndSmallCapsSelector = 5;  { deprecated }
344 
345 
346 {
347  *  Summary:
348  *    Selectors for feature type kVerticalSubstitutionType
349  }
350 const
351 	kSubstituteVerticalFormsOnSelector = 0;
352 	kSubstituteVerticalFormsOffSelector = 1;
353 
354 
355 {
356  *  Summary:
357  *    Selectors for feature type kLinguisticRearrangementType
358  }
359 const
360 	kLinguisticRearrangementOnSelector = 0;
361 	kLinguisticRearrangementOffSelector = 1;
362 
363 
364 {
365  *  Summary:
366  *    Selectors for feature type kNumberSpacingType
367  }
368 const
369 	kMonospacedNumbersSelector = 0;
370 	kProportionalNumbersSelector = 1;
371 	kThirdWidthNumbersSelector = 2;
372 	kQuarterWidthNumbersSelector = 3;
373 
374 
375 {
376  *  Summary:
377  *    Selectors for feature type kSmartSwashType
378  }
379 const
380 	kWordInitialSwashesOnSelector = 0;
381 	kWordInitialSwashesOffSelector = 1;
382 	kWordFinalSwashesOnSelector = 2;
383 	kWordFinalSwashesOffSelector = 3;
384 	kLineInitialSwashesOnSelector = 4;
385 	kLineInitialSwashesOffSelector = 5;
386 	kLineFinalSwashesOnSelector = 6;
387 	kLineFinalSwashesOffSelector = 7;
388 	kNonFinalSwashesOnSelector = 8;
389 	kNonFinalSwashesOffSelector = 9;
390 
391 
392 {
393  *  Summary:
394  *    Selectors for feature type kDiacriticsType
395  }
396 const
397 	kShowDiacriticsSelector = 0;
398 	kHideDiacriticsSelector = 1;
399 	kDecomposeDiacriticsSelector = 2;
400 
401 
402 {
403  *  Summary:
404  *    Selectors for feature type kVerticalPositionType
405  }
406 const
407 	kNormalPositionSelector = 0;
408 	kSuperiorsSelector = 1;
409 	kInferiorsSelector = 2;
410 	kOrdinalsSelector = 3;
411 	kScientificInferiorsSelector = 4;
412 
413 
414 {
415  *  Summary:
416  *    Selectors for feature type kFractionsType
417  }
418 const
419 	kNoFractionsSelector = 0;
420 	kVerticalFractionsSelector = 1;
421 	kDiagonalFractionsSelector = 2;
422 
423 
424 {
425  *  Summary:
426  *    Selectors for feature type kOverlappingCharactersType
427  }
428 const
429 	kPreventOverlapOnSelector = 0;
430 	kPreventOverlapOffSelector = 1;
431 
432 
433 {
434  *  Summary:
435  *    Selectors for feature type kTypographicExtrasType
436  }
437 const
438 	kHyphensToEmDashOnSelector = 0;
439 	kHyphensToEmDashOffSelector = 1;
440 	kHyphenToEnDashOnSelector = 2;
441 	kHyphenToEnDashOffSelector = 3;
442 	kSlashedZeroOnSelector = 4;
443 	kSlashedZeroOffSelector = 5;
444 	kFormInterrobangOnSelector = 6;
445 	kFormInterrobangOffSelector = 7;
446 	kSmartQuotesOnSelector = 8;
447 	kSmartQuotesOffSelector = 9;
448 	kPeriodsToEllipsisOnSelector = 10;
449 	kPeriodsToEllipsisOffSelector = 11;
450 
451 
452 {
453  *  Summary:
454  *    Selectors for feature type kMathematicalExtrasType
455  }
456 const
457 	kHyphenToMinusOnSelector = 0;
458 	kHyphenToMinusOffSelector = 1;
459 	kAsteriskToMultiplyOnSelector = 2;
460 	kAsteriskToMultiplyOffSelector = 3;
461 	kSlashToDivideOnSelector = 4;
462 	kSlashToDivideOffSelector = 5;
463 	kInequalityLigaturesOnSelector = 6;
464 	kInequalityLigaturesOffSelector = 7;
465 	kExponentsOnSelector = 8;
466 	kExponentsOffSelector = 9;
467 	kMathematicalGreekOnSelector = 10;
468 	kMathematicalGreekOffSelector = 11;
469 
470 
471 {
472  *  Summary:
473  *    Selectors for feature type kOrnamentSetsType
474  }
475 const
476 	kNoOrnamentsSelector = 0;
477 	kDingbatsSelector = 1;
478 	kPiCharactersSelector = 2;
479 	kFleuronsSelector = 3;
480 	kDecorativeBordersSelector = 4;
481 	kInternationalSymbolsSelector = 5;
482 	kMathSymbolsSelector = 6;
483 
484 
485 {
486  *  Summary:
487  *    Selectors for feature type kCharacterAlternativesType
488  }
489 const
490 	kNoAlternatesSelector = 0;
491 
492 
493 {
494  *  Summary:
495  *    Selectors for feature type kDesignComplexityType
496  }
497 const
498 	kDesignLevel1Selector = 0;
499 	kDesignLevel2Selector = 1;
500 	kDesignLevel3Selector = 2;
501 	kDesignLevel4Selector = 3;
502 	kDesignLevel5Selector = 4;
503 
504 
505 {
506  *  Summary:
507  *    Selectors for feature type kStyleOptionsType
508  }
509 const
510 	kNoStyleOptionsSelector = 0;
511 	kDisplayTextSelector = 1;
512 	kEngravedTextSelector = 2;
513 	kIlluminatedCapsSelector = 3;
514 	kTitlingCapsSelector = 4;
515 	kTallCapsSelector = 5;
516 
517 
518 {
519  *  Summary:
520  *    Selectors for feature type kCharacterShapeType
521  }
522 const
523 	kTraditionalCharactersSelector = 0;
524 	kSimplifiedCharactersSelector = 1;
525 	kJIS1978CharactersSelector = 2;
526 	kJIS1983CharactersSelector = 3;
527 	kJIS1990CharactersSelector = 4;
528 	kTraditionalAltOneSelector = 5;
529 	kTraditionalAltTwoSelector = 6;
530 	kTraditionalAltThreeSelector = 7;
531 	kTraditionalAltFourSelector = 8;
532 	kTraditionalAltFiveSelector = 9;
533 	kExpertCharactersSelector = 10;
534 	kJIS2004CharactersSelector = 11;
535 	kHojoCharactersSelector = 12;
536 	kNLCCharactersSelector = 13;
537 	kTraditionalNamesCharactersSelector = 14;
538 
539 
540 {
541  *  Summary:
542  *    Selectors for feature type kNumberCaseType
543  }
544 const
545 	kLowerCaseNumbersSelector = 0;
546 	kUpperCaseNumbersSelector = 1;
547 
548 
549 {
550  *  Summary:
551  *    Selectors for feature type kTextSpacingType
552  }
553 const
554 	kProportionalTextSelector = 0;
555 	kMonospacedTextSelector = 1;
556 	kHalfWidthTextSelector = 2;
557 	kThirdWidthTextSelector = 3;
558 	kQuarterWidthTextSelector = 4;
559 	kAltProportionalTextSelector = 5;
560 	kAltHalfWidthTextSelector = 6;
561 
562 
563 {
564  *  Summary:
565  *    Selectors for feature type kTransliterationType
566  }
567 const
568 	kNoTransliterationSelector = 0;
569 	kHanjaToHangulSelector = 1;
570 	kHiraganaToKatakanaSelector = 2;
571 	kKatakanaToHiraganaSelector = 3;
572 	kKanaToRomanizationSelector = 4;
573 	kRomanizationToHiraganaSelector = 5;
574 	kRomanizationToKatakanaSelector = 6;
575 	kHanjaToHangulAltOneSelector = 7;
576 	kHanjaToHangulAltTwoSelector = 8;
577 	kHanjaToHangulAltThreeSelector = 9;
578 
579 
580 {
581  *  Summary:
582  *    Selectors for feature type kAnnotationType
583  }
584 const
585 	kNoAnnotationSelector = 0;
586 	kBoxAnnotationSelector = 1;
587 	kRoundedBoxAnnotationSelector = 2;
588 	kCircleAnnotationSelector = 3;
589 	kInvertedCircleAnnotationSelector = 4;
590 	kParenthesisAnnotationSelector = 5;
591 	kPeriodAnnotationSelector = 6;
592 	kRomanNumeralAnnotationSelector = 7;
593 	kDiamondAnnotationSelector = 8;
594 	kInvertedBoxAnnotationSelector = 9;
595 	kInvertedRoundedBoxAnnotationSelector = 10;
596 
597 
598 {
599  *  Summary:
600  *    Selectors for feature type kKanaSpacingType
601  }
602 const
603 	kFullWidthKanaSelector = 0;
604 	kProportionalKanaSelector = 1;
605 
606 
607 {
608  *  Summary:
609  *    Selectors for feature type kIdeographicSpacingType
610  }
611 const
612 	kFullWidthIdeographsSelector = 0;
613 	kProportionalIdeographsSelector = 1;
614 	kHalfWidthIdeographsSelector = 2;
615 
616 
617 {
618  *  Summary:
619  *    Selectors for feature type kUnicodeDecompositionType
620  }
621 const
622 	kCanonicalCompositionOnSelector = 0;
623 	kCanonicalCompositionOffSelector = 1;
624 	kCompatibilityCompositionOnSelector = 2;
625 	kCompatibilityCompositionOffSelector = 3;
626 	kTranscodingCompositionOnSelector = 4;
627 	kTranscodingCompositionOffSelector = 5;
628 
629 
630 {
631  *  Summary:
632  *    Selectors for feature type kRubyKanaType
633  }
634 const
635 	kNoRubyKanaSelector = 0;    { deprecated - use kRubyKanaOffSelector instead }
636 	kRubyKanaSelector = 1;    { deprecated - use kRubyKanaOnSelector instead }
637 	kRubyKanaOnSelector = 2;
638 	kRubyKanaOffSelector = 3;
639 
640 
641 {
642  *  Summary:
643  *    Selectors for feature type kCJKSymbolAlternativesType
644  }
645 const
646 	kNoCJKSymbolAlternativesSelector = 0;
647 	kCJKSymbolAltOneSelector = 1;
648 	kCJKSymbolAltTwoSelector = 2;
649 	kCJKSymbolAltThreeSelector = 3;
650 	kCJKSymbolAltFourSelector = 4;
651 	kCJKSymbolAltFiveSelector = 5;
652 
653 
654 {
655  *  Summary:
656  *    Selectors for feature type kIdeographicAlternativesType
657  }
658 const
659 	kNoIdeographicAlternativesSelector = 0;
660 	kIdeographicAltOneSelector = 1;
661 	kIdeographicAltTwoSelector = 2;
662 	kIdeographicAltThreeSelector = 3;
663 	kIdeographicAltFourSelector = 4;
664 	kIdeographicAltFiveSelector = 5;
665 
666 
667 {
668  *  Summary:
669  *    Selectors for feature type kCJKVerticalRomanPlacementType
670  }
671 const
672 	kCJKVerticalRomanCenteredSelector = 0;
673 	kCJKVerticalRomanHBaselineSelector = 1;
674 
675 
676 {
677  *  Summary:
678  *    Selectors for feature type kItalicCJKRomanType
679  }
680 const
681 	kNoCJKItalicRomanSelector = 0;    { deprecated - use kCJKItalicRomanOffSelector instead }
682 	kCJKItalicRomanSelector = 1;    { deprecated - use kCJKItalicRomanOnSelector instead }
683 	kCJKItalicRomanOnSelector = 2;
684 	kCJKItalicRomanOffSelector = 3;
685 
686 
687 {
688  *  Summary:
689  *    Selectors for feature type kCaseSensitiveLayoutType
690  }
691 const
692 	kCaseSensitiveLayoutOnSelector = 0;
693 	kCaseSensitiveLayoutOffSelector = 1;
694 	kCaseSensitiveSpacingOnSelector = 2;
695 	kCaseSensitiveSpacingOffSelector = 3;
696 
697 
698 {
699  *  Summary:
700  *    Selectors for feature type kAlternateKanaType
701  }
702 const
703 	kAlternateHorizKanaOnSelector = 0;
704 	kAlternateHorizKanaOffSelector = 1;
705 	kAlternateVertKanaOnSelector = 2;
706 	kAlternateVertKanaOffSelector = 3;
707 
708 
709 {
710  *  Summary:
711  *    Selectors for feature type kStylisticAlternativesType
712  }
713 const
714 	kNoStylisticAlternatesSelector = 0;
715 	kStylisticAltOneOnSelector = 2;
716 	kStylisticAltOneOffSelector = 3;
717 	kStylisticAltTwoOnSelector = 4;
718 	kStylisticAltTwoOffSelector = 5;
719 	kStylisticAltThreeOnSelector = 6;
720 	kStylisticAltThreeOffSelector = 7;
721 	kStylisticAltFourOnSelector = 8;
722 	kStylisticAltFourOffSelector = 9;
723 	kStylisticAltFiveOnSelector = 10;
724 	kStylisticAltFiveOffSelector = 11;
725 	kStylisticAltSixOnSelector = 12;
726 	kStylisticAltSixOffSelector = 13;
727 	kStylisticAltSevenOnSelector = 14;
728 	kStylisticAltSevenOffSelector = 15;
729 	kStylisticAltEightOnSelector = 16;
730 	kStylisticAltEightOffSelector = 17;
731 	kStylisticAltNineOnSelector = 18;
732 	kStylisticAltNineOffSelector = 19;
733 	kStylisticAltTenOnSelector = 20;
734 	kStylisticAltTenOffSelector = 21;
735 	kStylisticAltElevenOnSelector = 22;
736 	kStylisticAltElevenOffSelector = 23;
737 	kStylisticAltTwelveOnSelector = 24;
738 	kStylisticAltTwelveOffSelector = 25;
739 	kStylisticAltThirteenOnSelector = 26;
740 	kStylisticAltThirteenOffSelector = 27;
741 	kStylisticAltFourteenOnSelector = 28;
742 	kStylisticAltFourteenOffSelector = 29;
743 	kStylisticAltFifteenOnSelector = 30;
744 	kStylisticAltFifteenOffSelector = 31;
745 	kStylisticAltSixteenOnSelector = 32;
746 	kStylisticAltSixteenOffSelector = 33;
747 	kStylisticAltSeventeenOnSelector = 34;
748 	kStylisticAltSeventeenOffSelector = 35;
749 	kStylisticAltEighteenOnSelector = 36;
750 	kStylisticAltEighteenOffSelector = 37;
751 	kStylisticAltNineteenOnSelector = 38;
752 	kStylisticAltNineteenOffSelector = 39;
753 	kStylisticAltTwentyOnSelector = 40;
754 	kStylisticAltTwentyOffSelector = 41;
755 
756 
757 {
758  *  Summary:
759  *    Selectors for feature type kContextualAlternatesType
760  }
761 const
762 	kContextualAlternatesOnSelector = 0;
763 	kContextualAlternatesOffSelector = 1;
764 	kSwashAlternatesOnSelector = 2;
765 	kSwashAlternatesOffSelector = 3;
766 	kContextualSwashAlternatesOnSelector = 4;
767 	kContextualSwashAlternatesOffSelector = 5;
768 
769 
770 {
771  *  Summary:
772  *    Selectors for feature type kLowerCaseType
773  }
774 const
775 	kDefaultLowerCaseSelector = 0;
776 	kLowerCaseSmallCapsSelector = 1;
777 	kLowerCasePetiteCapsSelector = 2;
778 
779 
780 {
781  *  Summary:
782  *    Selectors for feature type kUpperCaseType
783  }
784 const
785 	kDefaultUpperCaseSelector = 0;
786 	kUpperCaseSmallCapsSelector = 1;
787 	kUpperCasePetiteCapsSelector = 2;
788 
789 
790 {
791  *  Summary:
792  *    Selectors for feature type kCJKRomanSpacingType
793  }
794 const
795 	kHalfWidthCJKRomanSelector = 0;
796 	kProportionalCJKRomanSelector = 1;
797 	kDefaultCJKRomanSelector = 2;
798 	kFullWidthCJKRomanSelector = 3;
799 
800 { --------------------------------------------------------------------------- }
801 { ---------------- Table Specific Typedefs and Constants -------------------- }
802 { --------------------------------------------------------------------------- }
803 { FORMATS FOR TABLE: lookup tables - used within various other tables }
804 const
805 	kSFNTLookupSimpleArray = 0;    { a simple array indexed by glyph code }
806 	kSFNTLookupSegmentSingle = 2;    { segment mapping to single value }
807 	kSFNTLookupSegmentArray = 4;    { segment mapping to lookup array }
808 	kSFNTLookupSingleTable = 6;    { sorted list of glyph, value pairs }
809 	kSFNTLookupTrimmedArray = 8;     { a simple trimmed array indexed by glyph code }
810 
811 type
812 	SFNTLookupTableFormat = UInt16;
813 	SFNTLookupValue = UInt16;
814 	SFNTLookupOffset = UInt16;
815 	SFNTLookupKind = UInt32;
816 {
817     A BinarySearchHeader defines the five standard fields needed to perform quick
818     lookups in a lookup table (note that using UInt16s, and not ItemCounts or
819     similar types, is important here, since these tables are in fonts, and the
820     documented font formats specify 16-bit quantities).
821 }
822 type
823 	SFNTLookupBinarySearchHeaderPtr = ^SFNTLookupBinarySearchHeader;
824 	SFNTLookupBinarySearchHeader = record
825 		unitSize: UInt16;               { size of a unit in bytes }
826 		nUnits: UInt16;                 { number of units in table }
827 		searchRange: UInt16;            { (largest power of two <= nUnits) * unitSize }
828 		entrySelector: UInt16;          { log2 (largest power of two <= nUnits) }
829 		rangeShift: UInt16;             { (nUnits - largest power of two <= nUnits) * unitSize }
830 	end;
831 { A format 0 lookup table maps all glyphs in the font to lookup values }
832 type
833 	SFNTLookupArrayHeaderPtr = ^SFNTLookupArrayHeader;
834 	SFNTLookupArrayHeader = record
835 		lookupValues : array[0..0] of SFNTLookupValue;
836 	end;
837 { A format 8 lookup table maps some range of glyphs in the font to lookup values }
838 type
839 	SFNTLookupTrimmedArrayHeaderPtr = ^SFNTLookupTrimmedArrayHeader;
840 	SFNTLookupTrimmedArrayHeader = record
841 		firstGlyph: UInt16;
842 		count: UInt16;
843 		valueArray : array[0..0] of SFNTLookupValue;
844 	end;
845 {
846     Format 2 and format 4 lookup tables map ranges of glyphs to either single lookup
847     values (format 2), or per-glyph lookup values (format 4). Since both formats
848     use the same kind of data, only one unified set of segment-related structures
849     is defined.
850 }
851 type
852 	SFNTLookupSegmentPtr = ^SFNTLookupSegment;
853 	SFNTLookupSegment = record
854 		lastGlyph: UInt16;
855 		firstGlyph: UInt16;
856 		value: array[0..0] of UInt16;
857 	end;
858 type
859 	SFNTLookupSegmentHeaderPtr = ^SFNTLookupSegmentHeader;
860 	SFNTLookupSegmentHeader = record
861 		binSearch: SFNTLookupBinarySearchHeader;
862 		segments: array[0..0] of SFNTLookupSegment;
863 	end;
864 { A format 6 lookup table maps single glyphs to lookup values. }
865 type
866 	SFNTLookupSinglePtr = ^SFNTLookupSingle;
867 	SFNTLookupSingle = record
868 		glyph: UInt16;
869 		value: array[0..0] of UInt16;
870 	end;
871 type
872 	SFNTLookupSingleHeaderPtr = ^SFNTLookupSingleHeader;
873 	SFNTLookupSingleHeader = record
874 		binSearch: SFNTLookupBinarySearchHeader;
875 		entries: array[0..0] of SFNTLookupSingle;
876 	end;
877 { The format-specific part of the subtable header }
878 	SFNTLookupFormatSpecificHeaderPtr = ^SFNTLookupFormatSpecificHeader;
879  	SFNTLookupFormatSpecificHeader = record
880  		case SInt16 of
881 		0: (
882 			theArray:			SFNTLookupArrayHeader;
883 			);
884 		1: (
885 			segment:			SFNTLookupSegmentHeader;
886 			);
887 		2: (
888 			single:				SFNTLookupSingleHeader;
889 			);
890 		3: (
891 			trimmedArray:		SFNTLookupTrimmedArrayHeader;
892 			);
893 	end;
894 
895 { The overall subtable header }
896 type
897 	SFNTLookupTable = record
898 		format: SFNTLookupTableFormat;              { table format }
899 		fsHeader: SFNTLookupFormatSpecificHeader;   { format specific header }
900 	end;
901 	SFNTLookupTablePtr = ^SFNTLookupTable;
902 	SFNTLookupTableHandle = ^SFNTLookupTablePtr;
903 { --------------------------------------------------------------------------- }
904 { GENERAL FORMATS FOR STATE TABLES -- prefix "ST" }
905 const
906 	kSTClassEndOfText = 0;
907 	kSTClassOutOfBounds = 1;
908 	kSTClassDeletedGlyph = 2;
909 	kSTClassEndOfLine = 3;
910 	kSTSetMark = $8000;
911 	kSTNoAdvance = $4000;
912 	kSTMarkEnd = $2000;
913 	kSTLigActionMask = $3FFF;
914 	kSTRearrVerbMask = $000F;
915 
916 type
917 	STClass = UInt8;
918 	STEntryIndex = UInt8;
919 	STHeaderPtr = ^STHeader;
920 	STHeader = record
921 		filler: UInt8;
922 		nClasses: STClass;
923 		classTableOffset: UInt16;
924 		stateArrayOffset: UInt16;
925 		entryTableOffset: UInt16;
926 	end;
927 type
928 	STClassTablePtr = ^STClassTable;
929 	STClassTable = record
930 		firstGlyph: UInt16;
931 		nGlyphs: UInt16;
932 		classes: array[0..0] of STClass;
933 	end;
934 type
935 	STEntryZeroPtr = ^STEntryZero;
936 	STEntryZero = record
937 		newState: UInt16;
938 		flags: UInt16;
939 	end;
940 type
941 	STEntryOnePtr = ^STEntryOne;
942 	STEntryOne = record
943 		newState: UInt16;
944 		flags: UInt16;
945 		offset1: UInt16;
946 	end;
947 type
948 	STEntryTwoPtr = ^STEntryTwo;
949 	STEntryTwo = record
950 		newState: UInt16;
951 		flags: UInt16;
952 		offset1: UInt16;
953 		offset2: UInt16;
954 	end;
955 { --------------------------------------------------------------------------- }
956 { GENERAL FORMATS FOR STATE TABLES to be used with 'morx' tables -- prefix "STX" }
957 const
958 	kSTXHasLigAction = $2000;
959 
960 
961 type
962 	STXClass = UInt16;
963 	STXStateIndex = UInt16;
964 	STXEntryIndex = UInt16;
965 	STXHeaderPtr = ^STXHeader;
966 	STXHeader = record
967 		nClasses: UInt32;
968 		classTableOffset: UInt32;
969 		stateArrayOffset: UInt32;
970 		entryTableOffset: UInt32;
971 	end;
972 
973 type
974 	STXClassTable = SFNTLookupTable;
975 	STXEntryZeroPtr = ^STXEntryZero;
976 	STXEntryZero = record
977 		newState: STXStateIndex;
978 		flags: UInt16;
979 	end;
980 type
981 	STXEntryOnePtr = ^STXEntryOne;
982 	STXEntryOne = record
983 		newState: STXStateIndex;
984 		flags: UInt16;
985 		index1: UInt16;
986 	end;
987 type
988 	STXEntryTwoPtr = ^STXEntryTwo;
989 	STXEntryTwo = record
990 		newState: STXStateIndex;
991 		flags: UInt16;
992 		index1: UInt16;
993 		index2: UInt16;
994 	end;
995 { --------------------------------------------------------------------------- }
996 { FORMATS FOR TABLE: 'lcar' }
997 { CONSTANTS }
998 const
999 	kLCARTag = $6C636172; { 'lcar' }
1000 	kLCARCurrentVersion = $00010000; { current version number for 'lcar' table }
1001 	kLCARLinearFormat = 0;
1002 	kLCARCtlPointFormat = 1;
1003 
1004 { TYPES }
1005 type
1006 	LcarCaretClassEntryPtr = ^LcarCaretClassEntry;
1007 	LcarCaretClassEntry = record
1008 		count: UInt16;
1009 		partials: array[0..0] of UInt16;            { these are either FUnits or control-point numbers }
1010 	end;
1011 type
1012 	LcarCaretTable = record
1013 		version: Fixed;
1014 		format: UInt16;
1015 		lookup: SFNTLookupTable;
1016 	end;
1017 	LcarCaretTablePtr = ^LcarCaretTable;
1018 { --------------------------------------------------------------------------- }
1019 { FORMATS FOR TABLE: 'just' }
1020 { CONSTANTS }
1021 const
1022 	kJUSTTag = $6A757374; { 'just' }
1023 	kJUSTCurrentVersion = $00010000;
1024 	kJUSTStandardFormat = 0;
1025 	kJUSTnoGlyphcode = $FFFF; { used in a pcConditionalAddAction }
1026 	kJUSTpcDecompositionAction = 0;
1027 	kJUSTpcUnconditionalAddAction = 1;
1028 	kJUSTpcConditionalAddAction = 2;
1029 	kJUSTpcGlyphStretchAction = 3;
1030 	kJUSTpcDuctilityAction = 4;
1031 	kJUSTpcGlyphRepeatAddAction = 5;
1032 
1033 { Justification priority levels }
1034 const
1035 	kJUSTKashidaPriority = 0;
1036 	kJUSTSpacePriority = 1;
1037 	kJUSTLetterPriority = 2;
1038 	kJUSTNullPriority = 3;
1039 	kJUSTPriorityCount = 4;
1040 
1041 { Justification flags }
1042 const
1043 	kJUSTOverridePriority = $8000;
1044 	kJUSTOverrideLimits = $4000;
1045 	kJUSTOverrideUnlimited = $2000;
1046 	kJUSTUnlimited = $1000;
1047 	kJUSTPriorityMask = $0003;
1048 
1049 { TYPES }
1050 type
1051 	JustPCActionType = UInt16;
1052 	JustificationFlags = UInt16;
1053 { A JustPCDecompositionAction defines a ligature decomposition action. }
1054 type
1055 	JustPCDecompositionActionPtr = ^JustPCDecompositionAction;
1056 	JustPCDecompositionAction = record
1057 		lowerLimit: Fixed;
1058 		upperLimit: Fixed;
1059 		order: UInt16;
1060 		count: UInt16;
1061 		glyphs: array[0..0] of UInt16;
1062 	end;
1063 { A JUSTPCUnconditionalAddAction defines an unconditional glyph add action. }
1064 
1065 type
1066 	JustPCUnconditionalAddAction = UInt16;
1067 {
1068     A JUSTPCConditionalAddAction defines a glyph substitution and add action. If the addGlyph
1069     is equal to kJUSTnoGlyphcode, then no glyph will be added, and the justification for
1070     the line will be redone.
1071 }
1072 type
1073 	JustPCConditionalAddActionPtr = ^JustPCConditionalAddAction;
1074 	JustPCConditionalAddAction = record
1075 		substThreshold: Fixed;        { threshold of growth factor at which subst occurs }
1076 		addGlyph: UInt16;
1077 		substGlyph: UInt16;
1078 	end;
1079 { A PCDuctilityAction defines a ductile axis along which the glyph will be varied. }
1080 type
1081 	JustPCDuctilityActionPtr = ^JustPCDuctilityAction;
1082 	JustPCDuctilityAction = record
1083 		ductilityAxis: UInt32;
1084 		minimumLimit: Fixed;
1085 		noStretchValue: Fixed;
1086 		maximumLimit: Fixed;
1087 	end;
1088 {
1089     A PCGlyphRepetitionAction defines a glyph which will not be stretched or otherwise
1090     transformed, but rather which will be emplaced however many times are needed to fill
1091     the needed gap.
1092 }
1093 type
1094 	JustPCGlyphRepeatAddActionPtr = ^JustPCGlyphRepeatAddAction;
1095 	JustPCGlyphRepeatAddAction = record
1096 		flags: UInt16;
1097 		glyph: UInt16;
1098 	end;
1099 { PCActionSubrecords contain the actual postcompensation actions. }
1100 type
1101 	JustPCActionSubrecordPtr = ^JustPCActionSubrecord;
1102 	JustPCActionSubrecord = record
1103 		theClass: UInt16;               { justification class value associated with this rec }
1104 		theType: JustPCActionType;
1105 		length: UInt32;
1106 		data: UInt32;                   { not really a UInt32; cast as ptr to appropriate action }
1107 	end;
1108 { The set of postcompensation records is defined in a PCAction struct. }
1109 type
1110 	JustPCActionPtr = ^JustPCAction;
1111 	JustPCAction = record
1112 		actionCount: UInt32;            { long for alignment purposes }
1113 		actions: array[0..0] of JustPCActionSubrecord;
1114 	end;
1115 {
1116     JustWidthDeltaEntry is the justification table entry structure.  The justClass value (which is
1117     actually limited to 7 bits by the state table structure) is defined as a long for PPC alignment reasons.
1118 }
1119 type
1120 	JustWidthDeltaEntryPtr = ^JustWidthDeltaEntry;
1121 	JustWidthDeltaEntry = record
1122 		justClass: UInt32;
1123 		beforeGrowLimit: Fixed;        { ems AW can grow by at most on LT }
1124 		beforeShrinkLimit: Fixed;      { ems AW can shrink by at most on LT }
1125 		afterGrowLimit: Fixed;         { ems AW can grow by at most on RB }
1126 		afterShrinkLimit: Fixed;       { ems AW can shrink by at most on RB }
1127 		growFlags: JustificationFlags;              { flags controlling grow case }
1128 		shrinkFlags: JustificationFlags;            { flags controlling shrink case }
1129 	end;
1130 type
1131 	JustWidthDeltaGroupPtr = ^JustWidthDeltaGroup;
1132 	JustWidthDeltaGroup = record
1133 		count: UInt32;
1134 		entries: array[0..0] of JustWidthDeltaEntry;
1135 	end;
1136 { Overall structure of a postcompensation table is defined in PostcompTable. }
1137 type
1138 	JustPostcompTablePtr = ^JustPostcompTable;
1139 	JustPostcompTable = record
1140 		lookupTable: SFNTLookupTable;
1141                                               { action records here }
1142 	end;
1143 type
1144 	JustDirectionTablePtr = ^JustDirectionTable;
1145 	JustDirectionTable = record
1146 		justClass: UInt16;              { offset to state table (0=none) }
1147 		widthDeltaClusters: UInt16;     { offset to clusters }
1148 		postcomp: UInt16;               { offset to postcomp table (0=none) }
1149 		lookup: SFNTLookupTable;
1150 	end;
1151 type
1152 	JustTablePtr = ^JustTable;
1153 	JustTable = record
1154 		version: Fixed;
1155 		format: UInt16;
1156 		horizHeaderOffset: UInt16;
1157 		vertHeaderOffset: UInt16;
1158 	end;
1159 { --------------------------------------------------------------------------- }
1160 { FORMATS FOR TABLE: 'opbd' }
1161 { CONSTANTS }
1162 const
1163 	kOPBDTag = $6F706264; { 'opbd' }
1164 	kOPBDCurrentVersion = $00010000;
1165 	kOPBDDistanceFormat = 0;
1166 	kOPBDControlPointFormat = 1;
1167 
1168 { TYPES }
1169 
1170 type
1171 	OpbdTableFormat = UInt16;
1172 {
1173     The OpbdSideValues struct is the lookup result from the FindSingle call for the
1174     optical tables. It contains the 4 FUnit values that are relevant to the specified
1175     glyph, or the 4 control gxPoint values.
1176 }
1177 type
1178 	OpbdSideValuesPtr = ^OpbdSideValues;
1179 	OpbdSideValues = record
1180 		leftSideShift: SInt16;
1181 		topSideShift: SInt16;
1182 		rightSideShift: SInt16;
1183 		bottomSideShift: SInt16;
1184 	end;
1185 type
1186 	OpbdTablePtr = ^OpbdTable;
1187 	OpbdTable = record
1188 		version: Fixed;
1189 		format: OpbdTableFormat;
1190 		lookupTable: SFNTLookupTable;
1191 	end;
1192 { --------------------------------------------------------------------------- }
1193 { FORMATS FOR TABLE: 'mort' }
1194 { CONSTANTS }
1195 const
1196 	kMORTTag = $6D6F7274; { 'mort' }
1197 	kMORTCurrentVersion = $00010000; { current version number for 'mort' table }
1198                                         { Coverage masks }
1199 	kMORTCoverVertical = $8000;
1200 	kMORTCoverDescending = $4000;
1201 	kMORTCoverIgnoreVertical = $2000;
1202 	kMORTCoverTypeMask = $000F; { Subtable types }
1203 	kMORTRearrangementType = 0;
1204 	kMORTContextualType = 1;
1205 	kMORTLigatureType = 2;
1206 	kMORTSwashType = 4;
1207 	kMORTInsertionType = 5;    { Ligature subtable constants }
1208 	kMORTLigLastAction = $80000000;
1209 	kMORTLigStoreLigature = $40000000;
1210 	kMORTLigFormOffsetMask = $3FFFFFFF;
1211 	kMORTLigFormOffsetShift = 2;    { Rearrangement subtable actions }
1212 	kMORTraNoAction = 0;    {    no action   }
1213 	kMORTraxA = 1;    {      Ax => xA    }
1214 	kMORTraDx = 2;    {      xD => Dx    }
1215 	kMORTraDxA = 3;    {     AxD => DxA   }
1216 	kMORTraxAB = 4;    {   ABx => xAB   }
1217 	kMORTraxBA = 5;    {   ABx => xBA   }
1218 	kMORTraCDx = 6;    {   xCD => CDx   }
1219 	kMORTraDCx = 7;    {   xCD => DCx   }
1220 	kMORTraCDxA = 8;    {  AxCD => CDxA  }
1221 	kMORTraDCxA = 9;    {  AxCD => DCxA  }
1222 	kMORTraDxAB = 10;   {  ABxD => DxAB  }
1223 	kMORTraDxBA = 11;   {  ABxD => DxBA  }
1224 	kMORTraCDxAB = 12;   { ABxCD => CDxAB }
1225 	kMORTraCDxBA = 13;   { ABxCD => CDxBA }
1226 	kMORTraDCxAB = 14;   { ABxCD => DCxAB }
1227 	kMORTraDCxBA = 15;   { ABxCD => DCxBA }
1228                                         { Insertion subtable constants }
1229 	kMORTDoInsertionsBefore = $80;
1230 	kMORTIsSplitVowelPiece = $40;
1231 	kMORTInsertionsCountMask = $3F;
1232 	kMORTCurrInsertKashidaLike = $2000;
1233 	kMORTMarkInsertKashidaLike = $1000;
1234 	kMORTCurrInsertBefore = $0800;
1235 	kMORTMarkInsertBefore = $0400;
1236 	kMORTMarkJustTableCountMask = $3F80;
1237 	kMORTMarkJustTableCountShift = 7;    { JustTableIndex for marked character }
1238 	kMORTCurrJustTableCountMask = $007F;
1239 	kMORTCurrJustTableCountShift = 0;    { JustTableIndex for current character }
1240 	kMORTCurrInsertCountMask = $03E0;
1241 	kMORTCurrInsertCountShift = 5;    { count to insert after current glyphRec }
1242 	kMORTMarkInsertCountMask = $001F;
1243 	kMORTMarkInsertCountShift = 0;     { count to insert after marked glyphRec }
1244 
1245 { TYPES }
1246 
1247 type
1248 	MortSubtableMaskFlags = UInt32;
1249 	MortLigatureActionEntry = UInt32;
1250 	MortRearrangementSubtablePtr = ^MortRearrangementSubtable;
1251 	MortRearrangementSubtable = record
1252 		header: STHeader;
1253 	end;
1254 
1255 	MortContextualSubtablePtr = ^MortContextualSubtable;
1256 	MortContextualSubtable = record
1257 		header: STHeader;
1258 		substitutionTableOffset: UInt16;
1259 	end;
1260 
1261 	MortLigatureSubtablePtr = ^MortLigatureSubtable;
1262 	MortLigatureSubtable = record
1263 		header: STHeader;
1264 		ligatureActionTableOffset: UInt16;
1265 		componentTableOffset: UInt16;
1266 		ligatureTableOffset: UInt16;
1267 	end;
1268 
1269 	MortSwashSubtablePtr = ^MortSwashSubtable;
1270 	MortSwashSubtable = record
1271 		lookup: SFNTLookupTable;
1272 	end;
1273 
1274 	MortInsertionSubtablePtr = ^MortInsertionSubtable;
1275 	MortInsertionSubtable = record
1276 		header: STHeader;
1277 	end;
1278 
1279 	MortSpecificSubtablePtr = ^MortSpecificSubtable;
1280 	MortSpecificSubtable = record
1281 		case SInt16 of
1282 		0: (
1283 			rearrangement:		MortRearrangementSubtable;
1284 			);
1285 		1: (
1286 			contextual:			MortContextualSubtable;
1287 			);
1288 		2: (
1289 			ligature:			MortLigatureSubtable;
1290 			);
1291 		3: (
1292 			swash:				MortSwashSubtable;
1293 			);
1294 		4: (
1295 			insertion:			MortInsertionSubtable;
1296 			);
1297 	end;
1298 
1299 	MortSubtablePtr = ^MortSubtable;
1300 	MortSubtable = record
1301 		length: UInt16;
1302 		coverage: UInt16;
1303 		flags: MortSubtableMaskFlags;
1304 		u: MortSpecificSubtable;
1305 	end;
1306 
1307 	MortFeatureEntryPtr = ^MortFeatureEntry;
1308 	MortFeatureEntry = record
1309 		featureType: UInt16;
1310 		featureSelector: UInt16;
1311 		enableFlags: MortSubtableMaskFlags;
1312 		disableFlags: MortSubtableMaskFlags;
1313 	end;
1314 
1315 	MortChainPtr = ^MortChain;
1316 	MortChain = record
1317 		defaultFlags: MortSubtableMaskFlags;        { default flags for this chain }
1318 		length: UInt32;                 { byte length of this chain }
1319 		nFeatures: UInt16;              { number of feature entries }
1320 		nSubtables: UInt16;             { number of subtables }
1321 		featureEntries: array[0..0] of MortFeatureEntry;
1322                                               { the subtables follow }
1323 	end;
1324 
1325 	MortTablePtr = ^MortTable;
1326 	MortTable = record
1327 		version: Fixed;
1328 		nChains: UInt32;
1329 		chains: array[0..0] of MortChain;
1330 	end;
1331 { --------------------------------------------------------------------------- }
1332 { FORMATS FOR TABLE: 'morx' (version 2 and beyond metamorphosis tables) }
1333 { CONSTANTS }
1334 const
1335 	kMORXTag = $6D6F7278; { 'morx' }
1336 	kMORXCurrentVersion = $00020000; { version number for current 'morx' table }
1337                                         { Coverage masks }
1338 	kMORXCoverVertical = $80000000;
1339 	kMORXCoverDescending = $40000000;
1340 	kMORXCoverIgnoreVertical = $20000000;
1341 	kMORXCoverTypeMask = $000000FF;
1342 
1343 { TYPES }
1344 type
1345 	MorxRearrangementSubtablePtr = ^MorxRearrangementSubtable;
1346 	MorxRearrangementSubtable = record
1347 		header: STXHeader;
1348 	end;
1349 
1350 	MorxContextualSubtablePtr = ^MorxContextualSubtable;
1351 	MorxContextualSubtable = record
1352 		header: STXHeader;
1353 		substitutionTableOffset: UInt32;
1354 	end;
1355 
1356 	MorxLigatureSubtablePtr = ^MorxLigatureSubtable;
1357 	MorxLigatureSubtable = record
1358 		header: STXHeader;
1359 		ligatureActionTableOffset: UInt32;
1360 		componentTableOffset: UInt32;
1361 		ligatureTableOffset: UInt32;
1362 	end;
1363 
1364 	MorxInsertionSubtablePtr = ^MorxInsertionSubtable;
1365 	MorxInsertionSubtable = record
1366 		header: STXHeader;
1367 		insertionGlyphTableOffset: UInt32;
1368 	end;
1369 
1370 	MorxSpecificSubtablePtr = ^MorxSpecificSubtable;
1371 	MorxSpecificSubtable = record
1372 		case SInt16 of
1373 		0: (
1374 			rearrangement:		MorxRearrangementSubtable;
1375 			);
1376 		1: (
1377 			contextual:			MorxContextualSubtable;
1378 			);
1379 		2: (
1380 			ligature:			MorxLigatureSubtable;
1381 			);
1382 		3: (
1383 			swash:				MortSwashSubtable;
1384 			);
1385 		4: (
1386 			insertion:			MorxInsertionSubtable;
1387 			);
1388 	end;
1389 
1390 	MorxSubtablePtr = ^MorxSubtable;
1391 	MorxSubtable = record
1392 		length: UInt32;
1393 		coverage: UInt32;
1394 		flags: MortSubtableMaskFlags;
1395 		u: MorxSpecificSubtable;
1396 	end;
1397 
1398 	MorxChainPtr = ^MorxChain;
1399 	MorxChain = record
1400 		defaultFlags: MortSubtableMaskFlags;        { default flags for this chain }
1401 		length: UInt32;                 { byte length of this chain }
1402 		nFeatures: UInt32;              { number of feature entries }
1403 		nSubtables: UInt32;             { number of subtables }
1404 		featureEntries: array[0..0] of MortFeatureEntry;
1405                                               { the subtables follow }
1406 	end;
1407 
1408 	MorxTablePtr = ^MorxTable;
1409 	MorxTable = record
1410 		version: Fixed;
1411 		nChains: UInt32;
1412 		chains: array[0..0] of MorxChain;
1413 	end;
1414 { --------------------------------------------------------------------------- }
1415 { FORMATS FOR TABLE: 'prop' }
1416 { CONSTANTS }
1417 const
1418 	kPROPTag = $70726F70; { 'prop' }
1419 	kPROPCurrentVersion = $00030000; { current version number for 'prop' table }
1420 	kPROPPairOffsetShift = 8;
1421 	kPROPPairOffsetSign = 7;
1422 	kPROPIsFloaterMask = $8000; { glyph is floater }
1423 	kPROPCanHangLTMask = $4000; { glyph can hang left/top }
1424 	kPROPCanHangRBMask = $2000; { glyph can hang right/bottom }
1425 	kPROPUseRLPairMask = $1000; { if glyph lands in RL streak, use paired glyph }
1426 	kPROPPairOffsetMask = $0F00; { 4-bit signed offset to other pair member }
1427 	kPROPRightConnectMask = $0080; { glyph connects to glyph on right }
1428 	kPROPZeroReserved = $0060; { must be zero }
1429 	kPROPDirectionMask = $001F; { direction bits }
1430 
1431 { These are the Unicode direction classes (plus the Special European Number class). }
1432 const
1433 	kPROPLDirectionClass = 0;    { Left-to-Right }
1434 	kPROPRDirectionClass = 1;    { Right-to-Left }
1435 	kPROPALDirectionClass = 2;    { Right-to-Left Arabic Letter }
1436 	kPROPENDirectionClass = 3;    { European Number }
1437 	kPROPESDirectionClass = 4;    { European Number Seperator }
1438 	kPROPETDirectionClass = 5;    { European Number Terminator }
1439 	kPROPANDirectionClass = 6;    { Arabic Number }
1440 	kPROPCSDirectionClass = 7;    { Common Number Seperator }
1441 	kPROPPSDirectionClass = 8;    { Paragraph Seperator (also referred to as Block Separator) }
1442 	kPROPSDirectionClass = 9;    { Segment Seperator }
1443 	kPROPWSDirectionClass = 10;   { Whitespace }
1444 	kPROPONDirectionClass = 11;   { Other Neutral }
1445 	kPROPSENDirectionClass = 12;   { Special European Number (not a Unicode class) }
1446 	kPROPLREDirectionClass = 13;   { Left-to-Right Embeding }
1447 	kPROPLRODirectionClass = 14;   { Left-to-Right Override }
1448 	kPROPRLEDirectionClass = 15;   { Right-to-Left Embeding }
1449 	kPROPRLODirectionClass = 16;   { Right-to-Left Override }
1450 	kPROPPDFDirectionClass = 17;   { Pop Directional Format }
1451 	kPROPNSMDirectionClass = 18;   { Non-Spacing Mark }
1452 	kPROPBNDirectionClass = 19;   { Boundary Neutral }
1453 	kPROPNumDirectionClasses = 20;    { Number of Unicode directional types + Special European Number }
1454 
1455 { TYPES }
1456 
1457 type
1458 	PropCharProperties = UInt16;
1459 	PropTablePtr = ^PropTable;
1460 	PropTable = record
1461 		version: Fixed;
1462 		format: UInt16;
1463 		defaultProps: PropCharProperties;
1464 		lookup: SFNTLookupTable;
1465 	end;
1466 
1467 	PropLookupSegmentPtr = ^PropLookupSegment;
1468 	PropLookupSegment = record
1469 		lastGlyph: UInt16;
1470 		firstGlyph: UInt16;
1471 		value: UInt16;
1472 	end;
1473 
1474 	PropLookupSinglePtr = ^PropLookupSingle;
1475 	PropLookupSingle = record
1476 		glyph: UInt16;
1477 		props: PropCharProperties;
1478 	end;
1479 { --------------------------------------------------------------------------- }
1480 { FORMATS FOR TABLE: 'trak' }
1481 { CONSTANTS }
1482 const
1483 	kTRAKTag = $7472616B; { 'trak' }
1484 	kTRAKCurrentVersion = $00010000; { current version number for 'trak' table }
1485 	kTRAKUniformFormat = 0;     {    kTRAKPerGlyphFormat         = 2}
1486 
1487 { TYPES }
1488 
1489 type
1490 	TrakValue = SInt16;
1491 	TrakTableEntryPtr = ^TrakTableEntry;
1492 	TrakTableEntry = record
1493 		track: Fixed;
1494 		nameTableIndex: UInt16;
1495 		sizesOffset: UInt16;            { offset to array of TrackingValues }
1496 	end;
1497 
1498 	TrakTableDataPtr = ^TrakTableData;
1499 	TrakTableData = record
1500 		nTracks: UInt16;
1501 		nSizes: UInt16;
1502 		sizeTableOffset: UInt32;
1503 		trakTable: array[0..0] of TrakTableEntry;
1504 	end;
1505 
1506 	TrakTablePtr = ^TrakTable;
1507 	TrakTable = record
1508 		version: Fixed;
1509 		format: UInt16;
1510 		horizOffset: UInt16;
1511 		vertOffset: UInt16;
1512 	end;
1513 { --------------------------------------------------------------------------- }
1514 { FORMATS FOR TABLE: 'kern' }
1515 { CONSTANTS }
1516 const
1517 	kKERNTag = $6B65726E; { 'kern' }
1518 	kKERNCurrentVersion = $00010000;
1519 	kKERNVertical = $8000; { set if this table has vertical kerning information }
1520 	kKERNResetCrossStream = $8000; { this value in a cross-stream table means reset to zero }
1521 	kKERNCrossStream = $4000; { set if this table contains cross-stream kerning values }
1522 	kKERNVariation = $2000; { set if this table contains variation kerning values }
1523 	kKERNUnusedBits = $1F00; { UNUSED, MUST BE ZERO }
1524 	kKERNFormatMask = $00FF; { format of this subtable }
1525 
1526 const
1527 	kKERNOrderedList = 0;    { ordered list of kerning pairs }
1528 	kKERNStateTable = 1;    { state table for n-way contextual kerning }
1529 	kKERNSimpleArray = 2;    { simple n X m array of kerning values }
1530 	kKERNIndexArray = 3;     { modifed version of SimpleArray }
1531 
1532 { Message Type Flags }
1533 const
1534 	kKERNLineStart = $00000001; { Array of glyphs starts a line }
1535 	kKERNLineEndKerning = $00000002; { Array of glyphs ends a line }
1536 	kKERNNoCrossKerning = $00000004; { Prohibit cross kerning }
1537 	kKERNNotesRequested = $00000008; { Caller wants kerning notes }
1538 	kKERNNoStakeNote = 1;    { Indicates a glyph was involved in a kerning pair/group }
1539 	kKERNCrossStreamResetNote = 2;    { Indicates a return-to-baseline in cross-stream kerning }
1540 	kKERNNotApplied = $00000001; { All kerning values were zero, kerning call had no effect }
1541 
1542 { TYPES }
1543 
1544 type
1545 	KernTableFormat = UInt8;
1546 	KernSubtableInfo = UInt16;
1547 	KernKerningValue = SInt16;
1548 	KernArrayOffset = UInt16;
1549 { header for version 0 kerning table }
1550 
1551 	KernVersion0HeaderPtr = ^KernVersion0Header;
1552 	KernVersion0Header = record
1553 		version: UInt16;                { font version number (will be 0!) }
1554 		nTables: UInt16;                { number of subtables present }
1555 		firstSubtable: array[0..0] of UInt16;       { first subtable starts here }
1556 	end;
1557 
1558 	KernTableHeaderPtr = ^KernTableHeader;
1559 	KernTableHeader = record
1560 		version: Fixed;                { font version number (currently 1.0) }
1561 		nTables: SInt32;                { number of subtables present }
1562 		firstSubtable: array[0..0] of UInt16;       { first subtable starts here }
1563 	end;
1564 	KernTableHeaderHandle = ^KernTableHeaderPtr;
1565 {
1566     F O R M A T   S P E C I F I C   D E F I N I T I O N S
1567 
1568     kernOrderedList:
1569 
1570     The table is a sorted list of [left glyph, right glyph, value] triples.
1571     There's enough information in the header so that the list can be
1572     efficiently binary searched.
1573 }
1574 { defines a single kerning pair of Glyphcodes  }
1575 	KernKerningPairPtr = ^KernKerningPair;
1576 	KernKerningPair = record
1577 		left: UInt16;
1578 		right: UInt16;
1579 	end;
1580 { a single list entry }
1581 
1582 	KernOrderedListEntryPtr = ^KernOrderedListEntry;
1583 	KernOrderedListEntry = record
1584 		pair: KernKerningPair;                   { the kerning pair }
1585 		value: KernKerningValue;                  { the kerning value for the above pair }
1586 	end;
1587 
1588 { the header information for binary searching the list }
1589 	KernOrderedListHeaderPtr = ^KernOrderedListHeader;
1590 	KernOrderedListHeader = record
1591 		nPairs: UInt16;                 { number of kerning pairs in table }
1592 		searchRange: UInt16;            { (largest power of two <= nPairs) * entry size }
1593 		entrySelector: UInt16;          { log2 (largest power of two <= nPairs) }
1594 		rangeShift: UInt16;             { (nPairs - largest power of two <= nPairs) * entry size }
1595 		table: array[0..0] of UInt16;               { entries are first glyph, second glyph, and value }
1596 	end;
1597 { KernStateTable: like the the generic state tables }
1598 	KernStateHeaderPtr = ^KernStateHeader;
1599 	KernStateHeader = record
1600 		header: STHeader;                 { state table header }
1601 		valueTable: UInt16;             { offset to kerning value table }
1602 		firstTable: array[0..0] of UInt8;          { first table starts here }
1603 	end;
1604 
1605 	KernStateEntryPtr = ^KernStateEntry;
1606 	KernStateEntry = record
1607 		newState: UInt16;
1608 		flags: UInt16;                  { flags per above enum }
1609 	end;
1610 {
1611     Kern offset table header.
1612     The offset table is a trimmed array from firstGlyph to limitGlyph.
1613     Glyphs outside of this range should get zero for right-hand glyphs
1614     and the offset of the beginning of the kerning array for left-hand glyphs.
1615 }
1616 
1617 	KernOffsetTable = record
1618 		firstGlyph: UInt16;             { first glyph in class range }
1619 		nGlyphs: UInt16;                { number of glyphs in class range }
1620 		offsetTable: array[0..0] of KernArrayOffset;         { offset table starts here }
1621 	end;
1622 	KernOffsetTablePtr = ^KernOffsetTable;
1623 { Header information for accessing offset tables and kerning array }
1624 {
1625     KernSimpleArray:
1626 
1627     The array is an nXm array of kenring values. Each row in the array
1628     represents one left-hand glyph, and each column one right-hand glyph.
1629     The zeroth row and column always represent glyphs that are out of bounds
1630     and will always contain zero.
1631 
1632     A pair is looked up by indexing the left-hand glyph through the left
1633     offset table, the right-hand glyph through the right offset table,
1634     adding both offsets to the starting address of the kerning array,
1635     and fetching the kerning value pointed to.
1636 }
1637 { Kern offset table header. }
1638 { The offset table is a trimmed array from firstGlyph to limitGlyph. }
1639 { Glyphs outside of this range should get zero for right-hand glyphs }
1640 { and the offset of the beginning of the kerning array for left- }
1641 { hand glyphs. }
1642 type
1643 	KernSimpleArrayHeaderPtr = ^KernSimpleArrayHeader;
1644 	KernSimpleArrayHeader = record
1645 		rowWidth: UInt16;               { width, in bytes, of a row in the table }
1646 		leftOffsetTable: UInt16;        { offset to left-hand offset table }
1647 		rightOffsetTable: UInt16;       { offset to right-hand offset table }
1648 		theArray: KernArrayOffset;               { offset to start of kerning array }
1649 		firstTable: array[0..0] of UInt16;          { first offset table starts here... }
1650 	end;
1651 { Index Array }
1652 
1653 	KernIndexArrayHeaderPtr = ^KernIndexArrayHeader;
1654 	KernIndexArrayHeader = record
1655 		glyphCount: UInt16;
1656 		kernValueCount: UInt8;
1657 		leftClassCount: UInt8;
1658 		rightClassCount: UInt8;
1659 		flags: UInt8;                  { set to 0 for now }
1660 		kernValue: array[0..0] of SInt16;           { actual kerning values reference by index in kernIndex }
1661 		leftClass: array[0..0] of UInt8;           { maps left glyph to offset into kern index }
1662 		rightClass: array[0..0] of UInt8;          { maps right glyph to offset into kern index }
1663 		kernIndex: array[0..0] of UInt8;           { contains indicies into kernValue }
1664 	end;
1665 { format specific part of subtable header }
1666 	KernFormatSpecificHeaderPtr = ^KernFormatSpecificHeader;
1667 	KernFormatSpecificHeader = record
1668 		case SInt16 of
1669 		0: (
1670 			orderedList:		KernOrderedListHeader;
1671 			);
1672 		1: (
1673 			stateTable:			KernStateHeader;
1674 			);
1675 		2: (
1676 			simpleArray:		KernSimpleArrayHeader;
1677 			);
1678 		3: (
1679 			indexArray:			KernIndexArrayHeader;
1680 			);
1681 	end;
1682 { version 0 subtable header }
1683 
1684 	KernVersion0SubtableHeaderPtr = ^KernVersion0SubtableHeader;
1685 	KernVersion0SubtableHeader = record
1686 		version: UInt16;                { kerning table version number }
1687 		length: UInt16;                 { length in bytes (including this header) }
1688 		stInfo: KernSubtableInfo;                 { sub-table info }
1689 		fsHeader: KernFormatSpecificHeader;         { format specific sub-header }
1690 	end;
1691 { Overall Subtable header format }
1692 type
1693 	KernSubtableHeader = record
1694 		length: SInt32;                 { length in bytes (including this header) }
1695 		stInfo: KernSubtableInfo;                 { subtable info }
1696 		tupleIndex: SInt16;             { tuple index for variation subtables }
1697 		fsHeader: KernFormatSpecificHeader;         { format specific sub-header }
1698 	end;
1699 	KernSubtableHeaderPtr = ^KernSubtableHeader;
1700 { --------------------------------------------------------------------------- }
1701 { FORMATS FOR TABLE: 'kerx' }
1702 { CONSTANTS }
1703 const
1704 	kKERXTag = $6B657278; { 'kerx' }
1705 	kKERXCurrentVersion = $00020000;
1706 	kKERXVertical = $80000000; { set if this table has vertical kerning information }
1707 	kKERXResetCrossStream = $8000; { this value in a cross-stream table means reset to zero }
1708 	kKERXCrossStream = $40000000; { set if this table contains cross-stream kerning values }
1709 	kKERXVariation = $20000000; { set if this table contains variation kerning values }
1710 	kKERXUnusedBits = $1FFFFF00; { UNUSED, MUST BE ZERO }
1711 	kKERXFormatMask = $000000FF; { format of this subtable }
1712 
1713 const
1714 	kKERXOrderedList = 0;    { ordered list of kerning pairs }
1715 	kKERXStateTable = 1;    { state table for n-way contextual kerning }
1716 	kKERXSimpleArray = 2;    { simple n X m array of kerning values }
1717 	kKERXIndexArray = 3;    { modifed version of SimpleArray }
1718 	kKERXControlPoint = 4;     { state table for control point positioning }
1719 
1720 { Message Type Flags }
1721 const
1722 	kKERXLineStart = $00000001; { Array of glyphs starts a line }
1723 	kKERXLineEndKerning = $00000002; { Array of glyphs ends a line }
1724 	kKERXNoCrossKerning = $00000004; { Prohibit cross kerning }
1725 	kKERXNotesRequested = $00000008; { Caller wants kerning notes }
1726 	kKERXNoStakeNote = 1;    { Indicates a glyph was involved in a kerning pair/group }
1727 	kKERXCrossStreamResetNote = 2;    { Indicates a return-to-baseline in cross-stream kerning }
1728 	kKERXNotApplied = $00000001; { All kerning values were zero, kerning call had no effect }
1729 
1730 { Flags in KerxControlPointHeader }
1731 const
1732 	kKERXActionTypeMask = 3 shl 30; { Mask to extract action type }
1733 	kKERXActionTypeControlPoints = 0 shl 30; { Actions have control point numbers }
1734 	kKERXActionTypeAnchorPoints = 1 shl 30; { Actions have anchor point numbers }
1735 	kKERXActionTypeCoordinates = 2 shl 30; { Actions have control point coordinates }
1736 	kKERXUnusedFlags = $3F000000; { Unused, must be zero }
1737 	kKERXActionOffsetMask = $00FFFFFF; { Mask to extract offset to action table }
1738 
1739 { TYPES }
1740 type
1741 	KerxSubtableCoverage = UInt32;
1742 	KerxArrayOffset = UInt32;
1743 { Header for an extended kerning table }
1744 type
1745 	KerxTableHeader = record
1746 		version: Fixed;                { font version number (currently 1.0) }
1747 		nTables: UInt32;                { number of subtables present }
1748 		firstSubtable: array [0..1-1] of UInt32;       { first subtable starts here }
1749 	end;
1750 	KerxTableHeaderPtr = ^KerxTableHeader;
1751 type
1752 	KerxTableHeaderHandle = ^KerxTableHeaderPtr;
1753 {
1754  F O R M A T   S P E C I F I C   D E F I N I T I O N S
1755 
1756  kerxOrderedList:
1757 
1758  The table is a sorted list of [left glyph, right glyph, value] triples.
1759  There's enough information in the header so that the list can be
1760  efficiently binary searched.
1761  }
1762 { defines a single kerning pair of Glyphcodes  }
1763 type
1764 	KerxKerningPair = record
1765 		left: UInt16;
1766 		right: UInt16;
1767 	end;
1768 { a single list entry }
1769 type
1770 	KerxOrderedListEntry = record
1771 		pair: KerxKerningPair;                   { the kerning pair }
1772 		value: KernKerningValue;                  { the kerning value for the above pair }
1773 	end;
1774 	KerxOrderedListEntryPtr = ^KerxOrderedListEntry;
1775 { the header information for binary searching the list }
1776 type
1777 	KerxOrderedListHeader = record
1778 		nPairs: UInt32;                 { number of kerning pairs in table }
1779 		searchRange: UInt32;            { (largest power of two <= nPairs) * entry size }
1780 		entrySelector: UInt32;          { log2 (largest power of two <= nPairs) }
1781 		rangeShift: UInt32;             { (nPairs - largest power of two <= nPairs) * entry size }
1782 		table: array [0..1-1] of UInt32;               { entries are first glyph, second glyph, and value }
1783 	end;
1784 { KernStateTable: like the the generic state tables }
1785 type
1786 	KerxStateHeader = record
1787 		header: STXHeader;                 { state table header }
1788 		valueTable: UInt32;             { offset to kerning value table }
1789 		firstTable: array [0..1-1] of UInt8;          { first table starts here }
1790 	end;
1791 type
1792 	KerxStateEntry = record
1793 		newState: UInt16;
1794 		flags: UInt16;                  { flags per above enum }
1795 		valueIndex: UInt16;
1796 	end;
1797 { KerxControlPointTable: like the the generic state tables }
1798 type
1799 	KerxControlPointHeader = record
1800 		header: STXHeader;                 { state table header }
1801 		flags: UInt32;                  { flags }
1802 		firstTable: array [0..1-1] of UInt8;          { first table starts here }
1803 	end;
1804 type
1805 	KerxControlPointEntry = record
1806 		newState: UInt16;
1807 		flags: UInt16;                  { flags per above enum }
1808 		actionIndex: UInt16;
1809 	end;
1810 type
1811 	KerxControlPointAction = record
1812 		markControlPoint: UInt16;
1813 		currControlPoint: UInt16;
1814 	end;
1815 type
1816 	KerxAnchorPointAction = record
1817 		markAnchorPoint: UInt16;
1818 		currAnchorPoint: UInt16;
1819 	end;
1820 type
1821 	KerxCoordinateAction = record
1822 		markX: UInt16;
1823 		markY: UInt16;
1824 		currX: UInt16;
1825 		currY: UInt16;
1826 	end;
1827 {
1828  Kern offset table header.
1829  The offset table is a trimmed array from firstGlyph to limitGlyph.
1830  Glyphs outside of this range should get zero for right-hand glyphs
1831  and the offset of the beginning of the kerning array for left-hand glyphs.
1832  }
1833 type
1834 	KerxOffsetTable = record
1835 		firstGlyph: UInt16;             { first glyph in class range }
1836 		nGlyphs: UInt16;                { number of glyphs in class range }
1837 		offsetTable: array [0..1-1] of KerxArrayOffset;         { offset table starts here }
1838 	end;
1839 	KerxOffsetTablePtr = ^KerxOffsetTable;
1840 { Header information for accessing offset tables and kerning array }
1841 {
1842  KerxSimpleArray:
1843 
1844  The array is an nXm array of kenring values. Each row in the array
1845  represents one left-hand glyph, and each column one right-hand glyph.
1846  The zeroth row and column always represent glyphs that are out of bounds
1847  and will always contain zero.
1848 
1849  A pair is looked up by indexing the left-hand glyph through the left
1850  offset table, the right-hand glyph through the right offset table,
1851  adding both offsets to the starting address of the kerning array,
1852  and fetching the kerning value pointed to.
1853  }
1854 { Kern offset table header. }
1855 { The offset table is a trimmed array from firstGlyph to limitGlyph. }
1856 { Glyphs outside of this range should get zero for right-hand glyphs }
1857 { and the offset of the beginning of the kerning array for left- }
1858 { hand glyphs. }
1859 type
1860 	KerxSimpleArrayHeader = record
1861 		rowWidth: UInt32;               { width, in bytes, of a row in the table }
1862 		leftOffsetTable: UInt32;        { offset to left-hand offset table }
1863 		rightOffsetTable: UInt32;       { offset to right-hand offset table }
1864 		theArray: KerxArrayOffset;               { offset to start of kerning array }
1865 		firstTable: array [0..1-1] of UInt32;          { first offset table starts here... }
1866 	end;
1867 { Index Array }
1868 type
1869 	KerxIndexArrayHeader = record
1870 		glyphCount: UInt16;
1871 		kernValueCount: UInt16;
1872 		leftClassCount: UInt16;
1873 		rightClassCount: UInt16;
1874 		flags: UInt16;                  { set to 0 for now }
1875 		kernValue: array [0..1-1] of SInt16;           { actual kerning values reference by index in kernIndex }
1876 		leftClass: array [0..1-1] of UInt16;           { maps left glyph to offset into kern index }
1877 		rightClass: array [0..1-1] of UInt16;          { maps right glyph to offset into kern index }
1878 		kernIndex: array [0..1-1] of UInt16;           { contains indicies into kernValue }
1879 	end;
1880 { format specific part of subtable header }
1881 type
1882   KerxFormatSpecificHeader = record
1883     case SInt16 of
1884       0: (
1885         orderedList: KerxOrderedListHeader;
1886         );
1887       1: (
1888         stateTable: KerxStateHeader;
1889         );
1890       2: (
1891         simpleArray: KerxSimpleArrayHeader;
1892         );
1893       3: (
1894         indexArray: KerxIndexArrayHeader;
1895         );
1896       4: (
1897         controlPoint: KerxControlPointHeader;
1898         );
1899   end;
1900   KerxFormatSpecificHeaderPtr = ^KerxFormatSpecificHeader;
1901 
1902 { Overall Subtable header format }
1903 type
1904 	KerxSubtableHeader = record
1905 		length: UInt32;                 { length in bytes (including this header) }
1906 		stInfo: KerxSubtableCoverage;               { subtable converage }
1907 		tupleIndex: UInt32;             { tuple index for variation subtables }
1908 		fsHeader: KerxFormatSpecificHeader;         { format specific sub-header }
1909 	end;
1910 	KerxSubtableHeaderPtr = ^KerxSubtableHeader;
1911 { --------------------------------------------------------------------------- }
1912 { FORMATS FOR TABLE: 'bsln' }
1913 { CONSTANTS }
1914 const
1915 	kBSLNTag = $62736C6E; { 'bsln' }
1916 	kBSLNCurrentVersion = $00010000; { current version number for 'bsln' table }
1917 	kBSLNDistanceFormatNoMap = 0;
1918 	kBSLNDistanceFormatWithMap = 1;
1919 	kBSLNControlPointFormatNoMap = 2;
1920 	kBSLNControlPointFormatWithMap = 3;
1921 
1922 { Baseline classes and constants }
1923 const
1924 	kBSLNRomanBaseline = 0;
1925 	kBSLNIdeographicCenterBaseline = 1;
1926 	kBSLNIdeographicLowBaseline = 2;
1927 	kBSLNHangingBaseline = 3;
1928 	kBSLNMathBaseline = 4;
1929 	kBSLNLastBaseline = 31;
1930 	kBSLNNumBaselineClasses = kBSLNLastBaseline + 1;
1931 	kBSLNNoBaselineOverride = 255;
1932 
1933 { TYPES }
1934 type
1935 	BslnBaselineClass = UInt32;
1936 	BslnBaselineClassPtr = ^BslnBaselineClass;
1937 
1938 { The BslnBaselineRecord array defines the baseline deltas for the line. }
1939 	BslnBaselineRecord = array[0..31] of Fixed;
1940 	BslnBaselineRecordPtr = ^BslnBaselineRecord;
1941 {
1942     BslnFormat0Part is the format-specific data for a distance table with no mapping (i.e.
1943     all the glyphs belong to the defaultBaseline).
1944 }
1945 
1946 	BslnFormat0PartPtr = ^BslnFormat0Part;
1947 	BslnFormat0Part = record
1948 		deltas: array[0..31] of SInt16;
1949 	end;
1950 { BslnFormat1Part is the format-specific data for a distance table with a gxMapping. }
1951 	BslnFormat1PartPtr = ^BslnFormat1Part;
1952 	BslnFormat1Part = record
1953 		deltas: array[0..31] of SInt16;
1954 		mappingData: SFNTLookupTable;
1955 	end;
1956 {
1957     BslnFormat2Part is the format-specific data for a control-point table with no
1958     mapping (i.e. all the glyphs belong to the defaultBaseline). It specifies a single
1959     glyph to use and the set of control points in that glyph that designate each of
1960     the baselines.
1961 }
1962 	BslnFormat2PartPtr = ^BslnFormat2Part;
1963 	BslnFormat2Part = record
1964 		stdGlyph: UInt16;
1965 		ctlPoints: array[0..31] of SInt16;
1966 	end;
1967 {
1968     BslnFormat3Part is the format-specific data for a distance table with a mapping. Like
1969     format 2, it contains a single glyph and its set of control-point values for each
1970     of the baselines.
1971 }
1972 
1973 	BslnFormat3PartPtr = ^BslnFormat3Part;
1974 	BslnFormat3Part = record
1975 		stdGlyph: UInt16;
1976 		ctlPoints: array[0..31] of SInt16;
1977 		mappingData: SFNTLookupTable;
1978 	end;
1979 { The BslnFormatUnion is a union containing the format-specific parts of the baseline table. }
1980 	BslnFormatUnionPtr = ^BslnFormatUnion;
1981 	BslnFormatUnion = record
1982 		case SInt16 of
1983 		0: (
1984 			fmt0Part:			BslnFormat0Part;
1985 			);
1986 		1: (
1987 			fmt1Part:			BslnFormat1Part;
1988 			);
1989 		2: (
1990 			fmt2Part:			BslnFormat2Part;
1991 			);
1992 		3: (
1993 			fmt3Part:			BslnFormat3Part;
1994 			);
1995 	end;
1996 
1997 { The table format used in BaselineTable }
1998 
1999 	BslnTableFormat = UInt16;
2000 { BaselineTable defines the top-level format of the baseline table in the font. }
2001 
2002 	BslnTablePtr = ^BslnTable;
2003 	BslnTable = record
2004 		version: Fixed;
2005 		format: BslnTableFormat;
2006 		defaultBaseline: UInt16;
2007 		parts: BslnFormatUnion;
2008 	end;
2009 
2010 { --------------------------------------------------------------------------- }
2011 { FORMATS FOR TABLE: 'ALMX' }
2012 { TYPES }
2013 	ALMXHeaderPtr = ^ALMXHeader;
2014 	ALMXHeader = record
2015 		Version: Fixed;                { 16.16 format 1.0 by default }
2016 		Flags: UInt16;
2017 		NMasters: UInt16;
2018 		FirstGlyph: UInt16;
2019 		LastGlyph: UInt16;
2020 
2021 		lookup: SFNTLookupTable;                 { lookup table }
2022 	end;
2023 
2024 	ALMXGlyphEntryPtr = ^ALMXGlyphEntry;
2025 	ALMXGlyphEntry = record
2026 { lookup data for ALMX table }
2027 		GlyphIndexOffset: SInt16;
2028 		HorizontalAdvance: SInt16;
2029 		XOffsetToHOrigin: SInt16;
2030 		VerticalAdvance: SInt16;
2031 		YOffsetToVOrigin: SInt16;
2032 	end;
2033 { --------------------------------------------------------------------------- }
2034 { FORMATS FOR TABLE: 'ROTA' }
2035 { TYPES }
2036 	ROTAHeaderPtr = ^ROTAHeader;
2037 	ROTAHeader = record
2038 		Version: Fixed;                { 16.16 format 1.0 by default }
2039 		Flags: UInt16;
2040 		NMasters: UInt16;
2041 		FirstGlyph: UInt16;
2042 		LastGlyph: UInt16;
2043 
2044 		lookup: SFNTLookupTable;                 { lookup table }
2045 	end;
2046 
2047 	ROTAGlyphEntryPtr = ^ROTAGlyphEntry;
2048 	ROTAGlyphEntry = record
2049 { lookup data for ROTA table }
2050 		GlyphIndexOffset: SInt16;
2051 		HBaselineOffset: SInt16;        { y offset to the rotated horizontal baseline }
2052 		VBaselineOffset: SInt16;        { x offset to the rotated vertical baseline }
2053 	end;
2054 { --------------------------------------------------------------------------- }
2055 { FORMATS FOR TABLE 'ankr' }
2056 { CONSTANTS }
2057 const
2058 	kANKRCurrentVersion = 0;
2059 
2060 { TYPES }
2061 type
2062 	AnchorPoint = record
2063 		x: SInt16;                     { x coordinate of anchor point }
2064 		y: SInt16;                     { y coordinate of anchor point }
2065 	end;
2066 
2067 type
2068 	AnchorPointTable = record
2069 		nPoints: UInt32;                { number of anchor points defined for this glyph }
2070 		points: array [0..1-1] of AnchorPoint;              { first anchor point starts here }
2071 	end;
2072 
2073 type
2074 	AnkrTable = record
2075 		version: UInt16;                { 1 }
2076 		flags: UInt16;                  { never leave home without them (see 'Zapf') }
2077 		lookupTableOffset: UInt32;      { Byte offset to lookup table mapping glyphs to offset into anchor point table }
2078 		anchorPointTableOffset: UInt32; { Byte offset to start of anchor point table }
2079 	end;
2080 { --------------------------------------------------------------------------- }
2081 
2082 {$endc} {TARGET_OS_MAC}
2083 {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
2084 
2085 end.
2086 {$endc} {not MACOSALLINCLUDE}
2087