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.2"
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 2
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()
66 (3-7) OTF_get_unicode()
67 (3-8) OTF_drive_gsub_alternate()
69 (4) API for error handling
78 /*** (1) Structures for OTF Layout tables and OTF itself */
80 /*** (1-1) Basic types */
82 typedef unsigned OTF_Tag;
83 typedef unsigned OTF_GlyphID;
84 typedef unsigned OTF_Offset;
93 /*** (1-2) "head" table */
97 OTF_Fixed TableVersionNumber;
98 OTF_Fixed fontRevision;
99 unsigned checkSumAdjustment;
100 unsigned magicNumber;
106 /*** (1-3) "name" table */
117 /* If nonzero, NAME is an ASCII string. */
122 #define OTF_max_nameID 23
129 OTF_NameRecord *nameRecord;
130 char *name[OTF_max_nameID + 1];
134 /*** (1-4) "cmap" table */
138 unsigned char glyphIdArray[256];
139 } OTF_EncodingSubtable0;
146 unsigned idRangeOffset;
151 unsigned short subHeaderKeys[256];
153 OTF_cmapSubHeader *subHeaders;
155 OTF_GlyphID *glyphIndexArray;
156 } OTF_EncodingSubtable2;
163 unsigned idRangeOffset;
169 unsigned searchRange;
170 unsigned entrySelector;
172 OTF_cmapSegument *segments;
174 unsigned *glyphIdArray;
175 } OTF_EncodingSubtable4;
181 unsigned *glyphIdArray;
182 } OTF_EncodingSubtable6;
186 unsigned startCharCode;
187 unsigned endCharCode;
188 unsigned startGlyphID;
193 unsigned char is32[8192];
195 OTF_cmapGroup *Groups;
196 } OTF_EncodingSubtable8;
200 unsigned startCharCode;
203 } OTF_EncodingSubtable10;
208 OTF_cmapGroup *Groups;
209 } OTF_EncodingSubtable12;
217 OTF_EncodingSubtable0 *f0;
218 OTF_EncodingSubtable2 *f2;
219 OTF_EncodingSubtable4 *f4;
220 OTF_EncodingSubtable6 *f6;
221 OTF_EncodingSubtable8 *f8;
222 OTF_EncodingSubtable10 *f10;
223 OTF_EncodingSubtable12 *f12;
225 } OTF_EncodingSubtable;
232 OTF_EncodingSubtable subtable;
233 } OTF_EncodingRecord;
239 OTF_EncodingRecord *EncodingRecord;
240 /* Mapping table: Unicode->GlyphID */
241 unsigned short *unicode_table;
243 /* Mapping table: GlyphID->Unicode */
244 unsigned short *decode_table;
248 /*** (1-5) Structures common to GDEF, GSUB, GPOS */
254 unsigned StartCoverageIndex;
260 unsigned CoverageFormat;
263 OTF_GlyphID *GlyphArray;
264 OTF_RangeRecord *RangeRecord;
273 unsigned DeltaFormat;
282 } OTF_ClassRangeRecord;
287 unsigned ClassFormat;
290 OTF_GlyphID StartGlyph;
292 unsigned *ClassValueArray;
295 unsigned ClassRangeCount;
296 OTF_ClassRangeRecord *ClassRangeRecord;
302 /*** (1-6) "GDEF" table */
307 OTF_Offset GlyphClassDef;
308 OTF_Offset AttachList;
309 OTF_Offset LigCaretList;
310 OTF_Offset MarkAttachClassDef;
313 enum OTF_GlyphClassDef
316 OTF_GlyphClassBase = 1,
317 OTF_GlyphClassLigature = 2,
318 OTF_GlyphClassMark = 3,
319 OTF_GlyphClassComponent = 4
326 unsigned *PointIndex;
331 OTF_Coverage Coverage;
333 OTF_AttachPoint *AttachPoint;
339 unsigned CaretValueFormat; /* 1, 2, or 3 */
345 unsigned CaretValuePoint;
349 OTF_DeviceTable DeviceTable;
358 OTF_CaretValue *CaretValue;
363 OTF_Coverage Coverage;
364 unsigned LigGlyphCount;
365 OTF_LigGlyph *LigGlyph;
370 OTF_GDEFHeader header;
371 OTF_ClassDef glyph_class_def;
372 OTF_AttachList attach_list;
373 OTF_LigCaretList lig_caret_list;
374 OTF_ClassDef mark_attach_class_def;
378 /*** (1-7) Structures for ScriptList, FeatureList, and LookupList */
380 /*** The structure hierarchy
407 SubTable.gsub[] or SubTable.gpos[]
413 OTF_Offset LookupOrder;
414 unsigned ReqFeatureIndex;
415 unsigned FeatureCount;
416 unsigned *FeatureIndex;
429 OTF_Offset DefaultLangSysOffset;
430 OTF_LangSys DefaultLangSys;
431 unsigned LangSysCount;
432 OTF_LangSysRecord *LangSysRecord;
433 OTF_LangSys *LangSys;
439 unsigned ScriptCount;
447 OTF_Offset FeatureParams;
448 unsigned LookupCount;
449 unsigned *LookupListIndex;
455 unsigned FeatureCount;
456 OTF_Feature *Feature;
459 typedef struct OTF_LookupSubTableGSUB OTF_LookupSubTableGSUB;
460 typedef struct OTF_LookupSubTableGPOS OTF_LookupSubTableGPOS;
462 enum OTF_LookupFlagBit
464 OTF_RightToLeft = 0x0001,
465 OTF_IgnoreBaseGlyphs = 0x0002,
466 OTF_IgnoreLigatures = 0x0004,
467 OTF_IgnoreMarks = 0x0008,
468 OTF_Reserved = 0x00F0,
469 OTF_MarkAttachmentType = 0xFF00
472 #define OTF_LookupFlagIgnoreMask \
473 (OTF_IgnoreBaseGlyphs | OTF_IgnoreLigatures | OTF_IgnoreMarks)
480 unsigned SubTableCount;
481 OTF_Offset *SubTableOffset;
483 OTF_LookupSubTableGSUB *gsub;
484 OTF_LookupSubTableGPOS *gpos;
491 unsigned LookupCount;
496 /*** (1-8) Structures common to GSUB and GPOS */
498 /* For SubstLookupRecord (GSUB) and PosLookupRecord (GPOS). */
502 unsigned SequenceIndex;
503 unsigned LookupListIndex;
510 unsigned LookupCount;
511 OTF_GlyphID *Input; /* [<GlyphCount> - 1] */
512 OTF_LookupRecord *LookupRecord; /* [<LookupCount>] */
519 OTF_Rule *Rule; /* [<RuleCount>] */
526 unsigned LookupCount;
527 unsigned *Class; /* [<GlyphCount> - 1] */
528 OTF_LookupRecord *LookupRecord; /* [<LookupCount>] */
534 unsigned ClassRuleCnt;
535 OTF_ClassRule *ClassRule; /* [<ClassRuleCnt>] */
541 unsigned BacktrackGlyphCount;
542 OTF_GlyphID *Backtrack;
543 unsigned InputGlyphCount;
545 unsigned LookaheadGlyphCount;
546 OTF_GlyphID *LookAhead;
547 unsigned LookupCount;
548 OTF_LookupRecord *LookupRecord;
554 unsigned ChainRuleCount;
555 OTF_ChainRule *ChainRule;
561 unsigned BacktrackGlyphCount;
563 unsigned InputGlyphCount;
565 unsigned LookaheadGlyphCount;
567 unsigned LookupCount;
568 OTF_LookupRecord *LookupRecord;
569 } OTF_ChainClassRule;
574 unsigned ChainClassRuleCnt;
575 OTF_ChainClassRule *ChainClassRule;
579 /* Common to OTF_GSUB/GPOS_Context1/2/3. */
583 unsigned RuleSetCount;
584 OTF_RuleSet *RuleSet; /* [<RuleSetCount>] */
589 OTF_ClassDef ClassDef;
590 unsigned ClassSetCnt;
591 OTF_ClassSet *ClassSet; /* [<ClassSetCnt>] */
597 unsigned LookupCount;
598 OTF_Coverage *Coverage; /* [<GlyphCount>] */
599 OTF_LookupRecord *LookupRecord; /* [<LookupCount>] */
603 /* Common to OTF_GSUB/GPOS_ChainContext1/2/3. */
607 unsigned ChainRuleSetCount;
608 OTF_ChainRuleSet *ChainRuleSet;
613 OTF_ClassDef BacktrackClassDef;
614 OTF_ClassDef InputClassDef;
615 OTF_ClassDef LookaheadClassDef;
616 unsigned ChainClassSetCnt;
617 OTF_ChainClassSet *ChainClassSet;
622 unsigned BacktrackGlyphCount;
623 OTF_Coverage *Backtrack;
624 unsigned InputGlyphCount;
626 unsigned LookaheadGlyphCount;
627 OTF_Coverage *LookAhead;
628 unsigned LookupCount;
629 OTF_LookupRecord *LookupRecord;
632 /* Common to OTF_GSUB/GPOS. */
637 OTF_ScriptList ScriptList;
638 OTF_FeatureList FeatureList;
639 OTF_LookupList LookupList;
642 /*** (1-9) "GSUB" table */
652 OTF_GlyphID *Substitute;
655 typedef struct OTF_Sequence OTF_Sequence;
659 unsigned SequenceCount;
660 OTF_Sequence *Sequence;
661 } OTF_GSUB_Multiple1;
667 OTF_GlyphID *Substitute;
670 typedef struct OTF_AlternateSet OTF_AlternateSet;
674 unsigned AlternateSetCount;
675 OTF_AlternateSet *AlternateSet;
676 } OTF_GSUB_Alternate1;
678 struct OTF_AlternateSet
682 OTF_GlyphID *Alternate;
685 typedef struct OTF_LigatureSet OTF_LigatureSet;
686 typedef struct OTF_Ligature OTF_Ligature;
690 unsigned LigSetCount;
691 OTF_LigatureSet *LigatureSet;
692 } OTF_GSUB_Ligature1;
694 struct OTF_LigatureSet
697 unsigned LigatureCount;
698 OTF_Ligature *Ligature;
704 OTF_GlyphID LigGlyph;
706 OTF_GlyphID *Component;
709 typedef OTF_Context1 OTF_GSUB_Context1;
711 typedef OTF_Context2 OTF_GSUB_Context2;
713 typedef OTF_Context3 OTF_GSUB_Context3;
715 typedef OTF_ChainContext1 OTF_GSUB_ChainContext1;
717 typedef OTF_ChainContext2 OTF_GSUB_ChainContext2;
719 typedef OTF_ChainContext3 OTF_GSUB_ChainContext3;
723 unsigned ExtensionLookupType;
724 unsigned ExtensionOffset;
725 OTF_LookupSubTableGSUB *ExtensionSubtable;
726 } OTF_GSUB_Extension1;
730 unsigned BacktrackGlyphCount;
731 OTF_Coverage *Backtrack;
732 unsigned LookaheadGlyphCount;
733 OTF_Coverage *LookAhead;
735 OTF_GlyphID *Substitute;
736 } OTF_GSUB_ReverseChain1;
738 struct OTF_LookupSubTableGSUB
741 OTF_Coverage Coverage;
744 OTF_GSUB_Single1 single1;
745 OTF_GSUB_Single2 single2;
747 OTF_GSUB_Multiple1 multiple1;
749 OTF_GSUB_Alternate1 alternate1;
751 OTF_GSUB_Ligature1 ligature1;
753 OTF_GSUB_Context1 context1;
754 OTF_GSUB_Context2 context2;
755 OTF_GSUB_Context3 context3;
757 OTF_GSUB_ChainContext1 chain_context1;
758 OTF_GSUB_ChainContext2 chain_context2;
759 OTF_GSUB_ChainContext3 chain_context3;
761 OTF_GSUB_Extension1 extension1;
763 OTF_GSUB_ReverseChain1 reverse_chain1;
767 typedef OTF_GSUB_GPOS OTF_GSUB;
769 /*** (1-10) "GPOS" table */
773 OTF_XPlacement = 0x0001,
774 OTF_YPlacement = 0x0002,
775 OTF_XAdvance = 0x0004,
776 OTF_YAdvance = 0x0008,
777 OTF_XPlaDevice = 0x0010,
778 OTF_YPlaDevice = 0x0020,
779 OTF_XAdvDevice = 0x0040,
780 OTF_YAdvDevice = 0x0080
789 OTF_DeviceTable XPlaDevice;
790 OTF_DeviceTable YPlaDevice;
791 OTF_DeviceTable XAdvDevice;
792 OTF_DeviceTable YAdvDevice;
798 unsigned AnchorFormat;
803 unsigned AnchorPoint;
806 OTF_DeviceTable XDeviceTable;
807 OTF_DeviceTable YDeviceTable;
815 OTF_Anchor MarkAnchor;
822 OTF_MarkRecord *MarkRecord;
827 unsigned ValueFormat;
828 OTF_ValueRecord Value;
833 unsigned ValueFormat;
835 OTF_ValueRecord *Value; /* [<ValueCount>] */
840 OTF_GlyphID SecondGlyph;
841 OTF_ValueRecord Value1;
842 OTF_ValueRecord Value2;
843 } OTF_PairValueRecord;
848 unsigned PairValueCount;
849 OTF_PairValueRecord *PairValueRecord;
854 unsigned ValueFormat1;
855 unsigned ValueFormat2;
856 unsigned PairSetCount;
857 OTF_PairSet *PairSet;
862 OTF_ValueRecord Value1;
863 OTF_ValueRecord Value2;
868 OTF_Class2Record *Class2Record;
873 unsigned ValueFormat1;
874 unsigned ValueFormat2;
875 OTF_ClassDef ClassDef1;
876 OTF_ClassDef ClassDef2;
877 unsigned Class1Count;
878 unsigned Class2Count;
879 OTF_Class1Record *Class1Record; /* size: <Class1Count> */
884 OTF_Anchor EntryAnchor;
885 OTF_Anchor ExitAnchor;
886 } OTF_EntryExitRecord;
890 unsigned EntryExitCount;
891 OTF_EntryExitRecord *EntryExitRecord;
903 OTF_AnchorRecord *AnchorRecord;
908 OTF_Coverage BaseCoverage;
910 OTF_MarkArray MarkArray;
911 OTF_AnchorArray BaseArray;
912 } OTF_GPOS_MarkBase1;
916 OTF_Anchor *LigatureAnchor; /* [<ClassCount>] */
917 } OTF_ComponentRecord;
922 unsigned ComponentCount;
923 OTF_ComponentRecord *ComponentRecord; /* [<ComponentCount>] */
924 } OTF_LigatureAttach;
929 unsigned LigatureCount;
930 OTF_LigatureAttach *LigatureAttach; /* [<LiagureCount>] */
935 OTF_Coverage LigatureCoverage;
937 OTF_MarkArray MarkArray;
938 OTF_LigatureArray LigatureArray;
943 OTF_Coverage Mark2Coverage;
945 OTF_MarkArray Mark1Array;
946 OTF_AnchorArray Mark2Array;
947 } OTF_GPOS_MarkMark1;
949 typedef OTF_Context1 OTF_GPOS_Context1;
951 typedef OTF_Context2 OTF_GPOS_Context2;
953 typedef OTF_Context3 OTF_GPOS_Context3;
955 typedef OTF_ChainContext1 OTF_GPOS_ChainContext1;
957 typedef OTF_ChainContext2 OTF_GPOS_ChainContext2;
959 typedef OTF_ChainContext3 OTF_GPOS_ChainContext3;
963 unsigned ExtensionLookupType;
964 unsigned ExtensionOffset;
965 OTF_LookupSubTableGPOS *ExtensionSubtable;
966 } OTF_GPOS_Extension1;
969 struct OTF_LookupSubTableGPOS
972 OTF_Coverage Coverage;
975 OTF_GPOS_Single1 single1;
976 OTF_GPOS_Single2 single2;
978 OTF_GPOS_Pair1 pair1;
979 OTF_GPOS_Pair2 pair2;
981 OTF_GPOS_Cursive1 cursive1;
983 OTF_GPOS_MarkBase1 mark_base1;
985 OTF_GPOS_MarkLig1 mark_lig1;
987 OTF_GPOS_MarkMark1 mark_mark1;
989 OTF_GPOS_Context1 context1;
990 OTF_GPOS_Context2 context2;
991 OTF_GPOS_Context3 context3;
993 OTF_GPOS_ChainContext1 chain_context1;
994 OTF_GPOS_ChainContext2 chain_context2;
995 OTF_GPOS_ChainContext3 chain_context3;
997 OTF_GPOS_Extension1 extension1;
1001 typedef OTF_GSUB_GPOS OTF_GPOS;
1003 /*** (1-11) Structure for OTF */
1007 OTF_Fixed sfnt_version;
1009 unsigned searchRange;
1010 unsigned enterSelector;
1011 unsigned rangeShift;
1021 } OTF_TableDirectory;
1023 typedef struct OTF_InternalData OTF_InternalData;
1028 OTF_OffsetTable offset_table;
1029 OTF_TableDirectory *table_dirs;
1036 /* The following tables are not yet supported. */
1037 /* OTF_BASE *base; */
1038 /* OTF_JSTF *jstf; */
1039 OTF_InternalData *internal_data;
1043 /*** (2) API for reading OTF */
1045 /*** (2-1) otf_open () */
1050 The OTF_open() function reads the OpenType font file whose name is
1051 $NAME, and return a pointer to the structure of type OTF.
1053 It setups these member of the structure OTF:
1054 filename, offset_table, table_dirs
1056 If the file can't be read or the file contains invalid data, NULL
1057 is returned, and the variable OTF_error is set to one of the
1064 See also OTF_get_table() and OTF_close(). */
1066 extern OTF *OTF_open (char *name);
1069 /*** (2-2) OTF_close () */
1074 The OTF_close() function closes the OpenType font $OTF which must
1075 be what the OTF_open() function returned.
1077 See also OTF_open(). */
1079 extern void OTF_close (OTF *otf);
1082 /*** (2-3) OTF_get_table () */
1085 Get OpenType font table
1087 The OTF_get_table() function setups one of the OTF table specified
1088 by $NAME in the OpenType font $OTF.
1090 $NAME must be one of "head", "name", "cmap", "GDEF", "GSUB", and
1091 "GPOS", and a member of the same name is setup.
1093 If the table is successfully setup, return 0. Otherwise, return
1094 -1, and set the variable OTF_error to OTF_ERROR_TABLE.
1096 See also OTF_open(). */
1098 extern int OTF_get_table (OTF *otf, char *name);
1100 /*** (2-4) OTF_check_table () */
1103 Check the existence of OpenType font table
1105 The OTF_check_table() function checks if the the OTF table
1106 specified by $NAME exists in OpenType font $OTF.
1108 If the table exists, return 0, else return -1.
1110 See also OTF_open(). */
1112 extern int OTF_check_table (OTF *otf, char *name);
1115 /*** (3) API for driving OTF */
1117 /*** (3-1) Structure for glyph string */
1120 The structure OTF_Glyph contains information about each glyph in
1121 the structure OTF_GlyphString. */
1125 /** The first two members must be set by a clinet before calling the
1126 function OTF_drive_XXX(). **/
1128 /* Character code of the glyph. The value less than 32 is treated
1129 as a place-holder in a glyph string, and OTF_drive_XXX ()
1130 function just ignore the glyph as if it doesn't exist. */
1133 /* Glyph ID of the glyph. If the value is 0, the library gets a
1134 correct value from the above character code via cmap. */
1135 OTF_GlyphID glyph_id;
1137 /* GlyphClass of the glyph. The value is extracted from the GDEF
1139 enum OTF_GlyphClassDef GlyphClass;
1141 /* MarkAttachClassDef of the glyph. The value is extracted from the
1143 unsigned MarkAttachClass;
1145 /* Positioning format type of the glyph. The value specifies how
1146 the glyph positioning information is encoded in the member <f>.
1147 If the value is N, the union member fN, is used. If the value is
1148 zero, the glyph has no positioning information, i.e. it should be
1149 drawn at the normal position. */
1150 int positioning_type;
1156 enum OTF_ValueFormat format;
1157 OTF_ValueRecord *value;
1160 enum OTF_ValueFormat format;
1161 OTF_ValueRecord *value;
1164 OTF_Anchor *entry_anchor;
1165 OTF_Anchor *exit_anchor;
1168 OTF_Anchor *mark_anchor;
1169 OTF_Anchor *base_anchor;
1172 OTF_Anchor *mark_anchor;
1173 OTF_Anchor *ligature_anchor;
1176 OTF_Anchor *mark1_anchor;
1177 OTF_Anchor *mark2_anchor;
1183 The structure OTF_GlyphString contains an array of glyphs (type
1184 OTF_Glyph). It is used as arguments of otf_drive_XXX(). */
1188 /* How many glyphs are allocated at the memory pointed by the member
1191 /* How many glyphs contain valid information. */
1193 /* Array of glyphs. It must be allocated by malloc(). The
1194 functions otf_drive_XXX() may reallocate it and increase the
1195 members <size> and <used>. */
1200 /*** (3-2) OTF_drive_cmap() */
1203 Process glyph string by Unicode-based cmap table.
1205 The OTF_drive_cmap() function looks up a Unicode-based cmap table
1206 of OpenType font $OTF, and setup the member <glyhph_id> of all
1207 glhphs in the glyph string $GSTRING if the value of the member is
1210 extern int OTF_drive_cmap (OTF *otf, OTF_GlyphString *gstring);
1213 Process glyph string by a specific cmap table.
1215 The OTF_drive_cmap2() function looks up a cmap table (whose
1216 Platform-ID is $PLATFORM_ID an Encoding-ID is $ENCODING_ID) of
1217 OpenType font $OTF, and setup the member <glyhph_id> of all glhphs
1218 in the glyph string $GSTRING if the value of the member is not
1221 extern int OTF_drive_cmap2 (OTF *otf, OTF_GlyphString *gstring,
1222 int platform_id, int encoding_id);
1224 /*** (3-3) OTF_drive_gdef() */
1227 Process glyph string by GDEF table.
1229 The OTF_drive_gdef() function looks up the GDEF table of OpenType
1230 font $OTF, and setup members <GlyphClass> and <MarkAttachClass> of
1231 all glhphs in the glyph string $GSTRING. */
1233 extern int OTF_drive_gdef (OTF *otf, OTF_GlyphString *gstring);
1236 /*** (3-4) OTF_drive_gsub() */
1239 Process glyph string by GSUB table.
1241 The OTF_drive_gsub() function looks up the GSUB table of OpenType
1242 font $OTF, and by using features the font has for script $SCRIPT
1243 and language system $LANGSYS, update member <glyphs> of the glyph
1244 string $GSTRING. It may substitute, delete, insert glyphs in that
1245 array. $FEATURES is a list of features to apply. This doesn't
1246 perform a lookup of type 3 (Alternate Substitution). For that,
1247 use OTF_drive_gsub_alternate(). */
1249 extern int OTF_drive_gsub (OTF *otf, OTF_GlyphString *gstring,
1250 char *script, char *language, char *features);
1252 /*** (3-5) OTF_drive_gpos() */
1255 Process glyph string by GPOS table.
1257 The OTF_drive_gdef() function looks up the GPOS table of $OTF of
1258 OpenType font $OTF, and by using features the font has for script
1259 $SCRIPT and language system $LANGSYS, setup members
1260 <positioning_type> and <f> of all glhphs in the glyph string
1261 $GSTRING. $FEATURES is a list of features to apply. */
1263 extern int OTF_drive_gpos (OTF *otf, OTF_GlyphString *gstring,
1264 char *script, char *language, char *features);
1266 /*** (3-6) OTF_drive_tables() */
1269 Process glyph string by cmap, GDEF, GSUB, and GPOS tables.
1271 The OTF_drive_tables() function calls OTF_drive_cmap(),
1272 OTF_drive_gdef(), OTF_drive_gsub(), and OTF_drive_gpos() in this
1273 order, and update the glyphs string GSTRING. */
1275 extern int OTF_drive_tables (OTF *otf, OTF_GlyphString *gstring,
1276 char *script, char *language,
1277 char *gsub_features, char *gpos_features);
1280 /*** (3-7) OTF_get_unicode() */
1283 Return Unicode code point corresponding to the glyph-id CODE.
1286 extern int OTF_get_unicode (OTF *otf, OTF_GlyphID code);
1288 /*** (3-8) OTF_drive_gsub_alternate() */
1291 Find alternate glyphs.
1293 This is like OTF_drive_gsub(), but perform only a lookup of type 3
1294 (Alternate Substituion). */
1296 extern int OTF_drive_gsub_alternate (OTF *otf, OTF_GlyphString *gstring,
1297 char *script, char *language,
1300 /*** (4) API for error handling ***/
1302 /*** (4-1) Error codes ***/
1305 Global variable holding an error code.
1307 The variable OTF_error is set to one of OTF_ERROR_XXX macros when
1308 an error is detected in the OTF library. */
1309 extern int OTF_error;
1312 Memory allocation error
1314 This error indicates that the library couldn't allocate
1316 #define OTF_ERROR_MEMORY 1
1321 This error indicates that the library fails in opening, reading,
1322 or seeking an OTF file. */
1323 #define OTF_ERROR_FILE 2
1326 Invalid table contents
1328 This error indicates that an OTF file contains invalid data. */
1329 #define OTF_ERROR_TABLE 3
1334 See the function otf_drive_cmap() for more detail. */
1335 #define OTF_ERROR_CMAP_DRIVE 4
1340 See the function OTF_drive_gdef() for more detail. */
1341 #define OTF_ERROR_GDEF_DRIVE 5
1346 See the function OTF_drive_gsub() for more detail. */
1347 #define OTF_ERROR_GSUB_DRIVE 6
1352 See the function OTF_drive_gpos() for more detail. */
1353 #define OTF_ERROR_GPOS_DRIVE 7
1356 /*** (4-2) OTF_perror() */
1359 Print an OTF error message
1361 The OTF_perror() function produces a message on the standard error
1362 output, describing the last error encountered during a call to the
1363 OTF library function. If $PREFIX is not NULL, it is printed
1364 first, followed by a colon and a blank. Then the message and a
1367 extern void OTF_perror (char *prefix);
1370 /*** (5) API miscellaneous ***/
1373 Return OTF tag of a specified name string.
1375 The OTF_tag() function returns OTF tag of name $NAME. If $NAME is
1376 NULL, return 0. Otherwise, $NAME must be at least 4-byte length.
1377 Only the first 4 characters are took into an account. */
1379 extern OTF_Tag OTF_tag (char *name);
1382 Convert OTF tag to name string.
1384 The OTF_tag_name() function converts OTF tag $TAG to a 5-byte name
1385 string (including the terminating NULL), and store it in $NAME.
1386 At least 5-byte space must be at $NAME. */
1388 extern void OTF_tag_name (OTF_Tag tag, char *name);
1391 #endif /* not _OTF_H_ */