12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544 |
- {
- File: SFNTLayoutTypes.p
-
- Contains: SFNT file layout structures and constants.
-
- Version: Technology: Mac OS 9 / Carbon
- Release: Universal Interfaces 3.4.2
-
- Copyright: © 1994-2002 by Apple Computer, Inc., all rights reserved.
-
- Bugs?: For bug reports, consult the following page on
- the World Wide Web:
-
- http://www.freepascal.org/bugs.html
-
- }
- {
- Modified for use with Free Pascal
- Version 210
- Please report any bugs to <[email protected]>
- }
- {$mode macpas}
- {$packenum 1}
- {$macro on}
- {$inline on}
- {$calling mwpascal}
- unit SFNTLayoutTypes;
- interface
- {$setc UNIVERSAL_INTERFACES_VERSION := $0342}
- {$setc GAP_INTERFACES_VERSION := $0210}
- {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
- {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
- {$endc}
- {$ifc defined CPUPOWERPC and defined CPUI386}
- {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
- {$endc}
- {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
- {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
- {$endc}
- {$ifc not defined __ppc__ and defined CPUPOWERPC}
- {$setc __ppc__ := 1}
- {$elsec}
- {$setc __ppc__ := 0}
- {$endc}
- {$ifc not defined __i386__ and defined CPUI386}
- {$setc __i386__ := 1}
- {$elsec}
- {$setc __i386__ := 0}
- {$endc}
- {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
- {$error Conflicting definitions for __ppc__ and __i386__}
- {$endc}
- {$ifc defined __ppc__ and __ppc__}
- {$setc TARGET_CPU_PPC := TRUE}
- {$setc TARGET_CPU_X86 := FALSE}
- {$elifc defined __i386__ and __i386__}
- {$setc TARGET_CPU_PPC := FALSE}
- {$setc TARGET_CPU_X86 := TRUE}
- {$elsec}
- {$error Neither __ppc__ nor __i386__ is defined.}
- {$endc}
- {$setc TARGET_CPU_PPC_64 := FALSE}
- {$ifc defined FPC_BIG_ENDIAN}
- {$setc TARGET_RT_BIG_ENDIAN := TRUE}
- {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
- {$elifc defined FPC_LITTLE_ENDIAN}
- {$setc TARGET_RT_BIG_ENDIAN := FALSE}
- {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
- {$elsec}
- {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
- {$endc}
- {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
- {$setc CALL_NOT_IN_CARBON := FALSE}
- {$setc OLDROUTINENAMES := FALSE}
- {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
- {$setc OPAQUE_UPP_TYPES := TRUE}
- {$setc OTCARBONAPPLICATION := TRUE}
- {$setc OTKERNEL := FALSE}
- {$setc PM_USE_SESSION_APIS := TRUE}
- {$setc TARGET_API_MAC_CARBON := TRUE}
- {$setc TARGET_API_MAC_OS8 := FALSE}
- {$setc TARGET_API_MAC_OSX := TRUE}
- {$setc TARGET_CARBON := TRUE}
- {$setc TARGET_CPU_68K := FALSE}
- {$setc TARGET_CPU_MIPS := FALSE}
- {$setc TARGET_CPU_SPARC := FALSE}
- {$setc TARGET_OS_MAC := TRUE}
- {$setc TARGET_OS_UNIX := FALSE}
- {$setc TARGET_OS_WIN32 := FALSE}
- {$setc TARGET_RT_MAC_68881 := FALSE}
- {$setc TARGET_RT_MAC_CFM := FALSE}
- {$setc TARGET_RT_MAC_MACHO := TRUE}
- {$setc TYPED_FUNCTION_POINTERS := TRUE}
- {$setc TYPE_BOOL := FALSE}
- {$setc TYPE_EXTENDED := FALSE}
- {$setc TYPE_LONGLONG := TRUE}
- uses MacTypes;
- {$ALIGN MAC68K}
- { ----------------------------------------------------------------------------------------- }
- { CONSTANTS }
- {
- The following values can be used to set run feature values. Note that unless the
- feature is defaulted differently in different fonts, the zero value for the
- selectors represents the default value. Check the following URL site for further info:
- "http://fonts.apple.com/Registry"
- }
- {
- * Summary:
- * Feature types
- }
- const
- kAllTypographicFeaturesType = 0;
- kLigaturesType = 1;
- kCursiveConnectionType = 2;
- kLetterCaseType = 3;
- kVerticalSubstitutionType = 4;
- kLinguisticRearrangementType = 5;
- kNumberSpacingType = 6;
- kSmartSwashType = 8;
- kDiacriticsType = 9;
- kVerticalPositionType = 10;
- kFractionsType = 11;
- kOverlappingCharactersType = 13;
- kTypographicExtrasType = 14;
- kMathematicalExtrasType = 15;
- kOrnamentSetsType = 16;
- kCharacterAlternativesType = 17;
- kDesignComplexityType = 18;
- kStyleOptionsType = 19;
- kCharacterShapeType = 20;
- kNumberCaseType = 21;
- kTextSpacingType = 22;
- kTransliterationType = 23;
- kAnnotationType = 24;
- kKanaSpacingType = 25;
- kIdeographicSpacingType = 26;
- kUnicodeDecompositionType = 27;
- kRubyKanaType = 28;
- kCJKSymbolAlternativesType = 29;
- kIdeographicAlternativesType = 30;
- kCJKVerticalRomanPlacementType = 31;
- kItalicCJKRomanType = 32;
- kCJKRomanSpacingType = 103;
- kLastFeatureType = -1;
- {
- * Summary:
- * Selectors for feature type kAllTypographicFeaturesType
- }
- kAllTypeFeaturesOnSelector = 0;
- kAllTypeFeaturesOffSelector = 1;
- {
- * Summary:
- * Selectors for feature type kLigaturesType
- }
- kRequiredLigaturesOnSelector = 0;
- kRequiredLigaturesOffSelector = 1;
- kCommonLigaturesOnSelector = 2;
- kCommonLigaturesOffSelector = 3;
- kRareLigaturesOnSelector = 4;
- kRareLigaturesOffSelector = 5;
- kLogosOnSelector = 6;
- kLogosOffSelector = 7;
- kRebusPicturesOnSelector = 8;
- kRebusPicturesOffSelector = 9;
- kDiphthongLigaturesOnSelector = 10;
- kDiphthongLigaturesOffSelector = 11;
- kSquaredLigaturesOnSelector = 12;
- kSquaredLigaturesOffSelector = 13;
- kAbbrevSquaredLigaturesOnSelector = 14;
- kAbbrevSquaredLigaturesOffSelector = 15;
- kSymbolLigaturesOnSelector = 16;
- kSymbolLigaturesOffSelector = 17;
- {
- * Summary:
- * Selectors for feature type kCursiveConnectionType
- }
- kUnconnectedSelector = 0;
- kPartiallyConnectedSelector = 1;
- kCursiveSelector = 2;
- {
- * Summary:
- * Selectors for feature type kLetterCaseType
- }
- kUpperAndLowerCaseSelector = 0;
- kAllCapsSelector = 1;
- kAllLowerCaseSelector = 2;
- kSmallCapsSelector = 3;
- kInitialCapsSelector = 4;
- kInitialCapsAndSmallCapsSelector = 5;
- {
- * Summary:
- * Selectors for feature type kVerticalSubstitutionType
- }
- kSubstituteVerticalFormsOnSelector = 0;
- kSubstituteVerticalFormsOffSelector = 1;
- {
- * Summary:
- * Selectors for feature type kLinguisticRearrangementType
- }
- kLinguisticRearrangementOnSelector = 0;
- kLinguisticRearrangementOffSelector = 1;
- {
- * Summary:
- * Selectors for feature type kNumberSpacingType
- }
- kMonospacedNumbersSelector = 0;
- kProportionalNumbersSelector = 1;
- kThirdWidthNumbersSelector = 2;
- kQuarterWidthNumbersSelector = 3;
- {
- * Summary:
- * Selectors for feature type kSmartSwashType
- }
- kWordInitialSwashesOnSelector = 0;
- kWordInitialSwashesOffSelector = 1;
- kWordFinalSwashesOnSelector = 2;
- kWordFinalSwashesOffSelector = 3;
- kLineInitialSwashesOnSelector = 4;
- kLineInitialSwashesOffSelector = 5;
- kLineFinalSwashesOnSelector = 6;
- kLineFinalSwashesOffSelector = 7;
- kNonFinalSwashesOnSelector = 8;
- kNonFinalSwashesOffSelector = 9;
- {
- * Summary:
- * Selectors for feature type kDiacriticsType
- }
- kShowDiacriticsSelector = 0;
- kHideDiacriticsSelector = 1;
- kDecomposeDiacriticsSelector = 2;
- {
- * Summary:
- * Selectors for feature type kVerticalPositionType
- }
- kNormalPositionSelector = 0;
- kSuperiorsSelector = 1;
- kInferiorsSelector = 2;
- kOrdinalsSelector = 3;
- {
- * Summary:
- * Selectors for feature type kFractionsType
- }
- kNoFractionsSelector = 0;
- kVerticalFractionsSelector = 1;
- kDiagonalFractionsSelector = 2;
- {
- * Summary:
- * Selectors for feature type kOverlappingCharactersType
- }
- kPreventOverlapOnSelector = 0;
- kPreventOverlapOffSelector = 1;
- {
- * Summary:
- * Selectors for feature type kTypographicExtrasType
- }
- kHyphensToEmDashOnSelector = 0;
- kHyphensToEmDashOffSelector = 1;
- kHyphenToEnDashOnSelector = 2;
- kHyphenToEnDashOffSelector = 3;
- kSlashedZeroOnSelector = 4;
- kSlashedZeroOffSelector = 5;
- kFormInterrobangOnSelector = 6;
- kFormInterrobangOffSelector = 7;
- kSmartQuotesOnSelector = 8;
- kSmartQuotesOffSelector = 9;
- kPeriodsToEllipsisOnSelector = 10;
- kPeriodsToEllipsisOffSelector = 11;
- {
- * Summary:
- * Selectors for feature type kMathematicalExtrasType
- }
- kHyphenToMinusOnSelector = 0;
- kHyphenToMinusOffSelector = 1;
- kAsteriskToMultiplyOnSelector = 2;
- kAsteriskToMultiplyOffSelector = 3;
- kSlashToDivideOnSelector = 4;
- kSlashToDivideOffSelector = 5;
- kInequalityLigaturesOnSelector = 6;
- kInequalityLigaturesOffSelector = 7;
- kExponentsOnSelector = 8;
- kExponentsOffSelector = 9;
- {
- * Summary:
- * Selectors for feature type kOrnamentSetsType
- }
- kNoOrnamentsSelector = 0;
- kDingbatsSelector = 1;
- kPiCharactersSelector = 2;
- kFleuronsSelector = 3;
- kDecorativeBordersSelector = 4;
- kInternationalSymbolsSelector = 5;
- kMathSymbolsSelector = 6;
- {
- * Summary:
- * Selectors for feature type kCharacterAlternativesType
- }
- kNoAlternatesSelector = 0;
- {
- * Summary:
- * Selectors for feature type kDesignComplexityType
- }
- kDesignLevel1Selector = 0;
- kDesignLevel2Selector = 1;
- kDesignLevel3Selector = 2;
- kDesignLevel4Selector = 3;
- kDesignLevel5Selector = 4;
- {
- * Summary:
- * Selectors for feature type kStyleOptionsType
- }
- kNoStyleOptionsSelector = 0;
- kDisplayTextSelector = 1;
- kEngravedTextSelector = 2;
- kIlluminatedCapsSelector = 3;
- kTitlingCapsSelector = 4;
- kTallCapsSelector = 5;
- {
- * Summary:
- * Selectors for feature type kCharacterShapeType
- }
- kTraditionalCharactersSelector = 0;
- kSimplifiedCharactersSelector = 1;
- kJIS1978CharactersSelector = 2;
- kJIS1983CharactersSelector = 3;
- kJIS1990CharactersSelector = 4;
- kTraditionalAltOneSelector = 5;
- kTraditionalAltTwoSelector = 6;
- kTraditionalAltThreeSelector = 7;
- kTraditionalAltFourSelector = 8;
- kTraditionalAltFiveSelector = 9;
- kExpertCharactersSelector = 10;
- {
- * Summary:
- * Selectors for feature type kNumberCaseType
- }
- kLowerCaseNumbersSelector = 0;
- kUpperCaseNumbersSelector = 1;
- {
- * Summary:
- * Selectors for feature type kTextSpacingType
- }
- kProportionalTextSelector = 0;
- kMonospacedTextSelector = 1;
- kHalfWidthTextSelector = 2;
- kNormallySpacedTextSelector = 3;
- {
- * Summary:
- * Selectors for feature type kTransliterationType
- }
- kNoTransliterationSelector = 0;
- kHanjaToHangulSelector = 1;
- kHiraganaToKatakanaSelector = 2;
- kKatakanaToHiraganaSelector = 3;
- kKanaToRomanizationSelector = 4;
- kRomanizationToHiraganaSelector = 5;
- kRomanizationToKatakanaSelector = 6;
- kHanjaToHangulAltOneSelector = 7;
- kHanjaToHangulAltTwoSelector = 8;
- kHanjaToHangulAltThreeSelector = 9;
- {
- * Summary:
- * Selectors for feature type kAnnotationType
- }
- kNoAnnotationSelector = 0;
- kBoxAnnotationSelector = 1;
- kRoundedBoxAnnotationSelector = 2;
- kCircleAnnotationSelector = 3;
- kInvertedCircleAnnotationSelector = 4;
- kParenthesisAnnotationSelector = 5;
- kPeriodAnnotationSelector = 6;
- kRomanNumeralAnnotationSelector = 7;
- kDiamondAnnotationSelector = 8;
- kInvertedBoxAnnotationSelector = 9;
- kInvertedRoundedBoxAnnotationSelector = 10;
- {
- * Summary:
- * Selectors for feature type kKanaSpacingType
- }
- kFullWidthKanaSelector = 0;
- kProportionalKanaSelector = 1;
- {
- * Summary:
- * Selectors for feature type kIdeographicSpacingType
- }
- kFullWidthIdeographsSelector = 0;
- kProportionalIdeographsSelector = 1;
- kHalfWidthIdeographsSelector = 2;
- {
- * Summary:
- * Selectors for feature type kUnicodeDecompositionType
- }
- kCanonicalCompositionOnSelector = 0;
- kCanonicalCompositionOffSelector = 1;
- kCompatibilityCompositionOnSelector = 2;
- kCompatibilityCompositionOffSelector = 3;
- kTranscodingCompositionOnSelector = 4;
- kTranscodingCompositionOffSelector = 5;
- {
- * Summary:
- * Selectors for feature type kRubyKanaType
- }
- kNoRubyKanaSelector = 0;
- kRubyKanaSelector = 1;
- {
- * Summary:
- * Selectors for feature type kCJKSymbolAlternativesType
- }
- kNoCJKSymbolAlternativesSelector = 0;
- kCJKSymbolAltOneSelector = 1;
- kCJKSymbolAltTwoSelector = 2;
- kCJKSymbolAltThreeSelector = 3;
- kCJKSymbolAltFourSelector = 4;
- kCJKSymbolAltFiveSelector = 5;
- {
- * Summary:
- * Selectors for feature type kIdeographicAlternativesType
- }
- kNoIdeographicAlternativesSelector = 0;
- kIdeographicAltOneSelector = 1;
- kIdeographicAltTwoSelector = 2;
- kIdeographicAltThreeSelector = 3;
- kIdeographicAltFourSelector = 4;
- kIdeographicAltFiveSelector = 5;
- {
- * Summary:
- * Selectors for feature type kCJKVerticalRomanPlacementType
- }
- kCJKVerticalRomanCenteredSelector = 0;
- kCJKVerticalRomanHBaselineSelector = 1;
- {
- * Summary:
- * Selectors for feature type kItalicCJKRomanType
- }
- kNoCJKItalicRomanSelector = 0;
- kCJKItalicRomanSelector = 1;
- {
- * Summary:
- * Selectors for feature type kCJKRomanSpacingType
- }
- kHalfWidthCJKRomanSelector = 0;
- kProportionalCJKRomanSelector = 1;
- kDefaultCJKRomanSelector = 2;
- kFullWidthCJKRomanSelector = 3;
- { --------------------------------------------------------------------------- }
- { ---------------- Table Specific Typedefs and Constants -------------------- }
- { --------------------------------------------------------------------------- }
- { FORMATS FOR TABLE: lookup tables - used within various other tables }
- kSFNTLookupSimpleArray = 0; { a simple array indexed by glyph code }
- kSFNTLookupSegmentSingle = 2; { segment mapping to single value }
- kSFNTLookupSegmentArray = 4; { segment mapping to lookup array }
- kSFNTLookupSingleTable = 6; { sorted list of glyph, value pairs }
- kSFNTLookupTrimmedArray = 8; { a simple trimmed array indexed by glyph code }
- type
- SFNTLookupTableFormat = UInt16;
- SFNTLookupValue = UInt16;
- SFNTLookupOffset = UInt16;
- SFNTLookupKind = UInt32;
- {
- A BinarySearchHeader defines the five standard fields needed to perform quick
- lookups in a lookup table (note that using UInt16s, and not ItemCounts or
- similar types, is important here, since these tables are in fonts, and the
- documented font formats specify 16-bit quantities).
- }
- SFNTLookupBinarySearchHeaderPtr = ^SFNTLookupBinarySearchHeader;
- SFNTLookupBinarySearchHeader = record
- unitSize: UInt16; { size of a unit in bytes }
- nUnits: UInt16; { number of units in table }
- searchRange: UInt16; { (largest power of two <= nUnits) * unitSize }
- entrySelector: UInt16; { log2 (largest power of two <= nUnits) }
- rangeShift: UInt16; { (nUnits - largest power of two <= nUnits) * unitSize }
- end;
- { A format 0 lookup table maps all glyphs in the font to lookup values }
- SFNTLookupArrayHeaderPtr = ^SFNTLookupArrayHeader;
- SFNTLookupArrayHeader = record
- lookupValues: array [0..0] of SFNTLookupValue;
- end;
- { A format 8 lookup table maps some range of glyphs in the font to lookup values }
- SFNTLookupTrimmedArrayHeaderPtr = ^SFNTLookupTrimmedArrayHeader;
- SFNTLookupTrimmedArrayHeader = record
- firstGlyph: UInt16;
- count: UInt16;
- valueArray: array [0..0] of SFNTLookupValue;
- end;
- {
- Format 2 and format 4 lookup tables map ranges of glyphs to either single lookup
- values (format 2), or per-glyph lookup values (format 4). Since both formats
- use the same kind of data, only one unified set of segment-related structures
- is defined.
- }
- SFNTLookupSegmentPtr = ^SFNTLookupSegment;
- SFNTLookupSegment = record
- lastGlyph: UInt16;
- firstGlyph: UInt16;
- value: array [0..0] of UInt16;
- end;
- SFNTLookupSegmentHeaderPtr = ^SFNTLookupSegmentHeader;
- SFNTLookupSegmentHeader = record
- binSearch: SFNTLookupBinarySearchHeader;
- segments: array [0..0] of SFNTLookupSegment;
- end;
- { A format 6 lookup table maps single glyphs to lookup values. }
- SFNTLookupSinglePtr = ^SFNTLookupSingle;
- SFNTLookupSingle = record
- glyph: UInt16;
- value: array [0..0] of UInt16;
- end;
- SFNTLookupSingleHeaderPtr = ^SFNTLookupSingleHeader;
- SFNTLookupSingleHeader = record
- binSearch: SFNTLookupBinarySearchHeader;
- entries: array [0..0] of SFNTLookupSingle;
- end;
- { The format-specific part of the subtable header }
- SFNTLookupFormatSpecificHeaderPtr = ^SFNTLookupFormatSpecificHeader;
- SFNTLookupFormatSpecificHeader = record
- case SInt16 of
- 0: (
- theArray: SFNTLookupArrayHeader;
- );
- 1: (
- segment: SFNTLookupSegmentHeader;
- );
- 2: (
- single: SFNTLookupSingleHeader;
- );
- 3: (
- trimmedArray: SFNTLookupTrimmedArrayHeader;
- );
- end;
- { The overall subtable header }
- SFNTLookupTablePtr = ^SFNTLookupTable;
- SFNTLookupTable = record
- format: SFNTLookupTableFormat; { table format }
- fsHeader: SFNTLookupFormatSpecificHeader; { format specific header }
- end;
- SFNTLookupTableHandle = ^SFNTLookupTablePtr;
- { --------------------------------------------------------------------------- }
- { GENERAL FORMATS FOR STATE TABLES -- prefix "ST" }
- const
- kSTClassEndOfText = 0;
- kSTClassOutOfBounds = 1;
- kSTClassDeletedGlyph = 2;
- kSTClassEndOfLine = 3;
- kSTSetMark = $8000;
- kSTNoAdvance = $4000;
- kSTMarkEnd = $2000;
- kSTLigActionMask = $3FFF;
- kSTRearrVerbMask = $000F;
- type
- STClass = UInt8;
- STEntryIndex = UInt8;
- STHeaderPtr = ^STHeader;
- STHeader = record
- filler: SInt8;
- nClasses: SInt8;
- classTableOffset: UInt16;
- stateArrayOffset: UInt16;
- entryTableOffset: UInt16;
- end;
- STClassTablePtr = ^STClassTable;
- STClassTable = record
- firstGlyph: UInt16;
- nGlyphs: UInt16;
- classes: SInt8;
- end;
- STEntryZeroPtr = ^STEntryZero;
- STEntryZero = record
- newState: UInt16;
- flags: UInt16;
- end;
- STEntryOnePtr = ^STEntryOne;
- STEntryOne = record
- newState: UInt16;
- flags: UInt16;
- offset1: UInt16;
- end;
- STEntryTwoPtr = ^STEntryTwo;
- STEntryTwo = record
- newState: UInt16;
- flags: UInt16;
- offset1: UInt16;
- offset2: UInt16;
- end;
- { --------------------------------------------------------------------------- }
- { GENERAL FORMATS FOR STATE TABLES to be used with 'morx' tables -- prefix "STX" }
- const
- kSTXHasLigAction = $2000;
- type
- STXClass = UInt16;
- STXStateIndex = UInt16;
- STXEntryIndex = UInt16;
- STXHeaderPtr = ^STXHeader;
- STXHeader = record
- nClasses: UInt32;
- classTableOffset: UInt32;
- stateArrayOffset: UInt32;
- entryTableOffset: UInt32;
- end;
- STXClassTable = SFNTLookupTable;
- STXClassTablePtr = ^STXClassTable;
- STXEntryZeroPtr = ^STXEntryZero;
- STXEntryZero = record
- newState: STXStateIndex;
- flags: UInt16;
- end;
- STXEntryOnePtr = ^STXEntryOne;
- STXEntryOne = record
- newState: STXStateIndex;
- flags: UInt16;
- index1: UInt16;
- end;
- STXEntryTwoPtr = ^STXEntryTwo;
- STXEntryTwo = record
- newState: STXStateIndex;
- flags: UInt16;
- index1: UInt16;
- index2: UInt16;
- end;
- { --------------------------------------------------------------------------- }
- { FORMATS FOR TABLE: 'lcar' }
- { CONSTANTS }
- const
- kLCARTag = $6C636172; { 'lcar' }
- kLCARCurrentVersion = $00010000; { current version number for 'lcar' table }
- kLCARLinearFormat = 0;
- kLCARCtlPointFormat = 1;
- { TYPES }
- type
- LcarCaretClassEntryPtr = ^LcarCaretClassEntry;
- LcarCaretClassEntry = record
- count: UInt16;
- partials: array [0..0] of UInt16; { these are either FUnits or control-point numbers }
- end;
- LcarCaretTablePtr = ^LcarCaretTable;
- LcarCaretTable = record
- version: Fixed;
- format: UInt16;
- lookup: SFNTLookupTable;
- end;
- { --------------------------------------------------------------------------- }
- { FORMATS FOR TABLE: 'just' }
- { CONSTANTS }
- const
- kJUSTTag = $6A757374; { 'just' }
- kJUSTCurrentVersion = $00010000;
- kJUSTStandardFormat = 0;
- kJUSTnoGlyphcode = $FFFF; { used in a pcConditionalAddAction }
- kJUSTpcDecompositionAction = 0;
- kJUSTpcUnconditionalAddAction = 1;
- kJUSTpcConditionalAddAction = 2;
- kJUSTpcGlyphStretchAction = 3;
- kJUSTpcDuctilityAction = 4;
- kJUSTpcGlyphRepeatAddAction = 5;
- { Justification priority levels }
- kJUSTKashidaPriority = 0;
- kJUSTSpacePriority = 1;
- kJUSTLetterPriority = 2;
- kJUSTNullPriority = 3;
- kJUSTPriorityCount = 4;
- { Justification flags }
- kJUSTOverridePriority = $8000;
- kJUSTOverrideLimits = $4000;
- kJUSTOverrideUnlimited = $2000;
- kJUSTUnlimited = $1000;
- kJUSTPriorityMask = $0003;
- { TYPES }
- type
- JustPCActionType = UInt16;
- JustificationFlags = UInt16;
- { A JustPCDecompositionAction defines a ligature decomposition action. }
- JustPCDecompositionActionPtr = ^JustPCDecompositionAction;
- JustPCDecompositionAction = record
- lowerLimit: Fixed;
- upperLimit: Fixed;
- order: UInt16;
- count: UInt16;
- glyphs: array [0..0] of UInt16;
- end;
- { A JUSTPCUnconditionalAddAction defines an unconditional glyph add action. }
- JustPCUnconditionalAddAction = UInt16;
- {
- A JUSTPCConditionalAddAction defines a glyph substitution and add action. If the addGlyph
- is equal to kJUSTnoGlyphcode, then no glyph will be added, and the justification for
- the line will be redone.
- }
- JustPCConditionalAddActionPtr = ^JustPCConditionalAddAction;
- JustPCConditionalAddAction = record
- substThreshhold: Fixed; { threshhold of growth factor at which subst occurs }
- addGlyph: UInt16;
- substGlyph: UInt16;
- end;
- { A PCDuctilityAction defines a ductile axis along which the glyph will be varied. }
- JustPCDuctilityActionPtr = ^JustPCDuctilityAction;
- JustPCDuctilityAction = record
- ductilityAxis: UInt32;
- minimumLimit: Fixed;
- noStretchValue: Fixed;
- maximumLimit: Fixed;
- end;
- {
- A PCGlyphRepetitionAction defines a glyph which will not be stretched or otherwise
- transformed, but rather which will be emplaced however many times are needed to fill
- the needed gap.
- }
- JustPCGlyphRepeatAddActionPtr = ^JustPCGlyphRepeatAddAction;
- JustPCGlyphRepeatAddAction = record
- flags: UInt16;
- glyph: UInt16;
- end;
- { PCActionSubrecords contain the actual postcompensation actions. }
- JustPCActionSubrecordPtr = ^JustPCActionSubrecord;
- JustPCActionSubrecord = record
- theClass: UInt16; { justification class value associated with this rec }
- theType: JustPCActionType;
- length: UInt32;
- data: UInt32; { not really a UInt32; cast as ptr to appropriate action }
- end;
- { The set of postcompensation records is defined in a PCAction struct. }
- JustPCActionPtr = ^JustPCAction;
- JustPCAction = record
- actionCount: UInt32; { long for alignment purposes }
- actions: array [0..0] of JustPCActionSubrecord;
- end;
- {
- JustWidthDeltaEntry is the justification table entry structure. The justClass value (which is
- actually limited to 7 bits by the state table structure) is defined as a long for PPC alignment reasons.
- }
- JustWidthDeltaEntryPtr = ^JustWidthDeltaEntry;
- JustWidthDeltaEntry = record
- justClass: UInt32;
- beforeGrowLimit: Fixed; { ems AW can grow by at most on LT }
- beforeShrinkLimit: Fixed; { ems AW can shrink by at most on LT }
- afterGrowLimit: Fixed; { ems AW can grow by at most on RB }
- afterShrinkLimit: Fixed; { ems AW can shrink by at most on RB }
- growFlags: JustificationFlags; { flags controlling grow case }
- shrinkFlags: JustificationFlags; { flags controlling shrink case }
- end;
- JustWidthDeltaGroupPtr = ^JustWidthDeltaGroup;
- JustWidthDeltaGroup = record
- count: UInt32;
- entries: array [0..0] of JustWidthDeltaEntry;
- end;
- { Overall structure of a postcompensation table is defined in PostcompTable. }
- JustPostcompTablePtr = ^JustPostcompTable;
- JustPostcompTable = record
- lookupTable: SFNTLookupTable;
- { action records here }
- end;
- JustDirectionTablePtr = ^JustDirectionTable;
- JustDirectionTable = record
- justClass: UInt16; { offset to state table (0=none) }
- widthDeltaClusters: UInt16; { offset to clusters }
- postcomp: UInt16; { offset to postcomp table (0=none) }
- lookup: SFNTLookupTable;
- end;
- JustTablePtr = ^JustTable;
- JustTable = record
- version: Fixed;
- format: UInt16;
- horizHeaderOffset: UInt16;
- vertHeaderOffset: UInt16;
- end;
- { --------------------------------------------------------------------------- }
- { FORMATS FOR TABLE: 'opbd' }
- { CONSTANTS }
- const
- kOPBDTag = $6F706264; { 'opbd' }
- kOPBDCurrentVersion = $00010000;
- kOPBDDistanceFormat = 0;
- kOPBDControlPointFormat = 1;
- { TYPES }
- type
- OpbdTableFormat = UInt16;
- {
- The OpbdSideValues struct is the lookup result from the FindSingle call for the
- optical tables. It contains the 4 FUnit values that are relevant to the specified
- glyph, or the 4 control gxPoint values.
- }
- OpbdSideValuesPtr = ^OpbdSideValues;
- OpbdSideValues = record
- leftSideShift: SInt16;
- topSideShift: SInt16;
- rightSideShift: SInt16;
- bottomSideShift: SInt16;
- end;
- OpbdTablePtr = ^OpbdTable;
- OpbdTable = record
- version: Fixed;
- format: OpbdTableFormat;
- lookupTable: SFNTLookupTable;
- end;
- { --------------------------------------------------------------------------- }
- { FORMATS FOR TABLE: 'mort' }
- { CONSTANTS }
- const
- kMORTTag = $6D6F7274; { 'mort' }
- kMORTCurrentVersion = $00010000; { current version number for 'mort' table }
- { Coverage masks }
- kMORTCoverVertical = $8000;
- kMORTCoverDescending = $4000;
- kMORTCoverIgnoreVertical = $2000;
- kMORTCoverTypeMask = $000F; { Subtable types }
- kMORTRearrangementType = 0;
- kMORTContextualType = 1;
- kMORTLigatureType = 2;
- kMORTSwashType = 4;
- kMORTInsertionType = 5; { Ligature subtable constants }
- kMORTLigLastAction = $80000000;
- kMORTLigStoreLigature = $40000000;
- kMORTLigFormOffsetMask = $3FFFFFFF;
- kMORTLigFormOffsetShift = 2; { Rearrangement subtable actions }
- kMORTraNoAction = 0; { no action }
- kMORTraxA = 1; { Ax => xA }
- kMORTraDx = 2; { xD => Dx }
- kMORTraDxA = 3; { AxD => DxA }
- kMORTraxAB = 4; { ABx => xAB }
- kMORTraxBA = 5; { ABx => xBA }
- kMORTraCDx = 6; { xCD => CDx }
- kMORTraDCx = 7; { xCD => DCx }
- kMORTraCDxA = 8; { AxCD => CDxA }
- kMORTraDCxA = 9; { AxCD => DCxA }
- kMORTraDxAB = 10; { ABxD => DxAB }
- kMORTraDxBA = 11; { ABxD => DxBA }
- kMORTraCDxAB = 12; { ABxCD => CDxAB }
- kMORTraCDxBA = 13; { ABxCD => CDxBA }
- kMORTraDCxAB = 14; { ABxCD => DCxAB }
- kMORTraDCxBA = 15; { ABxCD => DCxBA }
- { Insertion subtable constants }
- kMORTDoInsertionsBefore = $80;
- kMORTIsSplitVowelPiece = $40;
- kMORTInsertionsCountMask = $3F;
- kMORTCurrInsertKashidaLike = $2000;
- kMORTMarkInsertKashidaLike = $1000;
- kMORTCurrInsertBefore = $0800;
- kMORTMarkInsertBefore = $0400;
- kMORTMarkJustTableCountMask = $3F80;
- kMORTMarkJustTableCountShift = 7; { JustTableIndex for marked character }
- kMORTCurrJustTableCountMask = $007F;
- kMORTCurrJustTableCountShift = 0; { JustTableIndex for current character }
- kMORTCurrInsertCountMask = $03E0;
- kMORTCurrInsertCountShift = 5; { count to insert after current glyphRec }
- kMORTMarkInsertCountMask = $001F;
- kMORTMarkInsertCountShift = 0; { count to insert after marked glyphRec }
- { TYPES }
- type
- MortSubtableMaskFlags = UInt32;
- MortLigatureActionEntry = UInt32;
- MortRearrangementSubtablePtr = ^MortRearrangementSubtable;
- MortRearrangementSubtable = record
- header: STHeader;
- end;
- MortContextualSubtablePtr = ^MortContextualSubtable;
- MortContextualSubtable = record
- header: STHeader;
- substitutionTableOffset: UInt16;
- end;
- MortLigatureSubtablePtr = ^MortLigatureSubtable;
- MortLigatureSubtable = record
- header: STHeader;
- ligatureActionTableOffset: UInt16;
- componentTableOffset: UInt16;
- ligatureTableOffset: UInt16;
- end;
- MortSwashSubtablePtr = ^MortSwashSubtable;
- MortSwashSubtable = record
- lookup: SFNTLookupTable;
- end;
- MortInsertionSubtablePtr = ^MortInsertionSubtable;
- MortInsertionSubtable = record
- header: STHeader;
- end;
- MortSpecificSubtablePtr = ^MortSpecificSubtable;
- MortSpecificSubtable = record
- case SInt16 of
- 0: (
- rearrangement: MortRearrangementSubtable;
- );
- 1: (
- contextual: MortContextualSubtable;
- );
- 2: (
- ligature: MortLigatureSubtable;
- );
- 3: (
- swash: MortSwashSubtable;
- );
- 4: (
- insertion: MortInsertionSubtable;
- );
- end;
- MortSubtablePtr = ^MortSubtable;
- MortSubtable = record
- length: UInt16;
- coverage: UInt16;
- flags: MortSubtableMaskFlags;
- u: MortSpecificSubtable;
- end;
- MortFeatureEntryPtr = ^MortFeatureEntry;
- MortFeatureEntry = record
- featureType: UInt16;
- featureSelector: UInt16;
- enableFlags: MortSubtableMaskFlags;
- disableFlags: MortSubtableMaskFlags;
- end;
- MortChainPtr = ^MortChain;
- MortChain = record
- defaultFlags: MortSubtableMaskFlags; { default flags for this chain }
- length: UInt32; { byte length of this chain }
- nFeatures: UInt16; { number of feature entries }
- nSubtables: UInt16; { number of subtables }
- featureEntries: array [0..0] of MortFeatureEntry;
- { the subtables follow }
- end;
- MortTablePtr = ^MortTable;
- MortTable = record
- version: Fixed;
- nChains: UInt32;
- chains: array [0..0] of MortChain;
- end;
- { --------------------------------------------------------------------------- }
- { FORMATS FOR TABLE: 'morx' (version 2 and beyond metamorphosis tables) }
- { CONSTANTS }
- const
- kMORXTag = $6D6F7278; { 'morx' }
- kMORXCurrentVersion = $00020000; { version number for current 'morx' table }
- { Coverage masks }
- kMORXCoverVertical = $80000000;
- kMORXCoverDescending = $40000000;
- kMORXCoverIgnoreVertical = $20000000;
- kMORXCoverTypeMask = $000000FF;
- { TYPES }
- type
- MorxRearrangementSubtablePtr = ^MorxRearrangementSubtable;
- MorxRearrangementSubtable = record
- header: STXHeader;
- end;
- MorxContextualSubtablePtr = ^MorxContextualSubtable;
- MorxContextualSubtable = record
- header: STXHeader;
- substitutionTableOffset: UInt32;
- end;
- MorxLigatureSubtablePtr = ^MorxLigatureSubtable;
- MorxLigatureSubtable = record
- header: STXHeader;
- ligatureActionTableOffset: UInt32;
- componentTableOffset: UInt32;
- ligatureTableOffset: UInt32;
- end;
- MorxInsertionSubtablePtr = ^MorxInsertionSubtable;
- MorxInsertionSubtable = record
- header: STXHeader;
- insertionGlyphTableOffset: UInt32;
- end;
- MorxSpecificSubtablePtr = ^MorxSpecificSubtable;
- MorxSpecificSubtable = record
- case SInt16 of
- 0: (
- rearrangement: MorxRearrangementSubtable;
- );
- 1: (
- contextual: MorxContextualSubtable;
- );
- 2: (
- ligature: MorxLigatureSubtable;
- );
- 3: (
- swash: MortSwashSubtable;
- );
- 4: (
- insertion: MorxInsertionSubtable;
- );
- end;
- MorxSubtablePtr = ^MorxSubtable;
- MorxSubtable = record
- length: UInt32;
- coverage: UInt32;
- flags: MortSubtableMaskFlags;
- u: MorxSpecificSubtable;
- end;
- MorxChainPtr = ^MorxChain;
- MorxChain = record
- defaultFlags: MortSubtableMaskFlags; { default flags for this chain }
- length: UInt32; { byte length of this chain }
- nFeatures: UInt32; { number of feature entries }
- nSubtables: UInt32; { number of subtables }
- featureEntries: array [0..0] of MortFeatureEntry;
- { the subtables follow }
- end;
- MorxTablePtr = ^MorxTable;
- MorxTable = record
- version: Fixed;
- nChains: UInt32;
- chains: array [0..0] of MorxChain;
- end;
- { --------------------------------------------------------------------------- }
- { FORMATS FOR TABLE: 'prop' }
- { CONSTANTS }
- const
- kPROPTag = $70726F70; { 'prop' }
- kPROPCurrentVersion = $00020000; { current version number for 'prop' table }
- kPROPPairOffsetShift = 8;
- kPROPPairOffsetSign = 7;
- kPROPIsFloaterMask = $8000; { glyph is floater }
- kPROPCanHangLTMask = $4000; { glyph can hang left/top }
- kPROPCanHangRBMask = $2000; { glyph can hang right/bottom }
- kPROPUseRLPairMask = $1000; { if glyph lands in RL streak, use paired glyph }
- kPROPPairOffsetMask = $0F00; { 4-bit signed offset to other pair member }
- kPROPRightConnectMask = $0080; { glyph connects to glyph on right }
- kPROPZeroReserved = $0060; { must be zero }
- kPROPDirectionMask = $001F; { direction bits }
- { These are the Unicode direction classes (plus the Special European Number class). }
- kPROPLDirectionClass = 0; { Left-to-Right }
- kPROPRDirectionClass = 1; { Right-to-Left }
- kPROPALDirectionClass = 2; { Right-to-Left Arabic Letter }
- kPROPENDirectionClass = 3; { European Number }
- kPROPESDirectionClass = 4; { European Number Seperator }
- kPROPETDirectionClass = 5; { European Number Terminator }
- kPROPANDirectionClass = 6; { Arabic Number }
- kPROPCSDirectionClass = 7; { Common Number Seperator }
- kPROPPSDirectionClass = 8; { Paragraph Seperator (also referred to as Block Separator) }
- kPROPSDirectionClass = 9; { Segment Seperator }
- kPROPWSDirectionClass = 10; { Whitespace }
- kPROPONDirectionClass = 11; { Other Neutral }
- kPROPSENDirectionClass = 12; { Special European Number (not a Unicode class) }
- kPROPLREDirectionClass = 13; { Left-to-Right Embeding }
- kPROPLRODirectionClass = 14; { Left-to-Right Override }
- kPROPRLEDirectionClass = 15; { Right-to-Left Embeding }
- kPROPRLODirectionClass = 16; { Right-to-Left Override }
- kPROPPDFDirectionClass = 17; { Pop Directional Format }
- kPROPNSMDirectionClass = 18; { Non-Spacing Mark }
- kPROPBNDirectionClass = 19; { Boundary Neutral }
- kPROPNumDirectionClasses = 20; { Number of Unicode directional types + Special European Number }
- { TYPES }
- type
- PropCharProperties = UInt16;
- PropTablePtr = ^PropTable;
- PropTable = record
- version: Fixed;
- format: UInt16;
- defaultProps: PropCharProperties;
- lookup: SFNTLookupTable;
- end;
- PropLookupSegmentPtr = ^PropLookupSegment;
- PropLookupSegment = record
- lastGlyph: UInt16;
- firstGlyph: UInt16;
- value: UInt16;
- end;
- PropLookupSinglePtr = ^PropLookupSingle;
- PropLookupSingle = record
- glyph: UInt16;
- props: PropCharProperties;
- end;
- { --------------------------------------------------------------------------- }
- { FORMATS FOR TABLE: 'trak' }
- { CONSTANTS }
- const
- kTRAKTag = $7472616B; { 'trak' }
- kTRAKCurrentVersion = $00010000; { current version number for 'trak' table }
- kTRAKUniformFormat = 0; { kTRAKPerGlyphFormat = 2 }
- { TYPES }
- type
- TrakValue = SInt16;
- TrakTableEntryPtr = ^TrakTableEntry;
- TrakTableEntry = record
- track: Fixed;
- nameTableIndex: UInt16;
- sizesOffset: UInt16; { offset to array of TrackingValues }
- end;
- TrakTableDataPtr = ^TrakTableData;
- TrakTableData = record
- nTracks: UInt16;
- nSizes: UInt16;
- sizeTableOffset: UInt32;
- trakTable: array [0..0] of TrakTableEntry;
- end;
- TrakTablePtr = ^TrakTable;
- TrakTable = record
- version: Fixed;
- format: UInt16;
- horizOffset: UInt16;
- vertOffset: UInt16;
- end;
- { --------------------------------------------------------------------------- }
- { FORMATS FOR TABLE: 'kern' }
- { CONSTANTS }
- const
- kKERNTag = $6B65726E; { 'kern' }
- kKERNCurrentVersion = $00010000;
- kKERNVertical = $8000; { set if this table has vertical kerning information }
- kKERNResetCrossStream = $8000; { this value in a cross-stream table means reset to zero }
- kKERNCrossStream = $4000; { set if this table contains cross-stream kerning values }
- kKERNVariation = $2000; { set if this table contains variation kerning values }
- kKERNUnusedBits = $1F00; { UNUSED, MUST BE ZERO }
- kKERNFormatMask = $00FF; { format of this subtable }
- kKERNOrderedList = 0; { ordered list of kerning pairs }
- kKERNStateTable = 1; { state table for n-way contextual kerning }
- kKERNSimpleArray = 2; { simple n X m array of kerning values }
- kKERNIndexArray = 3; { modifed version of SimpleArray }
- { Message Type Flags }
- kKERNLineStart = $00000001; { Array of glyphs starts a line }
- kKERNLineEndKerning = $00000002; { Array of glyphs ends a line }
- kKERNNoCrossKerning = $00000004; { Prohibit cross kerning }
- kKERNNotesRequested = $00000008; { Caller wants kerning notes }
- kKERNNoStakeNote = 1; { Indicates a glyph was involved in a kerning pair/group }
- kKERNCrossStreamResetNote = 2; { Indicates a return-to-baseline in cross-stream kerning }
- kKERNNotApplied = $00000001; { All kerning values were zero, kerning call had no effect }
- { TYPES }
- type
- KernTableFormat = UInt8;
- KernSubtableInfo = UInt16;
- KernKerningValue = SInt16;
- KernArrayOffset = UInt16;
- { header for version 0 kerning table }
- KernVersion0HeaderPtr = ^KernVersion0Header;
- KernVersion0Header = record
- version: UInt16; { font version number (will be 0!) }
- nTables: UInt16; { number of subtables present }
- firstSubtable: array [0..0] of UInt16; { first subtable starts here }
- end;
- { Header for a kerning table }
- KernTableHeaderPtr = ^KernTableHeader;
- KernTableHeader = record
- version: Fixed; { font version number (currently 1.0) }
- nTables: SInt32; { number of subtables present }
- firstSubtable: array [0..0] of UInt16; { first subtable starts here }
- end;
- KernTableHeaderHandle = ^KernTableHeaderPtr;
- {
- 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
-
- kernOrderedList:
-
- The table is a sorted list of [left glyph, right glyph, value] triples.
- There's enough information in the header so that the list can be
- efficiently binary searched.
- }
- { defines a single kerning pair of Glyphcodes }
- KernKerningPairPtr = ^KernKerningPair;
- KernKerningPair = record
- left: UInt16;
- right: UInt16;
- end;
- { a single list entry }
- KernOrderedListEntryPtr = ^KernOrderedListEntry;
- KernOrderedListEntry = record
- pair: KernKerningPair; { the kerning pair }
- value: KernKerningValue; { the kerning value for the above pair }
- end;
- { the header information for binary searching the list }
- KernOrderedListHeaderPtr = ^KernOrderedListHeader;
- KernOrderedListHeader = record
- nPairs: UInt16; { number of kerning pairs in table }
- searchRange: UInt16; { (largest power of two <= nPairs) * entry size }
- entrySelector: UInt16; { log2 (largest power of two <= nPairs) }
- rangeShift: UInt16; { (nPairs - largest power of two <= nPairs) * entry size }
- table: array [0..0] of UInt16; { entries are first glyph, second glyph, and value }
- end;
- { KernStateTable: like the the generic state tables }
- KernStateHeaderPtr = ^KernStateHeader;
- KernStateHeader = record
- header: STHeader; { state table header }
- valueTable: UInt16; { offset to kerning value table }
- firstTable: SInt8; { first table starts here }
- end;
- KernStateEntryPtr = ^KernStateEntry;
- KernStateEntry = record
- newState: UInt16;
- flags: UInt16; { flags per above enum }
- end;
- {
- Kern offset table header.
- The offset table is a trimmed array from firstGlyph to limitGlyph.
- Glyphs outside of this range should get zero for right-hand glyphs
- and the offset of the beginning of the kerning array for left-hand glyphs.
- }
- KernOffsetTablePtr = ^KernOffsetTable;
- KernOffsetTable = record
- firstGlyph: UInt16; { first glyph in class range }
- nGlyphs: UInt16; { number of glyphs in class range }
- offsetTable: array [0..0] of KernArrayOffset; { offset table starts here }
- end;
- { Header information for accessing offset tables and kerning array }
- {
- KernSimpleArray:
-
- The array is an nXm array of kenring values. Each row in the array
- represents one left-hand glyph, and each column one right-hand glyph.
- The zeroth row and column always represent glyphs that are out of bounds
- and will always contain zero.
-
- A pair is looked up by indexing the left-hand glyph through the left
- offset table, the right-hand glyph through the right offset table,
- adding both offsets to the starting address of the kerning array,
- and fetching the kerning value pointed to.
- }
- { Kern offset table header. }
- { The offset table is a trimmed array from firstGlyph to limitGlyph. }
- { Glyphs outside of this range should get zero for right-hand glyphs }
- { and the offset of the beginning of the kerning array for left- }
- { hand glyphs. }
- KernSimpleArrayHeaderPtr = ^KernSimpleArrayHeader;
- KernSimpleArrayHeader = record
- rowWidth: UInt16; { width, in bytes, of a row in the table }
- leftOffsetTable: UInt16; { offset to left-hand offset table }
- rightOffsetTable: UInt16; { offset to right-hand offset table }
- theArray: KernArrayOffset; { offset to start of kerning array }
- firstTable: array [0..0] of UInt16; { first offset table starts here... }
- end;
- { Index Array }
- KernIndexArrayHeaderPtr = ^KernIndexArrayHeader;
- KernIndexArrayHeader = record
- glyphCount: UInt16;
- kernValueCount: SInt8;
- leftClassCount: SInt8;
- rightClassCount: SInt8;
- flags: SInt8; { set to 0 for now }
- kernValue: array [0..0] of SInt16; { actual kerning values reference by index in kernIndex }
- leftClass: SInt8; { maps left glyph to offset into kern index }
- rightClass: SInt8; { maps right glyph to offset into kern index }
- kernIndex: SInt8; { contains indicies into kernValue }
- end;
- { format specific part of subtable header }
- KernFormatSpecificHeaderPtr = ^KernFormatSpecificHeader;
- KernFormatSpecificHeader = record
- case SInt16 of
- 0: (
- orderedList: KernOrderedListHeader;
- );
- 1: (
- stateTable: KernStateHeader;
- );
- 2: (
- simpleArray: KernSimpleArrayHeader;
- );
- 3: (
- indexArray: KernIndexArrayHeader;
- );
- end;
- { version 0 subtable header }
- KernVersion0SubtableHeaderPtr = ^KernVersion0SubtableHeader;
- KernVersion0SubtableHeader = record
- version: UInt16; { kerning table version number }
- length: UInt16; { length in bytes (including this header) }
- stInfo: KernSubtableInfo; { sub-table info }
- fsHeader: KernFormatSpecificHeader; { format specific sub-header }
- end;
- { Overall Subtable header format }
- KernSubtableHeaderPtr = ^KernSubtableHeader;
- KernSubtableHeader = record
- length: SInt32; { length in bytes (including this header) }
- stInfo: KernSubtableInfo; { subtable info }
- tupleIndex: SInt16; { tuple index for variation subtables }
- fsHeader: KernFormatSpecificHeader; { format specific sub-header }
- end;
- { --------------------------------------------------------------------------- }
- { FORMATS FOR TABLE: 'bsln' }
- { CONSTANTS }
- const
- kBSLNTag = $62736C6E; { 'bsln' }
- kBSLNCurrentVersion = $00010000; { current version number for 'bsln' table }
- kBSLNDistanceFormatNoMap = 0;
- kBSLNDistanceFormatWithMap = 1;
- kBSLNControlPointFormatNoMap = 2;
- kBSLNControlPointFormatWithMap = 3;
- { Baseline classes and constants }
- kBSLNRomanBaseline = 0;
- kBSLNIdeographicCenterBaseline = 1;
- kBSLNIdeographicLowBaseline = 2;
- kBSLNHangingBaseline = 3;
- kBSLNMathBaseline = 4;
- kBSLNLastBaseline = 31;
- kBSLNNumBaselineClasses = 32;
- kBSLNNoBaselineOverride = 255;
- { TYPES }
- type
- BslnBaselineClass = UInt32;
- { The BslnBaselineRecord array defines the baseline deltas for the line. }
- BslnBaselineRecord = array [0..31] of Fixed;
- {
- BslnFormat0Part is the format-specific data for a distance table with no mapping (i.e.
- all the glyphs belong to the defaultBaseline).
- }
- BslnFormat0PartPtr = ^BslnFormat0Part;
- BslnFormat0Part = record
- deltas: array [0..31] of SInt16;
- end;
- { BslnFormat1Part is the format-specific data for a distance table with a gxMapping. }
- BslnFormat1PartPtr = ^BslnFormat1Part;
- BslnFormat1Part = record
- deltas: array [0..31] of SInt16;
- mappingData: SFNTLookupTable;
- end;
- {
- BslnFormat2Part is the format-specific data for a control-point table with no
- mapping (i.e. all the glyphs belong to the defaultBaseline). It specifies a single
- glyph to use and the set of control points in that glyph that designate each of
- the baselines.
- }
- BslnFormat2PartPtr = ^BslnFormat2Part;
- BslnFormat2Part = record
- stdGlyph: UInt16;
- ctlPoints: array [0..31] of SInt16;
- end;
- {
- BslnFormat3Part is the format-specific data for a distance table with a mapping. Like
- format 2, it contains a single glyph and its set of control-point values for each
- of the baselines.
- }
- BslnFormat3PartPtr = ^BslnFormat3Part;
- BslnFormat3Part = record
- stdGlyph: UInt16;
- ctlPoints: array [0..31] of SInt16;
- mappingData: SFNTLookupTable;
- end;
- { The BslnFormatUnion is a union containing the format-specific parts of the baseline table. }
- BslnFormatUnionPtr = ^BslnFormatUnion;
- BslnFormatUnion = record
- case SInt16 of
- 0: (
- fmt0Part: BslnFormat0Part;
- );
- 1: (
- fmt1Part: BslnFormat1Part;
- );
- 2: (
- fmt2Part: BslnFormat2Part;
- );
- 3: (
- fmt3Part: BslnFormat3Part;
- );
- end;
- { The table format used in BaselineTable }
- BslnTableFormat = UInt16;
- { BaselineTable defines the top-level format of the baseline table in the font. }
- BslnTablePtr = ^BslnTable;
- BslnTable = record
- version: Fixed;
- format: BslnTableFormat;
- defaultBaseline: UInt16;
- parts: BslnFormatUnion;
- end;
- { --------------------------------------------------------------------------- }
- {$ALIGN MAC68K}
- end.
|