3 #define OTF_ERROR_MEMORY -1
4 #define OTF_ERROR_FILE -2
5 #define OTF_ERROR_TABLE -3
6 #define OTF_ERROR_CMAP_PROC -4
7 #define OTF_ERROR_GDEF_PROC -5
8 #define OTF_ERROR_GSUB_PROC -6
9 #define OTF_ERROR_GPOS_PROC -7
13 typedef unsigned OTF_Tag;
14 typedef unsigned OTF_GlyphID;
15 typedef unsigned OTF_Offset;
55 typedef struct OTF_ScriptRecord OTF_ScriptRecord;
56 typedef struct OTF_Script OTF_Script;
61 OTF_ScriptRecord *ScriptRecord;
65 struct OTF_ScriptRecord
73 OTF_Offset LookupOrder;
74 unsigned ReqFeatureIndex;
75 unsigned FeatureCount;
76 unsigned *FeatureIndex;
87 OTF_Offset DefaultLangSysOffset;
88 OTF_LangSys DefaultLangSys;
89 unsigned LangSysCount;
90 OTF_LangSysRecord *LangSysRecord;
94 typedef struct OTF_FeatureRecord OTF_FeatureRecord;
95 typedef struct OTF_Feature OTF_Feature;
99 unsigned FeatureCount;
100 OTF_FeatureRecord *FeatureRecord;
101 OTF_Feature *Feature;
104 struct OTF_FeatureRecord
112 OTF_Offset FeatureParams;
113 unsigned LookupCount;
114 unsigned *LookupListIndex;
117 typedef struct OTF_Lookup OTF_Lookup;
121 unsigned LookupCount;
122 OTF_Offset *LookupOffset;
126 typedef struct OTF_LookupSubTable OTF_LookupSubTable;
132 unsigned SubTableCount;
133 OTF_Offset *SubTableOffset;
134 OTF_LookupSubTable *SubTable;
137 enum OTF_LookupFlagBit
139 OTF_RightToLeft = 0x0001,
140 OTF_IgnoreBaseGlyphs = 0x0002,
141 OTF_IgnoreLigatures = 0x0004,
142 OTF_IgnoreMarks = 0x8000,
143 OTF_Reserved = 0x00F0,
144 OTF_MarkAttachmentType = 0xFF00
147 typedef struct OTF_RangeRecord OTF_RangeRecord;
152 unsigned CoverageFormat;
155 OTF_GlyphID *GlyphArray;
156 OTF_RangeRecord *RangeRecord;
160 struct OTF_RangeRecord
164 unsigned StartCoverageIndex;
167 typedef struct OTF_ClassRangeRecord OTF_ClassRangeRecord;
172 unsigned ClassFormat;
175 OTF_GlyphID StartGlyph;
177 unsigned *ClassValueArray;
180 unsigned ClassRangeCount;
181 OTF_ClassRangeRecord *ClassRangeRecord;
186 struct OTF_ClassRangeRecord
198 unsigned DeltaFormat;
206 OTF_Fixed TableVersionNumber;
207 OTF_Fixed fontRevision;
208 unsigned checkSumAdjustment;
209 unsigned magicNumber;
226 OTF_GlyphID *Substitute;
229 typedef struct OTF_Sequence OTF_Sequence;
233 unsigned SequenceCount;
234 OTF_Sequence *Sequence;
235 } OTF_GSUB_Multiple1;
241 OTF_GlyphID *Substitute;
244 typedef struct OTF_AlternateSet OTF_AlternateSet;
248 unsigned AlternateSetCount;
249 OTF_AlternateSet *AlternateSet;
250 } OTF_GSUB_Alternate1;
252 struct OTF_AlternateSet
256 OTF_GlyphID *Alternate;
259 typedef struct OTF_LigatureSet OTF_LigatureSet;
260 typedef struct OTF_Ligature OTF_Ligature;
264 unsigned LigSetCount;
265 OTF_LigatureSet *LigatureSet;
266 } OTF_GSUB_Ligature1;
268 struct OTF_LigatureSet
271 unsigned LigatureCount;
272 OTF_Ligature *Ligature;
278 OTF_GlyphID LigGlyph;
280 OTF_GlyphID *Component;
285 unsigned SequenceIndex;
286 unsigned LookupListIndex;
287 } OTF_SubstLookupRecord;
289 typedef struct OTF_SubRuleSet OTF_SubRuleSet;
293 unsigned SubRuleSetCount;
294 OTF_SubRuleSet *SubRuleSet;
297 typedef struct OTF_SubRule OTF_SubRule;
299 struct OTF_SubRuleSet
302 unsigned SubRuleCount;
303 OTF_SubRule *SubRule;
312 OTF_SubstLookupRecord *SubstLookupRecord;
315 typedef struct OTF_SubClassSet OTF_SubClassSet;
319 OTF_ClassDef ClassDef;
320 unsigned SubClassSetCount;
321 OTF_SubClassSet *SubClassSet;
324 typedef struct OTF_SubClassRule OTF_SubClassRule;
326 struct OTF_SubClassSet
328 unsigned SubClassRuleCnt;
329 OTF_SubClassRule *SubClassRule;
332 struct OTF_SubClassRule
338 OTF_SubstLookupRecord *SubstLookupRecord;
345 OTF_Coverage *Coverage;
346 OTF_SubstLookupRecord *SubstLookupRecord;
349 typedef struct OTF_ChainSubRuleSet OTF_ChainSubRuleSet;
353 unsigned ChainSubRuleSetCount;
354 OTF_ChainSubRuleSet *ChainSubRuleSet;
355 } OTF_GSUB_ChainContext1;
357 typedef struct OTF_ChainSubRule OTF_ChainSubRule;
359 struct OTF_ChainSubRuleSet
362 unsigned ChainSubRuleCount;
363 OTF_ChainSubRule *ChainSubRule;
366 struct OTF_ChainSubRule
369 unsigned BacktrackGlyphCount;
370 OTF_GlyphID *Backtrack;
371 unsigned InputGlyphCount;
373 unsigned LookaheadGlyphCount;
374 OTF_GlyphID *LookAhead;
376 OTF_SubstLookupRecord *SubstLookupRecord;
379 typedef struct OTF_ChainSubClassSet OTF_ChainSubClassSet;
383 OTF_ClassDef Backtrack;
385 OTF_ClassDef LookAhead;
386 unsigned ChainSubClassSetCnt;
387 OTF_ChainSubClassSet *ChainSubClassSet;
388 } OTF_GSUB_ChainContext2;
390 typedef struct OTF_ChainSubClassRule OTF_ChainSubClassRule;
392 struct OTF_ChainSubClassSet
395 unsigned ChainSubClassRuleCnt;
396 OTF_ChainSubClassRule *ChainSubClassRule;
399 struct OTF_ChainSubClassRule
402 unsigned BacktrackGlyphCount;
404 unsigned InputGlyphCount;
406 unsigned LookaheadGlyphCount;
409 OTF_SubstLookupRecord *SubstLookupRecord;
415 unsigned BacktrackGlyphCount;
416 OTF_Coverage *Backtrack;
417 unsigned InputGlyphCount;
419 unsigned LookaheadGlyphCount;
420 OTF_Coverage *LookAhead;
422 OTF_SubstLookupRecord *SubstLookupRecord;
423 } OTF_GSUB_ChainContext3;
427 unsigned ExtensionLookupType;
428 unsigned ExtentionOffset;
429 } OTF_GSUB_Extension1;
433 unsigned BacktrackGlyphCount;
434 OTF_Coverage *Backtrack;
435 unsigned LookaheadGlyphCount;
436 OTF_Coverage *LookAhead;
438 OTF_GlyphID *Substitute;
439 } OTF_GSUB_ReverseChainSingle1;
445 OTF_XPlacement = 0x0001,
446 OTF_YPlacement = 0x0002,
447 OTF_XAdvance = 0x0004,
448 OTF_YAdvance = 0x0008,
449 OTF_XPlaDevice = 0x0010,
450 OTF_YPlaDevice = 0x0020,
451 OTF_XAdvDevice = 0x0040,
452 OTF_YAdvDevice = 0x0080
461 OTF_DeviceTable XPlaDevice;
462 OTF_DeviceTable YPlaDevice;
463 OTF_DeviceTable XAdvDevice;
464 OTF_DeviceTable YAdvDevice;
470 unsigned AnchorFormat;
475 unsigned AnchorPoint;
478 OTF_DeviceTable XDeviceTable;
479 OTF_DeviceTable YDeviceTable;
487 OTF_Anchor MarkAnchor;
494 OTF_MarkRecord *MarkRecord;
514 OTF_ValueRecord Value1;
515 OTF_ValueRecord Value2;
520 OTF_Class2Record *Class2Record;
525 unsigned ValueFormat1;
526 unsigned ValueFormat2;
527 OTF_ClassDef ClassDef1;
528 OTF_ClassDef ClassDef2;
529 unsigned Class1Count;
530 unsigned Class2Count;
531 OTF_Class1Record *Class1Record; /* size: <Class1Count> */
541 OTF_Anchor *BaseAnchor;
548 OTF_BaseRecord *BaseRecord;
553 OTF_Coverage BaseCoverage;
555 OTF_MarkArray MarkArray;
556 OTF_BaseArray BaseArray;
557 } OTF_GPOS_MarkBase1;
567 } OTF_GPOS_MarkMark1;
587 } OTF_GPOS_ChainContext1;
592 } OTF_GPOS_ChainContext2;
597 } OTF_GPOS_ChainContext3;
602 } OTF_GPOS_Extension1;
605 struct OTF_LookupSubTable
608 OTF_Coverage Coverage;
612 OTF_GSUB_Single1 single1;
613 OTF_GSUB_Single2 single2;
615 OTF_GSUB_Multiple1 multiple1;
617 OTF_GSUB_Alternate1 alternate1;
619 OTF_GSUB_Ligature1 ligature1;
621 OTF_GSUB_Context1 context1;
622 OTF_GSUB_Context2 context2;
623 OTF_GSUB_Context3 context3;
625 OTF_GSUB_ChainContext1 chain_context1;
626 OTF_GSUB_ChainContext2 chain_context2;
627 OTF_GSUB_ChainContext3 chain_context3;
629 OTF_GSUB_Extension1 extension1;
631 OTF_GSUB_ReverseChainSingle1 reverse_chain_single1;
636 OTF_GPOS_Single1 single1;
637 OTF_GPOS_Single2 single2;
639 OTF_GPOS_Pair1 pair1;
640 OTF_GPOS_Pair2 pair2;
642 OTF_GPOS_Cursive1 cursive1;
644 OTF_GPOS_MarkBase1 mark_base1;
646 OTF_GPOS_MarkLig1 mark_lig1;
648 OTF_GPOS_MarkMark1 mark_mark1;
650 OTF_GPOS_Context1 context1;
651 OTF_GPOS_Context2 context2;
652 OTF_GPOS_Context3 context3;
654 OTF_GPOS_ChainContext1 chain_context1;
655 OTF_GPOS_ChainContext2 chain_context2;
656 OTF_GPOS_ChainContext3 chain_context3;
658 OTF_GPOS_Extension1 extension1;
669 OTF_Offset ScriptList;
670 OTF_Offset FeatureList;
671 OTF_Offset LookupList;
676 OTF_GSUBHeader header;
677 OTF_ScriptList script_list;
678 OTF_FeatureList feature_list;
679 OTF_LookupList lookup_list;
683 typedef OTF_GSUBHeader OTF_GPOSHeader;
688 OTF_GPOSHeader header;
689 OTF_ScriptList script_list;
690 OTF_FeatureList feature_list;
691 OTF_LookupList lookup_list;
713 OTF_Offset GlyphClassDef;
714 OTF_Offset AttachList;
715 OTF_Offset LigCaretList;
716 OTF_Offset MarkAttachClassDef;
719 enum OTF_GlyphClassDef
722 OTF_GlyphClassBase = 1,
723 OTF_GlyphClassLigature = 2,
724 OTF_GlyphClassMark = 3,
725 OTF_GlyphClassComponent = 4
732 unsigned *PointIndex;
737 OTF_Coverage Coverage;
739 OTF_AttachPoint *AttachPoint;
745 unsigned CaretValueFormat; /* 1, 2, 3 */
751 unsigned CaretValuePoint;
755 OTF_DeviceTable DeviceTable;
764 OTF_CaretValue *CaretValue;
769 OTF_Coverage Coverage;
770 unsigned LigGlyphCount;
771 OTF_LigGlyph *LigGlyph;
776 OTF_GDEFHeader header;
777 OTF_ClassDef glyph_class_def;
778 OTF_AttachList attach_list;
779 OTF_LigCaretList lig_caret_list;
780 OTF_ClassDef mark_attach_class_def;
789 unsigned char glyphIdArray[256];
790 } OTF_EncodingSubtable0;
797 unsigned idRangeOffset;
802 unsigned subHeaderKeys[256];
803 OTF_cmapSubHeader *subHeaders;
804 unsigned *glyphIndexArray;
805 } OTF_EncodingSubtable2;
812 unsigned idRangeOffset;
818 unsigned searchRange;
819 unsigned entrySelector;
821 OTF_cmapSegument *segments;
823 unsigned *glyphIdArray;
824 } OTF_EncodingSubtable4;
830 unsigned *glyphIdArray;
831 } OTF_EncodingSubtable6;
835 unsigned startCharCode;
836 unsigned endCharCode;
837 unsigned startGlyphID;
842 unsigned char is32[8192];
844 OTF_cmapGroup *Groups;
845 } OTF_EncodingSubtable8;
849 unsigned startCharCode;
852 } OTF_EncodingSubtable10;
857 OTF_cmapGroup *Groups;
858 } OTF_EncodingSubtable12;
866 OTF_EncodingSubtable0 *f0;
867 OTF_EncodingSubtable2 *f2;
868 OTF_EncodingSubtable4 *f4;
869 OTF_EncodingSubtable6 *f6;
870 OTF_EncodingSubtable8 *f8;
871 OTF_EncodingSubtable10 *f10;
872 OTF_EncodingSubtable12 *f12;
874 } OTF_EncodingSubtable;
881 OTF_EncodingSubtable subtable;
882 } OTF_EncodingRecord;
888 OTF_EncodingRecord *EncodingRecord;
889 OTF_EncodingRecord *Unicode;
904 #define OTF_max_nameID 20
911 OTF_NameRecord *nameRecord;
912 char *name[OTF_max_nameID + 1];
919 OTF_Fixed sfnt_version;
921 unsigned searchRange;
922 unsigned enterSelector;
932 } OTF_TableDirectory;
937 OTF_OffsetTable offset_table;
938 OTF_TableDirectory *table_dirs;
945 /* The following tables are not yet supported. */
952 /* Character code of the glyph. This is the only member that a
953 client has to set before calling the OTF library function
957 /* Glyph ID of the glyph. */
958 OTF_GlyphID glyph_id;
960 /* GlyphClass of the glyph. The value is extracted from the GDEF
962 enum OTF_GlyphClassDef GlyphClass;
964 /* MarkAttachClassDef of the glyph. The value is extracted from the
966 unsigned MarkAttachClass;
968 /* Positioning format type of the glyph. The value is the same as
969 the LookupType of the GPOS's Lookup table that is used to decide
970 the positioning of the glyph. */
971 int positioning_type;
974 enum OTF_ValueFormat format;
975 OTF_ValueRecord *value;
978 enum OTF_ValueFormat format;
979 OTF_ValueRecord *value;
982 OTF_Anchor *entry_anchor;
983 OTF_Anchor *exit_anchor;
986 OTF_Anchor *mark_anchor;
987 OTF_Anchor *base_anchor;
990 OTF_Anchor *mark_anchor;
991 OTF_Anchor *ligature_anchor;
994 OTF_Anchor *mark1_anchor;
995 OTF_Anchor *mark2_anchor;
1008 extern OTF_Tag otf_tag (char *str);
1010 extern OTF *otf_open (char *name);
1011 extern void otf_close (OTF *otf);
1013 extern int otf_cmap (OTF *otf, OTF_GlyphString *gstring);
1014 extern int otf_gdef (OTF *otf, OTF_GlyphString *gstring);
1015 extern int otf_gsub (OTF *otf, OTF_Tag script_tag, OTF_Tag langsys_tag,
1016 OTF_GlyphString *gstring);
1017 extern int otf_gpos (OTF *otf, OTF_Tag script_tag, OTF_Tag langsys_tag,
1018 OTF_GlyphString *gstring);
1020 extern int otf_lookup_cmap (OTF *otf, int c);