SFNTLayoutTypes.pas 45 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544
  1. {
  2. File: SFNTLayoutTypes.p
  3. Contains: SFNT file layout structures and constants.
  4. Version: Technology: Mac OS 9 / Carbon
  5. Release: Universal Interfaces 3.4.2
  6. Copyright: © 1994-2002 by Apple Computer, Inc., all rights reserved.
  7. Bugs?: For bug reports, consult the following page on
  8. the World Wide Web:
  9. http://www.freepascal.org/bugs.html
  10. }
  11. {
  12. Modified for use with Free Pascal
  13. Version 210
  14. Please report any bugs to <[email protected]>
  15. }
  16. {$mode macpas}
  17. {$packenum 1}
  18. {$macro on}
  19. {$inline on}
  20. {$calling mwpascal}
  21. unit SFNTLayoutTypes;
  22. interface
  23. {$setc UNIVERSAL_INTERFACES_VERSION := $0342}
  24. {$setc GAP_INTERFACES_VERSION := $0210}
  25. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  26. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  27. {$endc}
  28. {$ifc defined CPUPOWERPC and defined CPUI386}
  29. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  30. {$endc}
  31. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  32. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  33. {$endc}
  34. {$ifc not defined __ppc__ and defined CPUPOWERPC}
  35. {$setc __ppc__ := 1}
  36. {$elsec}
  37. {$setc __ppc__ := 0}
  38. {$endc}
  39. {$ifc not defined __i386__ and defined CPUI386}
  40. {$setc __i386__ := 1}
  41. {$elsec}
  42. {$setc __i386__ := 0}
  43. {$endc}
  44. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  45. {$error Conflicting definitions for __ppc__ and __i386__}
  46. {$endc}
  47. {$ifc defined __ppc__ and __ppc__}
  48. {$setc TARGET_CPU_PPC := TRUE}
  49. {$setc TARGET_CPU_X86 := FALSE}
  50. {$elifc defined __i386__ and __i386__}
  51. {$setc TARGET_CPU_PPC := FALSE}
  52. {$setc TARGET_CPU_X86 := TRUE}
  53. {$elsec}
  54. {$error Neither __ppc__ nor __i386__ is defined.}
  55. {$endc}
  56. {$setc TARGET_CPU_PPC_64 := FALSE}
  57. {$ifc defined FPC_BIG_ENDIAN}
  58. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  59. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  60. {$elifc defined FPC_LITTLE_ENDIAN}
  61. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  62. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  63. {$elsec}
  64. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  65. {$endc}
  66. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  67. {$setc CALL_NOT_IN_CARBON := FALSE}
  68. {$setc OLDROUTINENAMES := FALSE}
  69. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  70. {$setc OPAQUE_UPP_TYPES := TRUE}
  71. {$setc OTCARBONAPPLICATION := TRUE}
  72. {$setc OTKERNEL := FALSE}
  73. {$setc PM_USE_SESSION_APIS := TRUE}
  74. {$setc TARGET_API_MAC_CARBON := TRUE}
  75. {$setc TARGET_API_MAC_OS8 := FALSE}
  76. {$setc TARGET_API_MAC_OSX := TRUE}
  77. {$setc TARGET_CARBON := TRUE}
  78. {$setc TARGET_CPU_68K := FALSE}
  79. {$setc TARGET_CPU_MIPS := FALSE}
  80. {$setc TARGET_CPU_SPARC := FALSE}
  81. {$setc TARGET_OS_MAC := TRUE}
  82. {$setc TARGET_OS_UNIX := FALSE}
  83. {$setc TARGET_OS_WIN32 := FALSE}
  84. {$setc TARGET_RT_MAC_68881 := FALSE}
  85. {$setc TARGET_RT_MAC_CFM := FALSE}
  86. {$setc TARGET_RT_MAC_MACHO := TRUE}
  87. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  88. {$setc TYPE_BOOL := FALSE}
  89. {$setc TYPE_EXTENDED := FALSE}
  90. {$setc TYPE_LONGLONG := TRUE}
  91. uses MacTypes;
  92. {$ALIGN MAC68K}
  93. { ----------------------------------------------------------------------------------------- }
  94. { CONSTANTS }
  95. {
  96. The following values can be used to set run feature values. Note that unless the
  97. feature is defaulted differently in different fonts, the zero value for the
  98. selectors represents the default value. Check the following URL site for further info:
  99. "http://fonts.apple.com/Registry"
  100. }
  101. {
  102. * Summary:
  103. * Feature types
  104. }
  105. const
  106. kAllTypographicFeaturesType = 0;
  107. kLigaturesType = 1;
  108. kCursiveConnectionType = 2;
  109. kLetterCaseType = 3;
  110. kVerticalSubstitutionType = 4;
  111. kLinguisticRearrangementType = 5;
  112. kNumberSpacingType = 6;
  113. kSmartSwashType = 8;
  114. kDiacriticsType = 9;
  115. kVerticalPositionType = 10;
  116. kFractionsType = 11;
  117. kOverlappingCharactersType = 13;
  118. kTypographicExtrasType = 14;
  119. kMathematicalExtrasType = 15;
  120. kOrnamentSetsType = 16;
  121. kCharacterAlternativesType = 17;
  122. kDesignComplexityType = 18;
  123. kStyleOptionsType = 19;
  124. kCharacterShapeType = 20;
  125. kNumberCaseType = 21;
  126. kTextSpacingType = 22;
  127. kTransliterationType = 23;
  128. kAnnotationType = 24;
  129. kKanaSpacingType = 25;
  130. kIdeographicSpacingType = 26;
  131. kUnicodeDecompositionType = 27;
  132. kRubyKanaType = 28;
  133. kCJKSymbolAlternativesType = 29;
  134. kIdeographicAlternativesType = 30;
  135. kCJKVerticalRomanPlacementType = 31;
  136. kItalicCJKRomanType = 32;
  137. kCJKRomanSpacingType = 103;
  138. kLastFeatureType = -1;
  139. {
  140. * Summary:
  141. * Selectors for feature type kAllTypographicFeaturesType
  142. }
  143. kAllTypeFeaturesOnSelector = 0;
  144. kAllTypeFeaturesOffSelector = 1;
  145. {
  146. * Summary:
  147. * Selectors for feature type kLigaturesType
  148. }
  149. kRequiredLigaturesOnSelector = 0;
  150. kRequiredLigaturesOffSelector = 1;
  151. kCommonLigaturesOnSelector = 2;
  152. kCommonLigaturesOffSelector = 3;
  153. kRareLigaturesOnSelector = 4;
  154. kRareLigaturesOffSelector = 5;
  155. kLogosOnSelector = 6;
  156. kLogosOffSelector = 7;
  157. kRebusPicturesOnSelector = 8;
  158. kRebusPicturesOffSelector = 9;
  159. kDiphthongLigaturesOnSelector = 10;
  160. kDiphthongLigaturesOffSelector = 11;
  161. kSquaredLigaturesOnSelector = 12;
  162. kSquaredLigaturesOffSelector = 13;
  163. kAbbrevSquaredLigaturesOnSelector = 14;
  164. kAbbrevSquaredLigaturesOffSelector = 15;
  165. kSymbolLigaturesOnSelector = 16;
  166. kSymbolLigaturesOffSelector = 17;
  167. {
  168. * Summary:
  169. * Selectors for feature type kCursiveConnectionType
  170. }
  171. kUnconnectedSelector = 0;
  172. kPartiallyConnectedSelector = 1;
  173. kCursiveSelector = 2;
  174. {
  175. * Summary:
  176. * Selectors for feature type kLetterCaseType
  177. }
  178. kUpperAndLowerCaseSelector = 0;
  179. kAllCapsSelector = 1;
  180. kAllLowerCaseSelector = 2;
  181. kSmallCapsSelector = 3;
  182. kInitialCapsSelector = 4;
  183. kInitialCapsAndSmallCapsSelector = 5;
  184. {
  185. * Summary:
  186. * Selectors for feature type kVerticalSubstitutionType
  187. }
  188. kSubstituteVerticalFormsOnSelector = 0;
  189. kSubstituteVerticalFormsOffSelector = 1;
  190. {
  191. * Summary:
  192. * Selectors for feature type kLinguisticRearrangementType
  193. }
  194. kLinguisticRearrangementOnSelector = 0;
  195. kLinguisticRearrangementOffSelector = 1;
  196. {
  197. * Summary:
  198. * Selectors for feature type kNumberSpacingType
  199. }
  200. kMonospacedNumbersSelector = 0;
  201. kProportionalNumbersSelector = 1;
  202. kThirdWidthNumbersSelector = 2;
  203. kQuarterWidthNumbersSelector = 3;
  204. {
  205. * Summary:
  206. * Selectors for feature type kSmartSwashType
  207. }
  208. kWordInitialSwashesOnSelector = 0;
  209. kWordInitialSwashesOffSelector = 1;
  210. kWordFinalSwashesOnSelector = 2;
  211. kWordFinalSwashesOffSelector = 3;
  212. kLineInitialSwashesOnSelector = 4;
  213. kLineInitialSwashesOffSelector = 5;
  214. kLineFinalSwashesOnSelector = 6;
  215. kLineFinalSwashesOffSelector = 7;
  216. kNonFinalSwashesOnSelector = 8;
  217. kNonFinalSwashesOffSelector = 9;
  218. {
  219. * Summary:
  220. * Selectors for feature type kDiacriticsType
  221. }
  222. kShowDiacriticsSelector = 0;
  223. kHideDiacriticsSelector = 1;
  224. kDecomposeDiacriticsSelector = 2;
  225. {
  226. * Summary:
  227. * Selectors for feature type kVerticalPositionType
  228. }
  229. kNormalPositionSelector = 0;
  230. kSuperiorsSelector = 1;
  231. kInferiorsSelector = 2;
  232. kOrdinalsSelector = 3;
  233. {
  234. * Summary:
  235. * Selectors for feature type kFractionsType
  236. }
  237. kNoFractionsSelector = 0;
  238. kVerticalFractionsSelector = 1;
  239. kDiagonalFractionsSelector = 2;
  240. {
  241. * Summary:
  242. * Selectors for feature type kOverlappingCharactersType
  243. }
  244. kPreventOverlapOnSelector = 0;
  245. kPreventOverlapOffSelector = 1;
  246. {
  247. * Summary:
  248. * Selectors for feature type kTypographicExtrasType
  249. }
  250. kHyphensToEmDashOnSelector = 0;
  251. kHyphensToEmDashOffSelector = 1;
  252. kHyphenToEnDashOnSelector = 2;
  253. kHyphenToEnDashOffSelector = 3;
  254. kSlashedZeroOnSelector = 4;
  255. kSlashedZeroOffSelector = 5;
  256. kFormInterrobangOnSelector = 6;
  257. kFormInterrobangOffSelector = 7;
  258. kSmartQuotesOnSelector = 8;
  259. kSmartQuotesOffSelector = 9;
  260. kPeriodsToEllipsisOnSelector = 10;
  261. kPeriodsToEllipsisOffSelector = 11;
  262. {
  263. * Summary:
  264. * Selectors for feature type kMathematicalExtrasType
  265. }
  266. kHyphenToMinusOnSelector = 0;
  267. kHyphenToMinusOffSelector = 1;
  268. kAsteriskToMultiplyOnSelector = 2;
  269. kAsteriskToMultiplyOffSelector = 3;
  270. kSlashToDivideOnSelector = 4;
  271. kSlashToDivideOffSelector = 5;
  272. kInequalityLigaturesOnSelector = 6;
  273. kInequalityLigaturesOffSelector = 7;
  274. kExponentsOnSelector = 8;
  275. kExponentsOffSelector = 9;
  276. {
  277. * Summary:
  278. * Selectors for feature type kOrnamentSetsType
  279. }
  280. kNoOrnamentsSelector = 0;
  281. kDingbatsSelector = 1;
  282. kPiCharactersSelector = 2;
  283. kFleuronsSelector = 3;
  284. kDecorativeBordersSelector = 4;
  285. kInternationalSymbolsSelector = 5;
  286. kMathSymbolsSelector = 6;
  287. {
  288. * Summary:
  289. * Selectors for feature type kCharacterAlternativesType
  290. }
  291. kNoAlternatesSelector = 0;
  292. {
  293. * Summary:
  294. * Selectors for feature type kDesignComplexityType
  295. }
  296. kDesignLevel1Selector = 0;
  297. kDesignLevel2Selector = 1;
  298. kDesignLevel3Selector = 2;
  299. kDesignLevel4Selector = 3;
  300. kDesignLevel5Selector = 4;
  301. {
  302. * Summary:
  303. * Selectors for feature type kStyleOptionsType
  304. }
  305. kNoStyleOptionsSelector = 0;
  306. kDisplayTextSelector = 1;
  307. kEngravedTextSelector = 2;
  308. kIlluminatedCapsSelector = 3;
  309. kTitlingCapsSelector = 4;
  310. kTallCapsSelector = 5;
  311. {
  312. * Summary:
  313. * Selectors for feature type kCharacterShapeType
  314. }
  315. kTraditionalCharactersSelector = 0;
  316. kSimplifiedCharactersSelector = 1;
  317. kJIS1978CharactersSelector = 2;
  318. kJIS1983CharactersSelector = 3;
  319. kJIS1990CharactersSelector = 4;
  320. kTraditionalAltOneSelector = 5;
  321. kTraditionalAltTwoSelector = 6;
  322. kTraditionalAltThreeSelector = 7;
  323. kTraditionalAltFourSelector = 8;
  324. kTraditionalAltFiveSelector = 9;
  325. kExpertCharactersSelector = 10;
  326. {
  327. * Summary:
  328. * Selectors for feature type kNumberCaseType
  329. }
  330. kLowerCaseNumbersSelector = 0;
  331. kUpperCaseNumbersSelector = 1;
  332. {
  333. * Summary:
  334. * Selectors for feature type kTextSpacingType
  335. }
  336. kProportionalTextSelector = 0;
  337. kMonospacedTextSelector = 1;
  338. kHalfWidthTextSelector = 2;
  339. kNormallySpacedTextSelector = 3;
  340. {
  341. * Summary:
  342. * Selectors for feature type kTransliterationType
  343. }
  344. kNoTransliterationSelector = 0;
  345. kHanjaToHangulSelector = 1;
  346. kHiraganaToKatakanaSelector = 2;
  347. kKatakanaToHiraganaSelector = 3;
  348. kKanaToRomanizationSelector = 4;
  349. kRomanizationToHiraganaSelector = 5;
  350. kRomanizationToKatakanaSelector = 6;
  351. kHanjaToHangulAltOneSelector = 7;
  352. kHanjaToHangulAltTwoSelector = 8;
  353. kHanjaToHangulAltThreeSelector = 9;
  354. {
  355. * Summary:
  356. * Selectors for feature type kAnnotationType
  357. }
  358. kNoAnnotationSelector = 0;
  359. kBoxAnnotationSelector = 1;
  360. kRoundedBoxAnnotationSelector = 2;
  361. kCircleAnnotationSelector = 3;
  362. kInvertedCircleAnnotationSelector = 4;
  363. kParenthesisAnnotationSelector = 5;
  364. kPeriodAnnotationSelector = 6;
  365. kRomanNumeralAnnotationSelector = 7;
  366. kDiamondAnnotationSelector = 8;
  367. kInvertedBoxAnnotationSelector = 9;
  368. kInvertedRoundedBoxAnnotationSelector = 10;
  369. {
  370. * Summary:
  371. * Selectors for feature type kKanaSpacingType
  372. }
  373. kFullWidthKanaSelector = 0;
  374. kProportionalKanaSelector = 1;
  375. {
  376. * Summary:
  377. * Selectors for feature type kIdeographicSpacingType
  378. }
  379. kFullWidthIdeographsSelector = 0;
  380. kProportionalIdeographsSelector = 1;
  381. kHalfWidthIdeographsSelector = 2;
  382. {
  383. * Summary:
  384. * Selectors for feature type kUnicodeDecompositionType
  385. }
  386. kCanonicalCompositionOnSelector = 0;
  387. kCanonicalCompositionOffSelector = 1;
  388. kCompatibilityCompositionOnSelector = 2;
  389. kCompatibilityCompositionOffSelector = 3;
  390. kTranscodingCompositionOnSelector = 4;
  391. kTranscodingCompositionOffSelector = 5;
  392. {
  393. * Summary:
  394. * Selectors for feature type kRubyKanaType
  395. }
  396. kNoRubyKanaSelector = 0;
  397. kRubyKanaSelector = 1;
  398. {
  399. * Summary:
  400. * Selectors for feature type kCJKSymbolAlternativesType
  401. }
  402. kNoCJKSymbolAlternativesSelector = 0;
  403. kCJKSymbolAltOneSelector = 1;
  404. kCJKSymbolAltTwoSelector = 2;
  405. kCJKSymbolAltThreeSelector = 3;
  406. kCJKSymbolAltFourSelector = 4;
  407. kCJKSymbolAltFiveSelector = 5;
  408. {
  409. * Summary:
  410. * Selectors for feature type kIdeographicAlternativesType
  411. }
  412. kNoIdeographicAlternativesSelector = 0;
  413. kIdeographicAltOneSelector = 1;
  414. kIdeographicAltTwoSelector = 2;
  415. kIdeographicAltThreeSelector = 3;
  416. kIdeographicAltFourSelector = 4;
  417. kIdeographicAltFiveSelector = 5;
  418. {
  419. * Summary:
  420. * Selectors for feature type kCJKVerticalRomanPlacementType
  421. }
  422. kCJKVerticalRomanCenteredSelector = 0;
  423. kCJKVerticalRomanHBaselineSelector = 1;
  424. {
  425. * Summary:
  426. * Selectors for feature type kItalicCJKRomanType
  427. }
  428. kNoCJKItalicRomanSelector = 0;
  429. kCJKItalicRomanSelector = 1;
  430. {
  431. * Summary:
  432. * Selectors for feature type kCJKRomanSpacingType
  433. }
  434. kHalfWidthCJKRomanSelector = 0;
  435. kProportionalCJKRomanSelector = 1;
  436. kDefaultCJKRomanSelector = 2;
  437. kFullWidthCJKRomanSelector = 3;
  438. { --------------------------------------------------------------------------- }
  439. { ---------------- Table Specific Typedefs and Constants -------------------- }
  440. { --------------------------------------------------------------------------- }
  441. { FORMATS FOR TABLE: lookup tables - used within various other tables }
  442. kSFNTLookupSimpleArray = 0; { a simple array indexed by glyph code }
  443. kSFNTLookupSegmentSingle = 2; { segment mapping to single value }
  444. kSFNTLookupSegmentArray = 4; { segment mapping to lookup array }
  445. kSFNTLookupSingleTable = 6; { sorted list of glyph, value pairs }
  446. kSFNTLookupTrimmedArray = 8; { a simple trimmed array indexed by glyph code }
  447. type
  448. SFNTLookupTableFormat = UInt16;
  449. SFNTLookupValue = UInt16;
  450. SFNTLookupOffset = UInt16;
  451. SFNTLookupKind = UInt32;
  452. {
  453. A BinarySearchHeader defines the five standard fields needed to perform quick
  454. lookups in a lookup table (note that using UInt16s, and not ItemCounts or
  455. similar types, is important here, since these tables are in fonts, and the
  456. documented font formats specify 16-bit quantities).
  457. }
  458. SFNTLookupBinarySearchHeaderPtr = ^SFNTLookupBinarySearchHeader;
  459. SFNTLookupBinarySearchHeader = record
  460. unitSize: UInt16; { size of a unit in bytes }
  461. nUnits: UInt16; { number of units in table }
  462. searchRange: UInt16; { (largest power of two <= nUnits) * unitSize }
  463. entrySelector: UInt16; { log2 (largest power of two <= nUnits) }
  464. rangeShift: UInt16; { (nUnits - largest power of two <= nUnits) * unitSize }
  465. end;
  466. { A format 0 lookup table maps all glyphs in the font to lookup values }
  467. SFNTLookupArrayHeaderPtr = ^SFNTLookupArrayHeader;
  468. SFNTLookupArrayHeader = record
  469. lookupValues: array [0..0] of SFNTLookupValue;
  470. end;
  471. { A format 8 lookup table maps some range of glyphs in the font to lookup values }
  472. SFNTLookupTrimmedArrayHeaderPtr = ^SFNTLookupTrimmedArrayHeader;
  473. SFNTLookupTrimmedArrayHeader = record
  474. firstGlyph: UInt16;
  475. count: UInt16;
  476. valueArray: array [0..0] of SFNTLookupValue;
  477. end;
  478. {
  479. Format 2 and format 4 lookup tables map ranges of glyphs to either single lookup
  480. values (format 2), or per-glyph lookup values (format 4). Since both formats
  481. use the same kind of data, only one unified set of segment-related structures
  482. is defined.
  483. }
  484. SFNTLookupSegmentPtr = ^SFNTLookupSegment;
  485. SFNTLookupSegment = record
  486. lastGlyph: UInt16;
  487. firstGlyph: UInt16;
  488. value: array [0..0] of UInt16;
  489. end;
  490. SFNTLookupSegmentHeaderPtr = ^SFNTLookupSegmentHeader;
  491. SFNTLookupSegmentHeader = record
  492. binSearch: SFNTLookupBinarySearchHeader;
  493. segments: array [0..0] of SFNTLookupSegment;
  494. end;
  495. { A format 6 lookup table maps single glyphs to lookup values. }
  496. SFNTLookupSinglePtr = ^SFNTLookupSingle;
  497. SFNTLookupSingle = record
  498. glyph: UInt16;
  499. value: array [0..0] of UInt16;
  500. end;
  501. SFNTLookupSingleHeaderPtr = ^SFNTLookupSingleHeader;
  502. SFNTLookupSingleHeader = record
  503. binSearch: SFNTLookupBinarySearchHeader;
  504. entries: array [0..0] of SFNTLookupSingle;
  505. end;
  506. { The format-specific part of the subtable header }
  507. SFNTLookupFormatSpecificHeaderPtr = ^SFNTLookupFormatSpecificHeader;
  508. SFNTLookupFormatSpecificHeader = record
  509. case SInt16 of
  510. 0: (
  511. theArray: SFNTLookupArrayHeader;
  512. );
  513. 1: (
  514. segment: SFNTLookupSegmentHeader;
  515. );
  516. 2: (
  517. single: SFNTLookupSingleHeader;
  518. );
  519. 3: (
  520. trimmedArray: SFNTLookupTrimmedArrayHeader;
  521. );
  522. end;
  523. { The overall subtable header }
  524. SFNTLookupTablePtr = ^SFNTLookupTable;
  525. SFNTLookupTable = record
  526. format: SFNTLookupTableFormat; { table format }
  527. fsHeader: SFNTLookupFormatSpecificHeader; { format specific header }
  528. end;
  529. SFNTLookupTableHandle = ^SFNTLookupTablePtr;
  530. { --------------------------------------------------------------------------- }
  531. { GENERAL FORMATS FOR STATE TABLES -- prefix "ST" }
  532. const
  533. kSTClassEndOfText = 0;
  534. kSTClassOutOfBounds = 1;
  535. kSTClassDeletedGlyph = 2;
  536. kSTClassEndOfLine = 3;
  537. kSTSetMark = $8000;
  538. kSTNoAdvance = $4000;
  539. kSTMarkEnd = $2000;
  540. kSTLigActionMask = $3FFF;
  541. kSTRearrVerbMask = $000F;
  542. type
  543. STClass = UInt8;
  544. STEntryIndex = UInt8;
  545. STHeaderPtr = ^STHeader;
  546. STHeader = record
  547. filler: SInt8;
  548. nClasses: SInt8;
  549. classTableOffset: UInt16;
  550. stateArrayOffset: UInt16;
  551. entryTableOffset: UInt16;
  552. end;
  553. STClassTablePtr = ^STClassTable;
  554. STClassTable = record
  555. firstGlyph: UInt16;
  556. nGlyphs: UInt16;
  557. classes: SInt8;
  558. end;
  559. STEntryZeroPtr = ^STEntryZero;
  560. STEntryZero = record
  561. newState: UInt16;
  562. flags: UInt16;
  563. end;
  564. STEntryOnePtr = ^STEntryOne;
  565. STEntryOne = record
  566. newState: UInt16;
  567. flags: UInt16;
  568. offset1: UInt16;
  569. end;
  570. STEntryTwoPtr = ^STEntryTwo;
  571. STEntryTwo = record
  572. newState: UInt16;
  573. flags: UInt16;
  574. offset1: UInt16;
  575. offset2: UInt16;
  576. end;
  577. { --------------------------------------------------------------------------- }
  578. { GENERAL FORMATS FOR STATE TABLES to be used with 'morx' tables -- prefix "STX" }
  579. const
  580. kSTXHasLigAction = $2000;
  581. type
  582. STXClass = UInt16;
  583. STXStateIndex = UInt16;
  584. STXEntryIndex = UInt16;
  585. STXHeaderPtr = ^STXHeader;
  586. STXHeader = record
  587. nClasses: UInt32;
  588. classTableOffset: UInt32;
  589. stateArrayOffset: UInt32;
  590. entryTableOffset: UInt32;
  591. end;
  592. STXClassTable = SFNTLookupTable;
  593. STXClassTablePtr = ^STXClassTable;
  594. STXEntryZeroPtr = ^STXEntryZero;
  595. STXEntryZero = record
  596. newState: STXStateIndex;
  597. flags: UInt16;
  598. end;
  599. STXEntryOnePtr = ^STXEntryOne;
  600. STXEntryOne = record
  601. newState: STXStateIndex;
  602. flags: UInt16;
  603. index1: UInt16;
  604. end;
  605. STXEntryTwoPtr = ^STXEntryTwo;
  606. STXEntryTwo = record
  607. newState: STXStateIndex;
  608. flags: UInt16;
  609. index1: UInt16;
  610. index2: UInt16;
  611. end;
  612. { --------------------------------------------------------------------------- }
  613. { FORMATS FOR TABLE: 'lcar' }
  614. { CONSTANTS }
  615. const
  616. kLCARTag = $6C636172; { 'lcar' }
  617. kLCARCurrentVersion = $00010000; { current version number for 'lcar' table }
  618. kLCARLinearFormat = 0;
  619. kLCARCtlPointFormat = 1;
  620. { TYPES }
  621. type
  622. LcarCaretClassEntryPtr = ^LcarCaretClassEntry;
  623. LcarCaretClassEntry = record
  624. count: UInt16;
  625. partials: array [0..0] of UInt16; { these are either FUnits or control-point numbers }
  626. end;
  627. LcarCaretTablePtr = ^LcarCaretTable;
  628. LcarCaretTable = record
  629. version: Fixed;
  630. format: UInt16;
  631. lookup: SFNTLookupTable;
  632. end;
  633. { --------------------------------------------------------------------------- }
  634. { FORMATS FOR TABLE: 'just' }
  635. { CONSTANTS }
  636. const
  637. kJUSTTag = $6A757374; { 'just' }
  638. kJUSTCurrentVersion = $00010000;
  639. kJUSTStandardFormat = 0;
  640. kJUSTnoGlyphcode = $FFFF; { used in a pcConditionalAddAction }
  641. kJUSTpcDecompositionAction = 0;
  642. kJUSTpcUnconditionalAddAction = 1;
  643. kJUSTpcConditionalAddAction = 2;
  644. kJUSTpcGlyphStretchAction = 3;
  645. kJUSTpcDuctilityAction = 4;
  646. kJUSTpcGlyphRepeatAddAction = 5;
  647. { Justification priority levels }
  648. kJUSTKashidaPriority = 0;
  649. kJUSTSpacePriority = 1;
  650. kJUSTLetterPriority = 2;
  651. kJUSTNullPriority = 3;
  652. kJUSTPriorityCount = 4;
  653. { Justification flags }
  654. kJUSTOverridePriority = $8000;
  655. kJUSTOverrideLimits = $4000;
  656. kJUSTOverrideUnlimited = $2000;
  657. kJUSTUnlimited = $1000;
  658. kJUSTPriorityMask = $0003;
  659. { TYPES }
  660. type
  661. JustPCActionType = UInt16;
  662. JustificationFlags = UInt16;
  663. { A JustPCDecompositionAction defines a ligature decomposition action. }
  664. JustPCDecompositionActionPtr = ^JustPCDecompositionAction;
  665. JustPCDecompositionAction = record
  666. lowerLimit: Fixed;
  667. upperLimit: Fixed;
  668. order: UInt16;
  669. count: UInt16;
  670. glyphs: array [0..0] of UInt16;
  671. end;
  672. { A JUSTPCUnconditionalAddAction defines an unconditional glyph add action. }
  673. JustPCUnconditionalAddAction = UInt16;
  674. {
  675. A JUSTPCConditionalAddAction defines a glyph substitution and add action. If the addGlyph
  676. is equal to kJUSTnoGlyphcode, then no glyph will be added, and the justification for
  677. the line will be redone.
  678. }
  679. JustPCConditionalAddActionPtr = ^JustPCConditionalAddAction;
  680. JustPCConditionalAddAction = record
  681. substThreshhold: Fixed; { threshhold of growth factor at which subst occurs }
  682. addGlyph: UInt16;
  683. substGlyph: UInt16;
  684. end;
  685. { A PCDuctilityAction defines a ductile axis along which the glyph will be varied. }
  686. JustPCDuctilityActionPtr = ^JustPCDuctilityAction;
  687. JustPCDuctilityAction = record
  688. ductilityAxis: UInt32;
  689. minimumLimit: Fixed;
  690. noStretchValue: Fixed;
  691. maximumLimit: Fixed;
  692. end;
  693. {
  694. A PCGlyphRepetitionAction defines a glyph which will not be stretched or otherwise
  695. transformed, but rather which will be emplaced however many times are needed to fill
  696. the needed gap.
  697. }
  698. JustPCGlyphRepeatAddActionPtr = ^JustPCGlyphRepeatAddAction;
  699. JustPCGlyphRepeatAddAction = record
  700. flags: UInt16;
  701. glyph: UInt16;
  702. end;
  703. { PCActionSubrecords contain the actual postcompensation actions. }
  704. JustPCActionSubrecordPtr = ^JustPCActionSubrecord;
  705. JustPCActionSubrecord = record
  706. theClass: UInt16; { justification class value associated with this rec }
  707. theType: JustPCActionType;
  708. length: UInt32;
  709. data: UInt32; { not really a UInt32; cast as ptr to appropriate action }
  710. end;
  711. { The set of postcompensation records is defined in a PCAction struct. }
  712. JustPCActionPtr = ^JustPCAction;
  713. JustPCAction = record
  714. actionCount: UInt32; { long for alignment purposes }
  715. actions: array [0..0] of JustPCActionSubrecord;
  716. end;
  717. {
  718. JustWidthDeltaEntry is the justification table entry structure. The justClass value (which is
  719. actually limited to 7 bits by the state table structure) is defined as a long for PPC alignment reasons.
  720. }
  721. JustWidthDeltaEntryPtr = ^JustWidthDeltaEntry;
  722. JustWidthDeltaEntry = record
  723. justClass: UInt32;
  724. beforeGrowLimit: Fixed; { ems AW can grow by at most on LT }
  725. beforeShrinkLimit: Fixed; { ems AW can shrink by at most on LT }
  726. afterGrowLimit: Fixed; { ems AW can grow by at most on RB }
  727. afterShrinkLimit: Fixed; { ems AW can shrink by at most on RB }
  728. growFlags: JustificationFlags; { flags controlling grow case }
  729. shrinkFlags: JustificationFlags; { flags controlling shrink case }
  730. end;
  731. JustWidthDeltaGroupPtr = ^JustWidthDeltaGroup;
  732. JustWidthDeltaGroup = record
  733. count: UInt32;
  734. entries: array [0..0] of JustWidthDeltaEntry;
  735. end;
  736. { Overall structure of a postcompensation table is defined in PostcompTable. }
  737. JustPostcompTablePtr = ^JustPostcompTable;
  738. JustPostcompTable = record
  739. lookupTable: SFNTLookupTable;
  740. { action records here }
  741. end;
  742. JustDirectionTablePtr = ^JustDirectionTable;
  743. JustDirectionTable = record
  744. justClass: UInt16; { offset to state table (0=none) }
  745. widthDeltaClusters: UInt16; { offset to clusters }
  746. postcomp: UInt16; { offset to postcomp table (0=none) }
  747. lookup: SFNTLookupTable;
  748. end;
  749. JustTablePtr = ^JustTable;
  750. JustTable = record
  751. version: Fixed;
  752. format: UInt16;
  753. horizHeaderOffset: UInt16;
  754. vertHeaderOffset: UInt16;
  755. end;
  756. { --------------------------------------------------------------------------- }
  757. { FORMATS FOR TABLE: 'opbd' }
  758. { CONSTANTS }
  759. const
  760. kOPBDTag = $6F706264; { 'opbd' }
  761. kOPBDCurrentVersion = $00010000;
  762. kOPBDDistanceFormat = 0;
  763. kOPBDControlPointFormat = 1;
  764. { TYPES }
  765. type
  766. OpbdTableFormat = UInt16;
  767. {
  768. The OpbdSideValues struct is the lookup result from the FindSingle call for the
  769. optical tables. It contains the 4 FUnit values that are relevant to the specified
  770. glyph, or the 4 control gxPoint values.
  771. }
  772. OpbdSideValuesPtr = ^OpbdSideValues;
  773. OpbdSideValues = record
  774. leftSideShift: SInt16;
  775. topSideShift: SInt16;
  776. rightSideShift: SInt16;
  777. bottomSideShift: SInt16;
  778. end;
  779. OpbdTablePtr = ^OpbdTable;
  780. OpbdTable = record
  781. version: Fixed;
  782. format: OpbdTableFormat;
  783. lookupTable: SFNTLookupTable;
  784. end;
  785. { --------------------------------------------------------------------------- }
  786. { FORMATS FOR TABLE: 'mort' }
  787. { CONSTANTS }
  788. const
  789. kMORTTag = $6D6F7274; { 'mort' }
  790. kMORTCurrentVersion = $00010000; { current version number for 'mort' table }
  791. { Coverage masks }
  792. kMORTCoverVertical = $8000;
  793. kMORTCoverDescending = $4000;
  794. kMORTCoverIgnoreVertical = $2000;
  795. kMORTCoverTypeMask = $000F; { Subtable types }
  796. kMORTRearrangementType = 0;
  797. kMORTContextualType = 1;
  798. kMORTLigatureType = 2;
  799. kMORTSwashType = 4;
  800. kMORTInsertionType = 5; { Ligature subtable constants }
  801. kMORTLigLastAction = $80000000;
  802. kMORTLigStoreLigature = $40000000;
  803. kMORTLigFormOffsetMask = $3FFFFFFF;
  804. kMORTLigFormOffsetShift = 2; { Rearrangement subtable actions }
  805. kMORTraNoAction = 0; { no action }
  806. kMORTraxA = 1; { Ax => xA }
  807. kMORTraDx = 2; { xD => Dx }
  808. kMORTraDxA = 3; { AxD => DxA }
  809. kMORTraxAB = 4; { ABx => xAB }
  810. kMORTraxBA = 5; { ABx => xBA }
  811. kMORTraCDx = 6; { xCD => CDx }
  812. kMORTraDCx = 7; { xCD => DCx }
  813. kMORTraCDxA = 8; { AxCD => CDxA }
  814. kMORTraDCxA = 9; { AxCD => DCxA }
  815. kMORTraDxAB = 10; { ABxD => DxAB }
  816. kMORTraDxBA = 11; { ABxD => DxBA }
  817. kMORTraCDxAB = 12; { ABxCD => CDxAB }
  818. kMORTraCDxBA = 13; { ABxCD => CDxBA }
  819. kMORTraDCxAB = 14; { ABxCD => DCxAB }
  820. kMORTraDCxBA = 15; { ABxCD => DCxBA }
  821. { Insertion subtable constants }
  822. kMORTDoInsertionsBefore = $80;
  823. kMORTIsSplitVowelPiece = $40;
  824. kMORTInsertionsCountMask = $3F;
  825. kMORTCurrInsertKashidaLike = $2000;
  826. kMORTMarkInsertKashidaLike = $1000;
  827. kMORTCurrInsertBefore = $0800;
  828. kMORTMarkInsertBefore = $0400;
  829. kMORTMarkJustTableCountMask = $3F80;
  830. kMORTMarkJustTableCountShift = 7; { JustTableIndex for marked character }
  831. kMORTCurrJustTableCountMask = $007F;
  832. kMORTCurrJustTableCountShift = 0; { JustTableIndex for current character }
  833. kMORTCurrInsertCountMask = $03E0;
  834. kMORTCurrInsertCountShift = 5; { count to insert after current glyphRec }
  835. kMORTMarkInsertCountMask = $001F;
  836. kMORTMarkInsertCountShift = 0; { count to insert after marked glyphRec }
  837. { TYPES }
  838. type
  839. MortSubtableMaskFlags = UInt32;
  840. MortLigatureActionEntry = UInt32;
  841. MortRearrangementSubtablePtr = ^MortRearrangementSubtable;
  842. MortRearrangementSubtable = record
  843. header: STHeader;
  844. end;
  845. MortContextualSubtablePtr = ^MortContextualSubtable;
  846. MortContextualSubtable = record
  847. header: STHeader;
  848. substitutionTableOffset: UInt16;
  849. end;
  850. MortLigatureSubtablePtr = ^MortLigatureSubtable;
  851. MortLigatureSubtable = record
  852. header: STHeader;
  853. ligatureActionTableOffset: UInt16;
  854. componentTableOffset: UInt16;
  855. ligatureTableOffset: UInt16;
  856. end;
  857. MortSwashSubtablePtr = ^MortSwashSubtable;
  858. MortSwashSubtable = record
  859. lookup: SFNTLookupTable;
  860. end;
  861. MortInsertionSubtablePtr = ^MortInsertionSubtable;
  862. MortInsertionSubtable = record
  863. header: STHeader;
  864. end;
  865. MortSpecificSubtablePtr = ^MortSpecificSubtable;
  866. MortSpecificSubtable = record
  867. case SInt16 of
  868. 0: (
  869. rearrangement: MortRearrangementSubtable;
  870. );
  871. 1: (
  872. contextual: MortContextualSubtable;
  873. );
  874. 2: (
  875. ligature: MortLigatureSubtable;
  876. );
  877. 3: (
  878. swash: MortSwashSubtable;
  879. );
  880. 4: (
  881. insertion: MortInsertionSubtable;
  882. );
  883. end;
  884. MortSubtablePtr = ^MortSubtable;
  885. MortSubtable = record
  886. length: UInt16;
  887. coverage: UInt16;
  888. flags: MortSubtableMaskFlags;
  889. u: MortSpecificSubtable;
  890. end;
  891. MortFeatureEntryPtr = ^MortFeatureEntry;
  892. MortFeatureEntry = record
  893. featureType: UInt16;
  894. featureSelector: UInt16;
  895. enableFlags: MortSubtableMaskFlags;
  896. disableFlags: MortSubtableMaskFlags;
  897. end;
  898. MortChainPtr = ^MortChain;
  899. MortChain = record
  900. defaultFlags: MortSubtableMaskFlags; { default flags for this chain }
  901. length: UInt32; { byte length of this chain }
  902. nFeatures: UInt16; { number of feature entries }
  903. nSubtables: UInt16; { number of subtables }
  904. featureEntries: array [0..0] of MortFeatureEntry;
  905. { the subtables follow }
  906. end;
  907. MortTablePtr = ^MortTable;
  908. MortTable = record
  909. version: Fixed;
  910. nChains: UInt32;
  911. chains: array [0..0] of MortChain;
  912. end;
  913. { --------------------------------------------------------------------------- }
  914. { FORMATS FOR TABLE: 'morx' (version 2 and beyond metamorphosis tables) }
  915. { CONSTANTS }
  916. const
  917. kMORXTag = $6D6F7278; { 'morx' }
  918. kMORXCurrentVersion = $00020000; { version number for current 'morx' table }
  919. { Coverage masks }
  920. kMORXCoverVertical = $80000000;
  921. kMORXCoverDescending = $40000000;
  922. kMORXCoverIgnoreVertical = $20000000;
  923. kMORXCoverTypeMask = $000000FF;
  924. { TYPES }
  925. type
  926. MorxRearrangementSubtablePtr = ^MorxRearrangementSubtable;
  927. MorxRearrangementSubtable = record
  928. header: STXHeader;
  929. end;
  930. MorxContextualSubtablePtr = ^MorxContextualSubtable;
  931. MorxContextualSubtable = record
  932. header: STXHeader;
  933. substitutionTableOffset: UInt32;
  934. end;
  935. MorxLigatureSubtablePtr = ^MorxLigatureSubtable;
  936. MorxLigatureSubtable = record
  937. header: STXHeader;
  938. ligatureActionTableOffset: UInt32;
  939. componentTableOffset: UInt32;
  940. ligatureTableOffset: UInt32;
  941. end;
  942. MorxInsertionSubtablePtr = ^MorxInsertionSubtable;
  943. MorxInsertionSubtable = record
  944. header: STXHeader;
  945. insertionGlyphTableOffset: UInt32;
  946. end;
  947. MorxSpecificSubtablePtr = ^MorxSpecificSubtable;
  948. MorxSpecificSubtable = record
  949. case SInt16 of
  950. 0: (
  951. rearrangement: MorxRearrangementSubtable;
  952. );
  953. 1: (
  954. contextual: MorxContextualSubtable;
  955. );
  956. 2: (
  957. ligature: MorxLigatureSubtable;
  958. );
  959. 3: (
  960. swash: MortSwashSubtable;
  961. );
  962. 4: (
  963. insertion: MorxInsertionSubtable;
  964. );
  965. end;
  966. MorxSubtablePtr = ^MorxSubtable;
  967. MorxSubtable = record
  968. length: UInt32;
  969. coverage: UInt32;
  970. flags: MortSubtableMaskFlags;
  971. u: MorxSpecificSubtable;
  972. end;
  973. MorxChainPtr = ^MorxChain;
  974. MorxChain = record
  975. defaultFlags: MortSubtableMaskFlags; { default flags for this chain }
  976. length: UInt32; { byte length of this chain }
  977. nFeatures: UInt32; { number of feature entries }
  978. nSubtables: UInt32; { number of subtables }
  979. featureEntries: array [0..0] of MortFeatureEntry;
  980. { the subtables follow }
  981. end;
  982. MorxTablePtr = ^MorxTable;
  983. MorxTable = record
  984. version: Fixed;
  985. nChains: UInt32;
  986. chains: array [0..0] of MorxChain;
  987. end;
  988. { --------------------------------------------------------------------------- }
  989. { FORMATS FOR TABLE: 'prop' }
  990. { CONSTANTS }
  991. const
  992. kPROPTag = $70726F70; { 'prop' }
  993. kPROPCurrentVersion = $00020000; { current version number for 'prop' table }
  994. kPROPPairOffsetShift = 8;
  995. kPROPPairOffsetSign = 7;
  996. kPROPIsFloaterMask = $8000; { glyph is floater }
  997. kPROPCanHangLTMask = $4000; { glyph can hang left/top }
  998. kPROPCanHangRBMask = $2000; { glyph can hang right/bottom }
  999. kPROPUseRLPairMask = $1000; { if glyph lands in RL streak, use paired glyph }
  1000. kPROPPairOffsetMask = $0F00; { 4-bit signed offset to other pair member }
  1001. kPROPRightConnectMask = $0080; { glyph connects to glyph on right }
  1002. kPROPZeroReserved = $0060; { must be zero }
  1003. kPROPDirectionMask = $001F; { direction bits }
  1004. { These are the Unicode direction classes (plus the Special European Number class). }
  1005. kPROPLDirectionClass = 0; { Left-to-Right }
  1006. kPROPRDirectionClass = 1; { Right-to-Left }
  1007. kPROPALDirectionClass = 2; { Right-to-Left Arabic Letter }
  1008. kPROPENDirectionClass = 3; { European Number }
  1009. kPROPESDirectionClass = 4; { European Number Seperator }
  1010. kPROPETDirectionClass = 5; { European Number Terminator }
  1011. kPROPANDirectionClass = 6; { Arabic Number }
  1012. kPROPCSDirectionClass = 7; { Common Number Seperator }
  1013. kPROPPSDirectionClass = 8; { Paragraph Seperator (also referred to as Block Separator) }
  1014. kPROPSDirectionClass = 9; { Segment Seperator }
  1015. kPROPWSDirectionClass = 10; { Whitespace }
  1016. kPROPONDirectionClass = 11; { Other Neutral }
  1017. kPROPSENDirectionClass = 12; { Special European Number (not a Unicode class) }
  1018. kPROPLREDirectionClass = 13; { Left-to-Right Embeding }
  1019. kPROPLRODirectionClass = 14; { Left-to-Right Override }
  1020. kPROPRLEDirectionClass = 15; { Right-to-Left Embeding }
  1021. kPROPRLODirectionClass = 16; { Right-to-Left Override }
  1022. kPROPPDFDirectionClass = 17; { Pop Directional Format }
  1023. kPROPNSMDirectionClass = 18; { Non-Spacing Mark }
  1024. kPROPBNDirectionClass = 19; { Boundary Neutral }
  1025. kPROPNumDirectionClasses = 20; { Number of Unicode directional types + Special European Number }
  1026. { TYPES }
  1027. type
  1028. PropCharProperties = UInt16;
  1029. PropTablePtr = ^PropTable;
  1030. PropTable = record
  1031. version: Fixed;
  1032. format: UInt16;
  1033. defaultProps: PropCharProperties;
  1034. lookup: SFNTLookupTable;
  1035. end;
  1036. PropLookupSegmentPtr = ^PropLookupSegment;
  1037. PropLookupSegment = record
  1038. lastGlyph: UInt16;
  1039. firstGlyph: UInt16;
  1040. value: UInt16;
  1041. end;
  1042. PropLookupSinglePtr = ^PropLookupSingle;
  1043. PropLookupSingle = record
  1044. glyph: UInt16;
  1045. props: PropCharProperties;
  1046. end;
  1047. { --------------------------------------------------------------------------- }
  1048. { FORMATS FOR TABLE: 'trak' }
  1049. { CONSTANTS }
  1050. const
  1051. kTRAKTag = $7472616B; { 'trak' }
  1052. kTRAKCurrentVersion = $00010000; { current version number for 'trak' table }
  1053. kTRAKUniformFormat = 0; { kTRAKPerGlyphFormat = 2 }
  1054. { TYPES }
  1055. type
  1056. TrakValue = SInt16;
  1057. TrakTableEntryPtr = ^TrakTableEntry;
  1058. TrakTableEntry = record
  1059. track: Fixed;
  1060. nameTableIndex: UInt16;
  1061. sizesOffset: UInt16; { offset to array of TrackingValues }
  1062. end;
  1063. TrakTableDataPtr = ^TrakTableData;
  1064. TrakTableData = record
  1065. nTracks: UInt16;
  1066. nSizes: UInt16;
  1067. sizeTableOffset: UInt32;
  1068. trakTable: array [0..0] of TrakTableEntry;
  1069. end;
  1070. TrakTablePtr = ^TrakTable;
  1071. TrakTable = record
  1072. version: Fixed;
  1073. format: UInt16;
  1074. horizOffset: UInt16;
  1075. vertOffset: UInt16;
  1076. end;
  1077. { --------------------------------------------------------------------------- }
  1078. { FORMATS FOR TABLE: 'kern' }
  1079. { CONSTANTS }
  1080. const
  1081. kKERNTag = $6B65726E; { 'kern' }
  1082. kKERNCurrentVersion = $00010000;
  1083. kKERNVertical = $8000; { set if this table has vertical kerning information }
  1084. kKERNResetCrossStream = $8000; { this value in a cross-stream table means reset to zero }
  1085. kKERNCrossStream = $4000; { set if this table contains cross-stream kerning values }
  1086. kKERNVariation = $2000; { set if this table contains variation kerning values }
  1087. kKERNUnusedBits = $1F00; { UNUSED, MUST BE ZERO }
  1088. kKERNFormatMask = $00FF; { format of this subtable }
  1089. kKERNOrderedList = 0; { ordered list of kerning pairs }
  1090. kKERNStateTable = 1; { state table for n-way contextual kerning }
  1091. kKERNSimpleArray = 2; { simple n X m array of kerning values }
  1092. kKERNIndexArray = 3; { modifed version of SimpleArray }
  1093. { Message Type Flags }
  1094. kKERNLineStart = $00000001; { Array of glyphs starts a line }
  1095. kKERNLineEndKerning = $00000002; { Array of glyphs ends a line }
  1096. kKERNNoCrossKerning = $00000004; { Prohibit cross kerning }
  1097. kKERNNotesRequested = $00000008; { Caller wants kerning notes }
  1098. kKERNNoStakeNote = 1; { Indicates a glyph was involved in a kerning pair/group }
  1099. kKERNCrossStreamResetNote = 2; { Indicates a return-to-baseline in cross-stream kerning }
  1100. kKERNNotApplied = $00000001; { All kerning values were zero, kerning call had no effect }
  1101. { TYPES }
  1102. type
  1103. KernTableFormat = UInt8;
  1104. KernSubtableInfo = UInt16;
  1105. KernKerningValue = SInt16;
  1106. KernArrayOffset = UInt16;
  1107. { header for version 0 kerning table }
  1108. KernVersion0HeaderPtr = ^KernVersion0Header;
  1109. KernVersion0Header = record
  1110. version: UInt16; { font version number (will be 0!) }
  1111. nTables: UInt16; { number of subtables present }
  1112. firstSubtable: array [0..0] of UInt16; { first subtable starts here }
  1113. end;
  1114. { Header for a kerning table }
  1115. KernTableHeaderPtr = ^KernTableHeader;
  1116. KernTableHeader = record
  1117. version: Fixed; { font version number (currently 1.0) }
  1118. nTables: SInt32; { number of subtables present }
  1119. firstSubtable: array [0..0] of UInt16; { first subtable starts here }
  1120. end;
  1121. KernTableHeaderHandle = ^KernTableHeaderPtr;
  1122. {
  1123. 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
  1124. kernOrderedList:
  1125. The table is a sorted list of [left glyph, right glyph, value] triples.
  1126. There's enough information in the header so that the list can be
  1127. efficiently binary searched.
  1128. }
  1129. { defines a single kerning pair of Glyphcodes }
  1130. KernKerningPairPtr = ^KernKerningPair;
  1131. KernKerningPair = record
  1132. left: UInt16;
  1133. right: UInt16;
  1134. end;
  1135. { a single list entry }
  1136. KernOrderedListEntryPtr = ^KernOrderedListEntry;
  1137. KernOrderedListEntry = record
  1138. pair: KernKerningPair; { the kerning pair }
  1139. value: KernKerningValue; { the kerning value for the above pair }
  1140. end;
  1141. { the header information for binary searching the list }
  1142. KernOrderedListHeaderPtr = ^KernOrderedListHeader;
  1143. KernOrderedListHeader = record
  1144. nPairs: UInt16; { number of kerning pairs in table }
  1145. searchRange: UInt16; { (largest power of two <= nPairs) * entry size }
  1146. entrySelector: UInt16; { log2 (largest power of two <= nPairs) }
  1147. rangeShift: UInt16; { (nPairs - largest power of two <= nPairs) * entry size }
  1148. table: array [0..0] of UInt16; { entries are first glyph, second glyph, and value }
  1149. end;
  1150. { KernStateTable: like the the generic state tables }
  1151. KernStateHeaderPtr = ^KernStateHeader;
  1152. KernStateHeader = record
  1153. header: STHeader; { state table header }
  1154. valueTable: UInt16; { offset to kerning value table }
  1155. firstTable: SInt8; { first table starts here }
  1156. end;
  1157. KernStateEntryPtr = ^KernStateEntry;
  1158. KernStateEntry = record
  1159. newState: UInt16;
  1160. flags: UInt16; { flags per above enum }
  1161. end;
  1162. {
  1163. Kern offset table header.
  1164. The offset table is a trimmed array from firstGlyph to limitGlyph.
  1165. Glyphs outside of this range should get zero for right-hand glyphs
  1166. and the offset of the beginning of the kerning array for left-hand glyphs.
  1167. }
  1168. KernOffsetTablePtr = ^KernOffsetTable;
  1169. KernOffsetTable = record
  1170. firstGlyph: UInt16; { first glyph in class range }
  1171. nGlyphs: UInt16; { number of glyphs in class range }
  1172. offsetTable: array [0..0] of KernArrayOffset; { offset table starts here }
  1173. end;
  1174. { Header information for accessing offset tables and kerning array }
  1175. {
  1176. KernSimpleArray:
  1177. The array is an nXm array of kenring values. Each row in the array
  1178. represents one left-hand glyph, and each column one right-hand glyph.
  1179. The zeroth row and column always represent glyphs that are out of bounds
  1180. and will always contain zero.
  1181. A pair is looked up by indexing the left-hand glyph through the left
  1182. offset table, the right-hand glyph through the right offset table,
  1183. adding both offsets to the starting address of the kerning array,
  1184. and fetching the kerning value pointed to.
  1185. }
  1186. { Kern offset table header. }
  1187. { The offset table is a trimmed array from firstGlyph to limitGlyph. }
  1188. { Glyphs outside of this range should get zero for right-hand glyphs }
  1189. { and the offset of the beginning of the kerning array for left- }
  1190. { hand glyphs. }
  1191. KernSimpleArrayHeaderPtr = ^KernSimpleArrayHeader;
  1192. KernSimpleArrayHeader = record
  1193. rowWidth: UInt16; { width, in bytes, of a row in the table }
  1194. leftOffsetTable: UInt16; { offset to left-hand offset table }
  1195. rightOffsetTable: UInt16; { offset to right-hand offset table }
  1196. theArray: KernArrayOffset; { offset to start of kerning array }
  1197. firstTable: array [0..0] of UInt16; { first offset table starts here... }
  1198. end;
  1199. { Index Array }
  1200. KernIndexArrayHeaderPtr = ^KernIndexArrayHeader;
  1201. KernIndexArrayHeader = record
  1202. glyphCount: UInt16;
  1203. kernValueCount: SInt8;
  1204. leftClassCount: SInt8;
  1205. rightClassCount: SInt8;
  1206. flags: SInt8; { set to 0 for now }
  1207. kernValue: array [0..0] of SInt16; { actual kerning values reference by index in kernIndex }
  1208. leftClass: SInt8; { maps left glyph to offset into kern index }
  1209. rightClass: SInt8; { maps right glyph to offset into kern index }
  1210. kernIndex: SInt8; { contains indicies into kernValue }
  1211. end;
  1212. { format specific part of subtable header }
  1213. KernFormatSpecificHeaderPtr = ^KernFormatSpecificHeader;
  1214. KernFormatSpecificHeader = record
  1215. case SInt16 of
  1216. 0: (
  1217. orderedList: KernOrderedListHeader;
  1218. );
  1219. 1: (
  1220. stateTable: KernStateHeader;
  1221. );
  1222. 2: (
  1223. simpleArray: KernSimpleArrayHeader;
  1224. );
  1225. 3: (
  1226. indexArray: KernIndexArrayHeader;
  1227. );
  1228. end;
  1229. { version 0 subtable header }
  1230. KernVersion0SubtableHeaderPtr = ^KernVersion0SubtableHeader;
  1231. KernVersion0SubtableHeader = record
  1232. version: UInt16; { kerning table version number }
  1233. length: UInt16; { length in bytes (including this header) }
  1234. stInfo: KernSubtableInfo; { sub-table info }
  1235. fsHeader: KernFormatSpecificHeader; { format specific sub-header }
  1236. end;
  1237. { Overall Subtable header format }
  1238. KernSubtableHeaderPtr = ^KernSubtableHeader;
  1239. KernSubtableHeader = record
  1240. length: SInt32; { length in bytes (including this header) }
  1241. stInfo: KernSubtableInfo; { subtable info }
  1242. tupleIndex: SInt16; { tuple index for variation subtables }
  1243. fsHeader: KernFormatSpecificHeader; { format specific sub-header }
  1244. end;
  1245. { --------------------------------------------------------------------------- }
  1246. { FORMATS FOR TABLE: 'bsln' }
  1247. { CONSTANTS }
  1248. const
  1249. kBSLNTag = $62736C6E; { 'bsln' }
  1250. kBSLNCurrentVersion = $00010000; { current version number for 'bsln' table }
  1251. kBSLNDistanceFormatNoMap = 0;
  1252. kBSLNDistanceFormatWithMap = 1;
  1253. kBSLNControlPointFormatNoMap = 2;
  1254. kBSLNControlPointFormatWithMap = 3;
  1255. { Baseline classes and constants }
  1256. kBSLNRomanBaseline = 0;
  1257. kBSLNIdeographicCenterBaseline = 1;
  1258. kBSLNIdeographicLowBaseline = 2;
  1259. kBSLNHangingBaseline = 3;
  1260. kBSLNMathBaseline = 4;
  1261. kBSLNLastBaseline = 31;
  1262. kBSLNNumBaselineClasses = 32;
  1263. kBSLNNoBaselineOverride = 255;
  1264. { TYPES }
  1265. type
  1266. BslnBaselineClass = UInt32;
  1267. { The BslnBaselineRecord array defines the baseline deltas for the line. }
  1268. BslnBaselineRecord = array [0..31] of Fixed;
  1269. {
  1270. BslnFormat0Part is the format-specific data for a distance table with no mapping (i.e.
  1271. all the glyphs belong to the defaultBaseline).
  1272. }
  1273. BslnFormat0PartPtr = ^BslnFormat0Part;
  1274. BslnFormat0Part = record
  1275. deltas: array [0..31] of SInt16;
  1276. end;
  1277. { BslnFormat1Part is the format-specific data for a distance table with a gxMapping. }
  1278. BslnFormat1PartPtr = ^BslnFormat1Part;
  1279. BslnFormat1Part = record
  1280. deltas: array [0..31] of SInt16;
  1281. mappingData: SFNTLookupTable;
  1282. end;
  1283. {
  1284. BslnFormat2Part is the format-specific data for a control-point table with no
  1285. mapping (i.e. all the glyphs belong to the defaultBaseline). It specifies a single
  1286. glyph to use and the set of control points in that glyph that designate each of
  1287. the baselines.
  1288. }
  1289. BslnFormat2PartPtr = ^BslnFormat2Part;
  1290. BslnFormat2Part = record
  1291. stdGlyph: UInt16;
  1292. ctlPoints: array [0..31] of SInt16;
  1293. end;
  1294. {
  1295. BslnFormat3Part is the format-specific data for a distance table with a mapping. Like
  1296. format 2, it contains a single glyph and its set of control-point values for each
  1297. of the baselines.
  1298. }
  1299. BslnFormat3PartPtr = ^BslnFormat3Part;
  1300. BslnFormat3Part = record
  1301. stdGlyph: UInt16;
  1302. ctlPoints: array [0..31] of SInt16;
  1303. mappingData: SFNTLookupTable;
  1304. end;
  1305. { The BslnFormatUnion is a union containing the format-specific parts of the baseline table. }
  1306. BslnFormatUnionPtr = ^BslnFormatUnion;
  1307. BslnFormatUnion = record
  1308. case SInt16 of
  1309. 0: (
  1310. fmt0Part: BslnFormat0Part;
  1311. );
  1312. 1: (
  1313. fmt1Part: BslnFormat1Part;
  1314. );
  1315. 2: (
  1316. fmt2Part: BslnFormat2Part;
  1317. );
  1318. 3: (
  1319. fmt3Part: BslnFormat3Part;
  1320. );
  1321. end;
  1322. { The table format used in BaselineTable }
  1323. BslnTableFormat = UInt16;
  1324. { BaselineTable defines the top-level format of the baseline table in the font. }
  1325. BslnTablePtr = ^BslnTable;
  1326. BslnTable = record
  1327. version: Fixed;
  1328. format: BslnTableFormat;
  1329. defaultBaseline: UInt16;
  1330. parts: BslnFormatUnion;
  1331. end;
  1332. { --------------------------------------------------------------------------- }
  1333. {$ALIGN MAC68K}
  1334. end.