1 /* otf.h -- Header file for libotf (OpenType font library).
3 Copyright (C) 2003, 2004
4 National Institute of Advanced Industrial Science and Technology (AIST)
5 Registration Number H15PRO167
7 This file is part of libotf.
9 Libotf is free software; you can redistribute it and/or modify it
10 under the terms of the GNU Lesser General Public License as published
11 by the Free Software Foundation; either version 2.1 of the License, or
12 (at your option) any later version.
14 Libotf is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
17 License for more details.
19 You should have received a copy of the GNU Lesser General Public
20 License along with this library, in a file named COPYING; if not,
21 write to the Free Software Foundation, Inc., 59 Temple Place, Suite
22 330, Boston, MA 02111-1307, USA. */
27 /* Version name of this library. */
28 #define LIBOTF_VERSION "0.9.1"
30 /* Major version number. */
31 #define LIBOTF_MAJOR_VERSION 0
32 /* Minor version number. */
33 #define LIBOTF_MINOR_VERSION 9
34 /* Release (i.e. patch level) number. */
35 #define LIBOTF_RELEASE_NUMBER 1
40 (1) Structures for OTF Layout tables and OTF itself
45 (1-5) Structures common to GDEF, GSUB, and GPOS
47 (1-7) Structures for ScriptList, FeatureList, and LookupList
48 (1-8) Structures common to GSUB and GPOS
51 (1-11) Structure for OTF
53 (2) API for reading OTF
57 (2-4) OTF_check_table()
59 (3) API for driving OTF
60 (3-1) Structure for glyph string
61 (3-2) OTF_drive_cmap()
62 (3-3) OTF_drive_gdef()
63 (3-4) OTF_drive_gsub()
64 (3-5) OTF_drive_gpos()
65 (3-6) OTF_drive_tables()
67 (4) API for error handling
76 /*** (1) Structures for OTF Layout tables and OTF itself */
78 /*** (1-1) Basic types */
80 typedef unsigned OTF_Tag;
81 typedef unsigned OTF_GlyphID;
82 typedef unsigned OTF_Offset;
91 /*** (1-2) "head" table */
95 OTF_Fixed TableVersionNumber;
96 OTF_Fixed fontRevision;
97 unsigned checkSumAdjustment;
104 /*** (1-3) "name" table */
115 /* If nonzero, NAME is an ASCII string. */
120 #define OTF_max_nameID 23
127 OTF_NameRecord *nameRecord;
128 char *name[OTF_max_nameID + 1];
132 /*** (1-4) "cmap" table */
136 unsigned char glyphIdArray[256];
137 } OTF_EncodingSubtable0;
144 unsigned idRangeOffset;
149 unsigned subHeaderKeys[256];
150 OTF_cmapSubHeader *subHeaders;
151 unsigned *glyphIndexArray;
152 } OTF_EncodingSubtable2;
159 unsigned idRangeOffset;
165 unsigned searchRange;
166 unsigned entrySelector;
168 OTF_cmapSegument *segments;
170 unsigned *glyphIdArray;
171 } OTF_EncodingSubtable4;
177 unsigned *glyphIdArray;
178 } OTF_EncodingSubtable6;
182 unsigned startCharCode;
183 unsigned endCharCode;
184 unsigned startGlyphID;
189 unsigned char is32[8192];
191 OTF_cmapGroup *Groups;
192 } OTF_EncodingSubtable8;
196 unsigned startCharCode;
199 } OTF_EncodingSubtable10;
204 OTF_cmapGroup *Groups;
205 } OTF_EncodingSubtable12;
213 OTF_EncodingSubtable0 *f0;
214 OTF_EncodingSubtable2 *f2;
215 OTF_EncodingSubtable4 *f4;
216 OTF_EncodingSubtable6 *f6;
217 OTF_EncodingSubtable8 *f8;
218 OTF_EncodingSubtable10 *f10;
219 OTF_EncodingSubtable12 *f12;
221 } OTF_EncodingSubtable;
228 OTF_EncodingSubtable subtable;
229 } OTF_EncodingRecord;
235 OTF_EncodingRecord *EncodingRecord;
236 /* Mapping table: Unicode->GlyphID */
237 unsigned short *unicode_table;
239 /* Mapping table: GlyphID->Unicode */
240 unsigned short *decode_table;
244 /*** (1-5) Structures common to GDEF, GSUB, GPOS */
250 unsigned StartCoverageIndex;
256 unsigned CoverageFormat;
259 OTF_GlyphID *GlyphArray;
260 OTF_RangeRecord *RangeRecord;
269 unsigned DeltaFormat;
278 } OTF_ClassRangeRecord;
283 unsigned ClassFormat;
286 OTF_GlyphID StartGlyph;
288 unsigned *ClassValueArray;
291 unsigned ClassRangeCount;
292 OTF_ClassRangeRecord *ClassRangeRecord;
298 /*** (1-6) "GDEF" table */
303 OTF_Offset GlyphClassDef;
304 OTF_Offset AttachList;
305 OTF_Offset LigCaretList;
306 OTF_Offset MarkAttachClassDef;
309 enum OTF_GlyphClassDef
312 OTF_GlyphClassBase = 1,
313 OTF_GlyphClassLigature = 2,
314 OTF_GlyphClassMark = 3,
315 OTF_GlyphClassComponent = 4
322 unsigned *PointIndex;
327 OTF_Coverage Coverage;
329 OTF_AttachPoint *AttachPoint;
335 unsigned CaretValueFormat; /* 1, 2, or 3 */
341 unsigned CaretValuePoint;
345 OTF_DeviceTable DeviceTable;
354 OTF_CaretValue *CaretValue;
359 OTF_Coverage Coverage;
360 unsigned LigGlyphCount;
361 OTF_LigGlyph *LigGlyph;
366 OTF_GDEFHeader header;
367 OTF_ClassDef glyph_class_def;
368 OTF_AttachList attach_list;
369 OTF_LigCaretList lig_caret_list;
370 OTF_ClassDef mark_attach_class_def;
374 /*** (1-7) Structures for ScriptList, FeatureList, and LookupList */
376 /*** The structure hierarchy
403 SubTable.gsub[] or SubTable.gpos[]
409 OTF_Offset LookupOrder;
410 unsigned ReqFeatureIndex;
411 unsigned FeatureCount;
412 unsigned *FeatureIndex;
425 OTF_Offset DefaultLangSysOffset;
426 OTF_LangSys DefaultLangSys;
427 unsigned LangSysCount;
428 OTF_LangSysRecord *LangSysRecord;
429 OTF_LangSys *LangSys;
435 unsigned ScriptCount;
443 OTF_Offset FeatureParams;
444 unsigned LookupCount;
445 unsigned *LookupListIndex;
451 unsigned FeatureCount;
452 OTF_Feature *Feature;
455 typedef struct OTF_LookupSubTableGSUB OTF_LookupSubTableGSUB;
456 typedef struct OTF_LookupSubTableGPOS OTF_LookupSubTableGPOS;
458 enum OTF_LookupFlagBit
460 OTF_RightToLeft = 0x0001,
461 OTF_IgnoreBaseGlyphs = 0x0002,
462 OTF_IgnoreLigatures = 0x0004,
463 OTF_IgnoreMarks = 0x8000,
464 OTF_Reserved = 0x00F0,
465 OTF_MarkAttachmentType = 0xFF00
473 unsigned SubTableCount;
474 OTF_Offset *SubTableOffset;
476 OTF_LookupSubTableGSUB *gsub;
477 OTF_LookupSubTableGPOS *gpos;
484 unsigned LookupCount;
489 /*** (1-8) Structures common to GSUB and GPOS */
491 /* For SubstLookupRecord (GSUB) and PosLookupRecord (GPOS). */
495 unsigned SequenceIndex;
496 unsigned LookupListIndex;
503 unsigned LookupCount;
504 OTF_GlyphID *Input; /* [<GlyphCount> - 1] */
505 OTF_LookupRecord *LookupRecord; /* [<LookupCount>] */
512 OTF_Rule *Rule; /* [<RuleCount>] */
519 unsigned LookupCount;
520 unsigned *Class; /* [<GlyphCount> - 1] */
521 OTF_LookupRecord *LookupRecord; /* [<LookupCount>] */
527 unsigned ClassRuleCnt;
528 OTF_ClassRule *ClassRule; /* [<ClassRuleCnt>] */
534 unsigned BacktrackGlyphCount;
535 OTF_GlyphID *Backtrack;
536 unsigned InputGlyphCount;
538 unsigned LookaheadGlyphCount;
539 OTF_GlyphID *LookAhead;
540 unsigned LookupCount;
541 OTF_LookupRecord *LookupRecord;
547 unsigned ChainRuleCount;
548 OTF_ChainRule *ChainRule;
554 unsigned BacktrackGlyphCount;
556 unsigned InputGlyphCount;
558 unsigned LookaheadGlyphCount;
560 unsigned LookupCount;
561 OTF_LookupRecord *LookupRecord;
562 } OTF_ChainClassRule;
567 unsigned ChainClassRuleCnt;
568 OTF_ChainClassRule *ChainClassRule;
572 /* Common to OTF_GSUB/GPOS_Context1/2/3. */
576 unsigned RuleSetCount;
577 OTF_RuleSet *RuleSet; /* [<RuleSetCount>] */
582 OTF_ClassDef ClassDef;
583 unsigned ClassSetCnt;
584 OTF_ClassSet *ClassSet; /* [<ClassSetCnt>] */
590 unsigned LookupCount;
591 OTF_Coverage *Coverage; /* [<GlyphCount>] */
592 OTF_LookupRecord *LookupRecord; /* [<LookupCount>] */
596 /* Common to OTF_GSUB/GPOS_ChainContext1/2/3. */
600 unsigned ChainRuleSetCount;
601 OTF_ChainRuleSet *ChainRuleSet;
606 OTF_ClassDef BacktrackClassDef;
607 OTF_ClassDef InputClassDef;
608 OTF_ClassDef LookaheadClassDef;
609 unsigned ChainClassSetCnt;
610 OTF_ChainClassSet *ChainClassSet;
615 unsigned BacktrackGlyphCount;
616 OTF_Coverage *Backtrack;
617 unsigned InputGlyphCount;
619 unsigned LookaheadGlyphCount;
620 OTF_Coverage *LookAhead;
621 unsigned LookupCount;
622 OTF_LookupRecord *LookupRecord;
625 /* Common to OTF_GSUB/GPOS. */
630 OTF_ScriptList ScriptList;
631 OTF_FeatureList FeatureList;
632 OTF_LookupList LookupList;
635 /*** (1-9) "GSUB" table */
645 OTF_GlyphID *Substitute;
648 typedef struct OTF_Sequence OTF_Sequence;
652 unsigned SequenceCount;
653 OTF_Sequence *Sequence;
654 } OTF_GSUB_Multiple1;
660 OTF_GlyphID *Substitute;
663 typedef struct OTF_AlternateSet OTF_AlternateSet;
667 unsigned AlternateSetCount;
668 OTF_AlternateSet *AlternateSet;
669 } OTF_GSUB_Alternate1;
671 struct OTF_AlternateSet
675 OTF_GlyphID *Alternate;
678 typedef struct OTF_LigatureSet OTF_LigatureSet;
679 typedef struct OTF_Ligature OTF_Ligature;
683 unsigned LigSetCount;
684 OTF_LigatureSet *LigatureSet;
685 } OTF_GSUB_Ligature1;
687 struct OTF_LigatureSet
690 unsigned LigatureCount;
691 OTF_Ligature *Ligature;
697 OTF_GlyphID LigGlyph;
699 OTF_GlyphID *Component;
702 typedef OTF_Context1 OTF_GSUB_Context1;
704 typedef OTF_Context2 OTF_GSUB_Context2;
706 typedef OTF_Context3 OTF_GSUB_Context3;
708 typedef OTF_ChainContext1 OTF_GSUB_ChainContext1;
710 typedef OTF_ChainContext2 OTF_GSUB_ChainContext2;
712 typedef OTF_ChainContext3 OTF_GSUB_ChainContext3;
716 unsigned ExtensionLookupType;
717 unsigned ExtensionOffset;
718 OTF_LookupSubTableGSUB *ExtensionSubtable;
719 } OTF_GSUB_Extension1;
723 unsigned BacktrackGlyphCount;
724 OTF_Coverage *Backtrack;
725 unsigned LookaheadGlyphCount;
726 OTF_Coverage *LookAhead;
728 OTF_GlyphID *Substitute;
729 } OTF_GSUB_ReverseChain1;
731 struct OTF_LookupSubTableGSUB
734 OTF_Coverage Coverage;
737 OTF_GSUB_Single1 single1;
738 OTF_GSUB_Single2 single2;
740 OTF_GSUB_Multiple1 multiple1;
742 OTF_GSUB_Alternate1 alternate1;
744 OTF_GSUB_Ligature1 ligature1;
746 OTF_GSUB_Context1 context1;
747 OTF_GSUB_Context2 context2;
748 OTF_GSUB_Context3 context3;
750 OTF_GSUB_ChainContext1 chain_context1;
751 OTF_GSUB_ChainContext2 chain_context2;
752 OTF_GSUB_ChainContext3 chain_context3;
754 OTF_GSUB_Extension1 extension1;
756 OTF_GSUB_ReverseChain1 reverse_chain1;
760 typedef OTF_GSUB_GPOS OTF_GSUB;
762 /*** (1-10) "GPOS" table */
766 OTF_XPlacement = 0x0001,
767 OTF_YPlacement = 0x0002,
768 OTF_XAdvance = 0x0004,
769 OTF_YAdvance = 0x0008,
770 OTF_XPlaDevice = 0x0010,
771 OTF_YPlaDevice = 0x0020,
772 OTF_XAdvDevice = 0x0040,
773 OTF_YAdvDevice = 0x0080
782 OTF_DeviceTable XPlaDevice;
783 OTF_DeviceTable YPlaDevice;
784 OTF_DeviceTable XAdvDevice;
785 OTF_DeviceTable YAdvDevice;
791 unsigned AnchorFormat;
796 unsigned AnchorPoint;
799 OTF_DeviceTable XDeviceTable;
800 OTF_DeviceTable YDeviceTable;
808 OTF_Anchor MarkAnchor;
815 OTF_MarkRecord *MarkRecord;
820 unsigned ValueFormat;
821 OTF_ValueRecord Value;
826 unsigned ValueFormat;
828 OTF_ValueRecord *Value; /* [<ValueCount>] */
833 OTF_GlyphID SecondGlyph;
834 OTF_ValueRecord Value1;
835 OTF_ValueRecord Value2;
836 } OTF_PairValueRecord;
841 unsigned PairValueCount;
842 OTF_PairValueRecord *PairValueRecord;
847 unsigned ValueFormat1;
848 unsigned ValueFormat2;
849 unsigned PairSetCount;
850 OTF_PairSet *PairSet;
855 OTF_ValueRecord Value1;
856 OTF_ValueRecord Value2;
861 OTF_Class2Record *Class2Record;
866 unsigned ValueFormat1;
867 unsigned ValueFormat2;
868 OTF_ClassDef ClassDef1;
869 OTF_ClassDef ClassDef2;
870 unsigned Class1Count;
871 unsigned Class2Count;
872 OTF_Class1Record *Class1Record; /* size: <Class1Count> */
877 OTF_Anchor EntryAnchor;
878 OTF_Anchor ExitAnchor;
879 } OTF_EntryExitRecord;
883 unsigned EntryExitCount;
884 OTF_EntryExitRecord *EntryExitRecord;
896 OTF_AnchorRecord *AnchorRecord;
901 OTF_Coverage BaseCoverage;
903 OTF_MarkArray MarkArray;
904 OTF_AnchorArray BaseArray;
905 } OTF_GPOS_MarkBase1;
909 OTF_Anchor *LigatureAnchor; /* [<ClassCount>] */
910 } OTF_ComponentRecord;
915 unsigned ComponentCount;
916 OTF_ComponentRecord *ComponentRecord; /* [<ComponentCount>] */
917 } OTF_LigatureAttach;
922 unsigned LigatureCount;
923 OTF_LigatureAttach *LigatureAttach; /* [<LiagureCount>] */
928 OTF_Coverage LigatureCoverage;
930 OTF_MarkArray MarkArray;
931 OTF_LigatureArray LigatureArray;
936 OTF_Coverage Mark2Coverage;
938 OTF_MarkArray Mark1Array;
939 OTF_AnchorArray Mark2Array;
940 } OTF_GPOS_MarkMark1;
942 typedef OTF_Context1 OTF_GPOS_Context1;
944 typedef OTF_Context2 OTF_GPOS_Context2;
946 typedef OTF_Context3 OTF_GPOS_Context3;
948 typedef OTF_ChainContext1 OTF_GPOS_ChainContext1;
950 typedef OTF_ChainContext2 OTF_GPOS_ChainContext2;
952 typedef OTF_ChainContext3 OTF_GPOS_ChainContext3;
956 unsigned ExtensionLookupType;
957 unsigned ExtensionOffset;
958 OTF_LookupSubTableGPOS *ExtensionSubtable;
959 } OTF_GPOS_Extension1;
962 struct OTF_LookupSubTableGPOS
965 OTF_Coverage Coverage;
968 OTF_GPOS_Single1 single1;
969 OTF_GPOS_Single2 single2;
971 OTF_GPOS_Pair1 pair1;
972 OTF_GPOS_Pair2 pair2;
974 OTF_GPOS_Cursive1 cursive1;
976 OTF_GPOS_MarkBase1 mark_base1;
978 OTF_GPOS_MarkLig1 mark_lig1;
980 OTF_GPOS_MarkMark1 mark_mark1;
982 OTF_GPOS_Context1 context1;
983 OTF_GPOS_Context2 context2;
984 OTF_GPOS_Context3 context3;
986 OTF_GPOS_ChainContext1 chain_context1;
987 OTF_GPOS_ChainContext2 chain_context2;
988 OTF_GPOS_ChainContext3 chain_context3;
990 OTF_GPOS_Extension1 extension1;
994 typedef OTF_GSUB_GPOS OTF_GPOS;
996 /*** (1-11) Structure for OTF */
1000 OTF_Fixed sfnt_version;
1002 unsigned searchRange;
1003 unsigned enterSelector;
1004 unsigned rangeShift;
1014 } OTF_TableDirectory;
1016 typedef struct OTF_InternalData OTF_InternalData;
1021 OTF_OffsetTable offset_table;
1022 OTF_TableDirectory *table_dirs;
1029 /* The following tables are not yet supported. */
1030 /* OTF_BASE *base; */
1031 /* OTF_JSTF *jstf; */
1032 OTF_InternalData *internal_data;
1036 /*** (2) API for reading OTF */
1038 /*** (2-1) otf_open () */
1043 The OTF_open() function reads the OpenType font file whose name is
1044 $NAME, and return a pointer to the structure of type OTF.
1046 It setups these member of the structure OTF:
1047 filename, offset_table, table_dirs
1049 If the file can't be read or the file contains invalid data, NULL
1050 is returned, and the variable OTF_error is set to one of the
1057 See also OTF_get_table() and OTF_close(). */
1059 extern OTF *OTF_open (char *name);
1062 /*** (2-2) OTF_close () */
1067 The OTF_close() function closes the OpenType font $OTF which must
1068 be what the OTF_open() function returned.
1070 See also OTF_open(). */
1072 extern void OTF_close (OTF *otf);
1075 /*** (2-3) OTF_get_table () */
1078 Get OpenType font table
1080 The OTF_get_table() function setups one of the OTF table specified
1081 by $NAME in the OpenType font $OTF.
1083 $NAME must be one of "head", "name", "cmap", "GDEF", "GSUB", and
1084 "GPOS", and a member of the same name is setup.
1086 If the table is successfully setup, return 0. Otherwise, return
1087 -1, and set the variable OTF_error to OTF_ERROR_TABLE.
1089 See also OTF_open(). */
1091 extern int OTF_get_table (OTF *otf, char *name);
1093 /*** (2-4) OTF_check_table () */
1096 Check the existence of OpenType font table
1098 The OTF_check_table() function checks if the the OTF table
1099 specified by $NAME exists in OpenType font $OTF.
1101 If the table exists, return 0, else return -1.
1103 See also OTF_open(). */
1105 extern int OTF_check_table (OTF *otf, char *name);
1108 /*** (3) API for driving OTF */
1110 /*** (3-1) Structure for glyph string */
1113 The structure OTF_Glyph contains information about each glyph in
1114 the structure OTF_GlyphString. */
1118 /** The first two members must be set by a clinet before calling the
1119 function OTF_drive_XXX(). **/
1121 /* Character code of the glyph. The value less than 32 is treated
1122 as a place-holder in a glyph string, and OTF_drive_XXX ()
1123 function just ignore the glyph as if it doesn't exist. */
1126 /* Glyph ID of the glyph. If the value is 0, the library gets a
1127 correct value from the above character code via cmap. */
1128 OTF_GlyphID glyph_id;
1130 /* GlyphClass of the glyph. The value is extracted from the GDEF
1132 enum OTF_GlyphClassDef GlyphClass;
1134 /* MarkAttachClassDef of the glyph. The value is extracted from the
1136 unsigned MarkAttachClass;
1138 /* Positioning format type of the glyph. The value specifies how
1139 the glyph positioning information is encoded in the member <f>.
1140 If the value is N, the union member fN, is used. If the value is
1141 zero, the glyph has no positioning information, i.e. it should be
1142 drawn at the normal position. */
1143 int positioning_type;
1146 enum OTF_ValueFormat format;
1147 OTF_ValueRecord *value;
1150 enum OTF_ValueFormat format;
1151 OTF_ValueRecord *value;
1154 OTF_Anchor *entry_anchor;
1155 OTF_Anchor *exit_anchor;
1158 OTF_Anchor *mark_anchor;
1159 OTF_Anchor *base_anchor;
1162 OTF_Anchor *mark_anchor;
1163 OTF_Anchor *ligature_anchor;
1166 OTF_Anchor *mark1_anchor;
1167 OTF_Anchor *mark2_anchor;
1173 The structure OTF_GlyphString contains an array of glyphs (type
1174 OTF_Glyph). It is used as arguments of otf_drive_XXX(). */
1178 /* How many glyphs are allocated at the memory pointed by the member
1181 /* How many glyphs contains valid information. */
1183 /* Array of glyphs. It must be allocated by malloc(). The
1184 functions otf_drive_XXX() may reallocate it and increase the
1185 members <size> and <used>. */
1190 /*** (3-2) OTF_drive_cmap() */
1193 Process glyph string by Unicode-based cmap table.
1195 The OTF_drive_cmap() function looks up a Unicode-based cmap table
1196 of OpenType font $OTF, and setup the member <glyhph_id> of all
1197 glhphs in the glyph string $GSTRING if the value of the member is
1200 extern int OTF_drive_cmap (OTF *otf, OTF_GlyphString *gstring);
1203 Process glyph string by a specific cmap table.
1205 The OTF_drive_cmap2() function looks up a cmap table (whose
1206 Platform-ID is $PLATFORM_ID an Encoding-ID is $ENCODING_ID) of
1207 OpenType font $OTF, and setup the member <glyhph_id> of all glhphs
1208 in the glyph string $GSTRING if the value of the member is not
1211 extern int OTF_drive_cmap2 (OTF *otf, OTF_GlyphString *gstring,
1212 int platform_id, int encoding_id);
1214 /*** (3-3) OTF_drive_gdef() */
1217 Process glyph string by GDEF table.
1219 The OTF_drive_gdef() function looks up the GDEF table of OpenType
1220 font $OTF, and setup members <GlyphClass> and <MarkAttachClass> of
1221 all glhphs in the glyph string $GSTRING. */
1223 extern int OTF_drive_gdef (OTF *otf, OTF_GlyphString *gstring);
1226 /*** (3-4) OTF_drive_gsub() */
1229 Process glyph string by GSUB table.
1231 The OTF_drive_gsub() function looks up the GSUB table of OpenType
1232 font $OTF, and by using features the font has for script $SCRIPT
1233 and language system $LANGSYS, update member <glyphs> of the glyph
1234 string $GSTRING. It may substitute, delete, insert glyphs in that
1235 array. $FEATURES is a list of features to apply. */
1237 extern int OTF_drive_gsub (OTF *otf, OTF_GlyphString *gstring,
1238 char *script, char *language, char *features);
1240 /*** (3-5) OTF_drive_gpos() */
1243 Process glyph string by GPOS table.
1245 The OTF_drive_gdef() function looks up the GPOS table of $OTF of
1246 OpenType font $OTF, and by using features the font has for script
1247 $SCRIPT and language system $LANGSYS, setup members
1248 <positioning_type> and <f> of all glhphs in the glyph string
1249 $GSTRING. $FEATURES is a list of features to apply. */
1251 extern int OTF_drive_gpos (OTF *otf, OTF_GlyphString *gstring,
1252 char *script, char *language, char *features);
1254 /*** (3-6) OTF_drive_tables() */
1257 Process glyph string by cmap, GDEF, GSUB, and GPOS tables.
1259 The OTF_drive_tables() function calls OTF_drive_cmap(),
1260 OTF_drive_gdef(), OTF_drive_gsub(), and OTF_drive_gpos() in this
1261 order, and update the glyphs string GSTRING. */
1263 extern int OTF_drive_tables (OTF *otf, OTF_GlyphString *gstring,
1264 char *script, char *language,
1265 char *gsub_features, char *gpos_features);
1268 /*** (3-7) OTF_get_unicode() */
1271 Return Unicode code point corresponding to the glyph-id CODE.
1274 extern int OTF_get_unicode (OTF *otf, OTF_GlyphID code);
1276 /*** (4) API for error handling ***/
1278 /*** (4-1) Error codes ***/
1281 Global variable holding an error code.
1283 The variable OTF_error is set to one of OTF_ERROR_XXX macros when
1284 an error is detected in the OTF library. */
1285 extern int OTF_error;
1288 Memory allocation error
1290 This error indicates that the library couldn't allocate
1292 #define OTF_ERROR_MEMORY 1
1297 This error indicates that the library fails in opening, reading,
1298 or seeking an OTF file. */
1299 #define OTF_ERROR_FILE 2
1302 Invalid table contents
1304 This error indicates that an OTF file contains invalid data. */
1305 #define OTF_ERROR_TABLE 3
1310 See the function otf_drive_cmap() for more detail. */
1311 #define OTF_ERROR_CMAP_DRIVE 4
1316 See the function OTF_drive_gdef() for more detail. */
1317 #define OTF_ERROR_GDEF_DRIVE 5
1322 See the function OTF_drive_gsub() for more detail. */
1323 #define OTF_ERROR_GSUB_DRIVE 6
1328 See the function OTF_drive_gpos() for more detail. */
1329 #define OTF_ERROR_GPOS_DRIVE 7
1332 /*** (4-2) OTF_perror() */
1335 Print an OTF error message
1337 The OTF_perror() function produces a message on the standard error
1338 output, describing the last error encountered during a call to the
1339 OTF library function. If $PREFIX is not NULL, it is printed
1340 first, followed by a colon and a blank. Then the message and a
1343 extern void OTF_perror (char *prefix);
1346 /*** (5) API miscellaneous ***/
1349 Return OTF tag of a specified name string.
1351 The OTF_tag() function returns OTF tag of name $NAME. If $NAME is
1352 NULL, return 0. Otherwise, $NAME must be at least 4-byte length.
1353 Only the first 4 characters are took into an account. */
1355 extern OTF_Tag OTF_tag (char *name);
1358 Convert OTF tag to name string.
1360 The OTF_tag_name() function converts OTF tag $TAG to a 5-byte name
1361 string (including the terminating NULL), and store it in $NAME.
1362 At least 5-byte space must be at $NAME. */
1364 extern void OTF_tag_name (OTF_Tag tag, char *name);
1367 #endif /* not _OTF_H_ */