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 = 0x0008,
464 OTF_Reserved = 0x00F0,
465 OTF_MarkAttachmentType = 0xFF00
468 #define OTF_LookupFlagIgnoreMask \
469 (OTF_IgnoreBaseGlyphs | OTF_IgnoreLigatures | OTF_IgnoreMarks)
476 unsigned SubTableCount;
477 OTF_Offset *SubTableOffset;
479 OTF_LookupSubTableGSUB *gsub;
480 OTF_LookupSubTableGPOS *gpos;
487 unsigned LookupCount;
492 /*** (1-8) Structures common to GSUB and GPOS */
494 /* For SubstLookupRecord (GSUB) and PosLookupRecord (GPOS). */
498 unsigned SequenceIndex;
499 unsigned LookupListIndex;
506 unsigned LookupCount;
507 OTF_GlyphID *Input; /* [<GlyphCount> - 1] */
508 OTF_LookupRecord *LookupRecord; /* [<LookupCount>] */
515 OTF_Rule *Rule; /* [<RuleCount>] */
522 unsigned LookupCount;
523 unsigned *Class; /* [<GlyphCount> - 1] */
524 OTF_LookupRecord *LookupRecord; /* [<LookupCount>] */
530 unsigned ClassRuleCnt;
531 OTF_ClassRule *ClassRule; /* [<ClassRuleCnt>] */
537 unsigned BacktrackGlyphCount;
538 OTF_GlyphID *Backtrack;
539 unsigned InputGlyphCount;
541 unsigned LookaheadGlyphCount;
542 OTF_GlyphID *LookAhead;
543 unsigned LookupCount;
544 OTF_LookupRecord *LookupRecord;
550 unsigned ChainRuleCount;
551 OTF_ChainRule *ChainRule;
557 unsigned BacktrackGlyphCount;
559 unsigned InputGlyphCount;
561 unsigned LookaheadGlyphCount;
563 unsigned LookupCount;
564 OTF_LookupRecord *LookupRecord;
565 } OTF_ChainClassRule;
570 unsigned ChainClassRuleCnt;
571 OTF_ChainClassRule *ChainClassRule;
575 /* Common to OTF_GSUB/GPOS_Context1/2/3. */
579 unsigned RuleSetCount;
580 OTF_RuleSet *RuleSet; /* [<RuleSetCount>] */
585 OTF_ClassDef ClassDef;
586 unsigned ClassSetCnt;
587 OTF_ClassSet *ClassSet; /* [<ClassSetCnt>] */
593 unsigned LookupCount;
594 OTF_Coverage *Coverage; /* [<GlyphCount>] */
595 OTF_LookupRecord *LookupRecord; /* [<LookupCount>] */
599 /* Common to OTF_GSUB/GPOS_ChainContext1/2/3. */
603 unsigned ChainRuleSetCount;
604 OTF_ChainRuleSet *ChainRuleSet;
609 OTF_ClassDef BacktrackClassDef;
610 OTF_ClassDef InputClassDef;
611 OTF_ClassDef LookaheadClassDef;
612 unsigned ChainClassSetCnt;
613 OTF_ChainClassSet *ChainClassSet;
618 unsigned BacktrackGlyphCount;
619 OTF_Coverage *Backtrack;
620 unsigned InputGlyphCount;
622 unsigned LookaheadGlyphCount;
623 OTF_Coverage *LookAhead;
624 unsigned LookupCount;
625 OTF_LookupRecord *LookupRecord;
628 /* Common to OTF_GSUB/GPOS. */
633 OTF_ScriptList ScriptList;
634 OTF_FeatureList FeatureList;
635 OTF_LookupList LookupList;
638 /*** (1-9) "GSUB" table */
648 OTF_GlyphID *Substitute;
651 typedef struct OTF_Sequence OTF_Sequence;
655 unsigned SequenceCount;
656 OTF_Sequence *Sequence;
657 } OTF_GSUB_Multiple1;
663 OTF_GlyphID *Substitute;
666 typedef struct OTF_AlternateSet OTF_AlternateSet;
670 unsigned AlternateSetCount;
671 OTF_AlternateSet *AlternateSet;
672 } OTF_GSUB_Alternate1;
674 struct OTF_AlternateSet
678 OTF_GlyphID *Alternate;
681 typedef struct OTF_LigatureSet OTF_LigatureSet;
682 typedef struct OTF_Ligature OTF_Ligature;
686 unsigned LigSetCount;
687 OTF_LigatureSet *LigatureSet;
688 } OTF_GSUB_Ligature1;
690 struct OTF_LigatureSet
693 unsigned LigatureCount;
694 OTF_Ligature *Ligature;
700 OTF_GlyphID LigGlyph;
702 OTF_GlyphID *Component;
705 typedef OTF_Context1 OTF_GSUB_Context1;
707 typedef OTF_Context2 OTF_GSUB_Context2;
709 typedef OTF_Context3 OTF_GSUB_Context3;
711 typedef OTF_ChainContext1 OTF_GSUB_ChainContext1;
713 typedef OTF_ChainContext2 OTF_GSUB_ChainContext2;
715 typedef OTF_ChainContext3 OTF_GSUB_ChainContext3;
719 unsigned ExtensionLookupType;
720 unsigned ExtensionOffset;
721 OTF_LookupSubTableGSUB *ExtensionSubtable;
722 } OTF_GSUB_Extension1;
726 unsigned BacktrackGlyphCount;
727 OTF_Coverage *Backtrack;
728 unsigned LookaheadGlyphCount;
729 OTF_Coverage *LookAhead;
731 OTF_GlyphID *Substitute;
732 } OTF_GSUB_ReverseChain1;
734 struct OTF_LookupSubTableGSUB
737 OTF_Coverage Coverage;
740 OTF_GSUB_Single1 single1;
741 OTF_GSUB_Single2 single2;
743 OTF_GSUB_Multiple1 multiple1;
745 OTF_GSUB_Alternate1 alternate1;
747 OTF_GSUB_Ligature1 ligature1;
749 OTF_GSUB_Context1 context1;
750 OTF_GSUB_Context2 context2;
751 OTF_GSUB_Context3 context3;
753 OTF_GSUB_ChainContext1 chain_context1;
754 OTF_GSUB_ChainContext2 chain_context2;
755 OTF_GSUB_ChainContext3 chain_context3;
757 OTF_GSUB_Extension1 extension1;
759 OTF_GSUB_ReverseChain1 reverse_chain1;
763 typedef OTF_GSUB_GPOS OTF_GSUB;
765 /*** (1-10) "GPOS" table */
769 OTF_XPlacement = 0x0001,
770 OTF_YPlacement = 0x0002,
771 OTF_XAdvance = 0x0004,
772 OTF_YAdvance = 0x0008,
773 OTF_XPlaDevice = 0x0010,
774 OTF_YPlaDevice = 0x0020,
775 OTF_XAdvDevice = 0x0040,
776 OTF_YAdvDevice = 0x0080
785 OTF_DeviceTable XPlaDevice;
786 OTF_DeviceTable YPlaDevice;
787 OTF_DeviceTable XAdvDevice;
788 OTF_DeviceTable YAdvDevice;
794 unsigned AnchorFormat;
799 unsigned AnchorPoint;
802 OTF_DeviceTable XDeviceTable;
803 OTF_DeviceTable YDeviceTable;
811 OTF_Anchor MarkAnchor;
818 OTF_MarkRecord *MarkRecord;
823 unsigned ValueFormat;
824 OTF_ValueRecord Value;
829 unsigned ValueFormat;
831 OTF_ValueRecord *Value; /* [<ValueCount>] */
836 OTF_GlyphID SecondGlyph;
837 OTF_ValueRecord Value1;
838 OTF_ValueRecord Value2;
839 } OTF_PairValueRecord;
844 unsigned PairValueCount;
845 OTF_PairValueRecord *PairValueRecord;
850 unsigned ValueFormat1;
851 unsigned ValueFormat2;
852 unsigned PairSetCount;
853 OTF_PairSet *PairSet;
858 OTF_ValueRecord Value1;
859 OTF_ValueRecord Value2;
864 OTF_Class2Record *Class2Record;
869 unsigned ValueFormat1;
870 unsigned ValueFormat2;
871 OTF_ClassDef ClassDef1;
872 OTF_ClassDef ClassDef2;
873 unsigned Class1Count;
874 unsigned Class2Count;
875 OTF_Class1Record *Class1Record; /* size: <Class1Count> */
880 OTF_Anchor EntryAnchor;
881 OTF_Anchor ExitAnchor;
882 } OTF_EntryExitRecord;
886 unsigned EntryExitCount;
887 OTF_EntryExitRecord *EntryExitRecord;
899 OTF_AnchorRecord *AnchorRecord;
904 OTF_Coverage BaseCoverage;
906 OTF_MarkArray MarkArray;
907 OTF_AnchorArray BaseArray;
908 } OTF_GPOS_MarkBase1;
912 OTF_Anchor *LigatureAnchor; /* [<ClassCount>] */
913 } OTF_ComponentRecord;
918 unsigned ComponentCount;
919 OTF_ComponentRecord *ComponentRecord; /* [<ComponentCount>] */
920 } OTF_LigatureAttach;
925 unsigned LigatureCount;
926 OTF_LigatureAttach *LigatureAttach; /* [<LiagureCount>] */
931 OTF_Coverage LigatureCoverage;
933 OTF_MarkArray MarkArray;
934 OTF_LigatureArray LigatureArray;
939 OTF_Coverage Mark2Coverage;
941 OTF_MarkArray Mark1Array;
942 OTF_AnchorArray Mark2Array;
943 } OTF_GPOS_MarkMark1;
945 typedef OTF_Context1 OTF_GPOS_Context1;
947 typedef OTF_Context2 OTF_GPOS_Context2;
949 typedef OTF_Context3 OTF_GPOS_Context3;
951 typedef OTF_ChainContext1 OTF_GPOS_ChainContext1;
953 typedef OTF_ChainContext2 OTF_GPOS_ChainContext2;
955 typedef OTF_ChainContext3 OTF_GPOS_ChainContext3;
959 unsigned ExtensionLookupType;
960 unsigned ExtensionOffset;
961 OTF_LookupSubTableGPOS *ExtensionSubtable;
962 } OTF_GPOS_Extension1;
965 struct OTF_LookupSubTableGPOS
968 OTF_Coverage Coverage;
971 OTF_GPOS_Single1 single1;
972 OTF_GPOS_Single2 single2;
974 OTF_GPOS_Pair1 pair1;
975 OTF_GPOS_Pair2 pair2;
977 OTF_GPOS_Cursive1 cursive1;
979 OTF_GPOS_MarkBase1 mark_base1;
981 OTF_GPOS_MarkLig1 mark_lig1;
983 OTF_GPOS_MarkMark1 mark_mark1;
985 OTF_GPOS_Context1 context1;
986 OTF_GPOS_Context2 context2;
987 OTF_GPOS_Context3 context3;
989 OTF_GPOS_ChainContext1 chain_context1;
990 OTF_GPOS_ChainContext2 chain_context2;
991 OTF_GPOS_ChainContext3 chain_context3;
993 OTF_GPOS_Extension1 extension1;
997 typedef OTF_GSUB_GPOS OTF_GPOS;
999 /*** (1-11) Structure for OTF */
1003 OTF_Fixed sfnt_version;
1005 unsigned searchRange;
1006 unsigned enterSelector;
1007 unsigned rangeShift;
1017 } OTF_TableDirectory;
1019 typedef struct OTF_InternalData OTF_InternalData;
1024 OTF_OffsetTable offset_table;
1025 OTF_TableDirectory *table_dirs;
1032 /* The following tables are not yet supported. */
1033 /* OTF_BASE *base; */
1034 /* OTF_JSTF *jstf; */
1035 OTF_InternalData *internal_data;
1039 /*** (2) API for reading OTF */
1041 /*** (2-1) otf_open () */
1046 The OTF_open() function reads the OpenType font file whose name is
1047 $NAME, and return a pointer to the structure of type OTF.
1049 It setups these member of the structure OTF:
1050 filename, offset_table, table_dirs
1052 If the file can't be read or the file contains invalid data, NULL
1053 is returned, and the variable OTF_error is set to one of the
1060 See also OTF_get_table() and OTF_close(). */
1062 extern OTF *OTF_open (char *name);
1065 /*** (2-2) OTF_close () */
1070 The OTF_close() function closes the OpenType font $OTF which must
1071 be what the OTF_open() function returned.
1073 See also OTF_open(). */
1075 extern void OTF_close (OTF *otf);
1078 /*** (2-3) OTF_get_table () */
1081 Get OpenType font table
1083 The OTF_get_table() function setups one of the OTF table specified
1084 by $NAME in the OpenType font $OTF.
1086 $NAME must be one of "head", "name", "cmap", "GDEF", "GSUB", and
1087 "GPOS", and a member of the same name is setup.
1089 If the table is successfully setup, return 0. Otherwise, return
1090 -1, and set the variable OTF_error to OTF_ERROR_TABLE.
1092 See also OTF_open(). */
1094 extern int OTF_get_table (OTF *otf, char *name);
1096 /*** (2-4) OTF_check_table () */
1099 Check the existence of OpenType font table
1101 The OTF_check_table() function checks if the the OTF table
1102 specified by $NAME exists in OpenType font $OTF.
1104 If the table exists, return 0, else return -1.
1106 See also OTF_open(). */
1108 extern int OTF_check_table (OTF *otf, char *name);
1111 /*** (3) API for driving OTF */
1113 /*** (3-1) Structure for glyph string */
1116 The structure OTF_Glyph contains information about each glyph in
1117 the structure OTF_GlyphString. */
1121 /** The first two members must be set by a clinet before calling the
1122 function OTF_drive_XXX(). **/
1124 /* Character code of the glyph. The value less than 32 is treated
1125 as a place-holder in a glyph string, and OTF_drive_XXX ()
1126 function just ignore the glyph as if it doesn't exist. */
1129 /* Glyph ID of the glyph. If the value is 0, the library gets a
1130 correct value from the above character code via cmap. */
1131 OTF_GlyphID glyph_id;
1133 /* GlyphClass of the glyph. The value is extracted from the GDEF
1135 enum OTF_GlyphClassDef GlyphClass;
1137 /* MarkAttachClassDef of the glyph. The value is extracted from the
1139 unsigned MarkAttachClass;
1141 /* Positioning format type of the glyph. The value specifies how
1142 the glyph positioning information is encoded in the member <f>.
1143 If the value is N, the union member fN, is used. If the value is
1144 zero, the glyph has no positioning information, i.e. it should be
1145 drawn at the normal position. */
1146 int positioning_type;
1152 enum OTF_ValueFormat format;
1153 OTF_ValueRecord *value;
1156 enum OTF_ValueFormat format;
1157 OTF_ValueRecord *value;
1160 OTF_Anchor *entry_anchor;
1161 OTF_Anchor *exit_anchor;
1164 OTF_Anchor *mark_anchor;
1165 OTF_Anchor *base_anchor;
1168 OTF_Anchor *mark_anchor;
1169 OTF_Anchor *ligature_anchor;
1172 OTF_Anchor *mark1_anchor;
1173 OTF_Anchor *mark2_anchor;
1179 The structure OTF_GlyphString contains an array of glyphs (type
1180 OTF_Glyph). It is used as arguments of otf_drive_XXX(). */
1184 /* How many glyphs are allocated at the memory pointed by the member
1187 /* How many glyphs contains valid information. */
1189 /* Array of glyphs. It must be allocated by malloc(). The
1190 functions otf_drive_XXX() may reallocate it and increase the
1191 members <size> and <used>. */
1196 /*** (3-2) OTF_drive_cmap() */
1199 Process glyph string by Unicode-based cmap table.
1201 The OTF_drive_cmap() function looks up a Unicode-based cmap table
1202 of OpenType font $OTF, and setup the member <glyhph_id> of all
1203 glhphs in the glyph string $GSTRING if the value of the member is
1206 extern int OTF_drive_cmap (OTF *otf, OTF_GlyphString *gstring);
1209 Process glyph string by a specific cmap table.
1211 The OTF_drive_cmap2() function looks up a cmap table (whose
1212 Platform-ID is $PLATFORM_ID an Encoding-ID is $ENCODING_ID) of
1213 OpenType font $OTF, and setup the member <glyhph_id> of all glhphs
1214 in the glyph string $GSTRING if the value of the member is not
1217 extern int OTF_drive_cmap2 (OTF *otf, OTF_GlyphString *gstring,
1218 int platform_id, int encoding_id);
1220 /*** (3-3) OTF_drive_gdef() */
1223 Process glyph string by GDEF table.
1225 The OTF_drive_gdef() function looks up the GDEF table of OpenType
1226 font $OTF, and setup members <GlyphClass> and <MarkAttachClass> of
1227 all glhphs in the glyph string $GSTRING. */
1229 extern int OTF_drive_gdef (OTF *otf, OTF_GlyphString *gstring);
1232 /*** (3-4) OTF_drive_gsub() */
1235 Process glyph string by GSUB table.
1237 The OTF_drive_gsub() function looks up the GSUB table of OpenType
1238 font $OTF, and by using features the font has for script $SCRIPT
1239 and language system $LANGSYS, update member <glyphs> of the glyph
1240 string $GSTRING. It may substitute, delete, insert glyphs in that
1241 array. $FEATURES is a list of features to apply. */
1243 extern int OTF_drive_gsub (OTF *otf, OTF_GlyphString *gstring,
1244 char *script, char *language, char *features);
1246 /*** (3-5) OTF_drive_gpos() */
1249 Process glyph string by GPOS table.
1251 The OTF_drive_gdef() function looks up the GPOS table of $OTF of
1252 OpenType font $OTF, and by using features the font has for script
1253 $SCRIPT and language system $LANGSYS, setup members
1254 <positioning_type> and <f> of all glhphs in the glyph string
1255 $GSTRING. $FEATURES is a list of features to apply. */
1257 extern int OTF_drive_gpos (OTF *otf, OTF_GlyphString *gstring,
1258 char *script, char *language, char *features);
1260 /*** (3-6) OTF_drive_tables() */
1263 Process glyph string by cmap, GDEF, GSUB, and GPOS tables.
1265 The OTF_drive_tables() function calls OTF_drive_cmap(),
1266 OTF_drive_gdef(), OTF_drive_gsub(), and OTF_drive_gpos() in this
1267 order, and update the glyphs string GSTRING. */
1269 extern int OTF_drive_tables (OTF *otf, OTF_GlyphString *gstring,
1270 char *script, char *language,
1271 char *gsub_features, char *gpos_features);
1274 /*** (3-7) OTF_get_unicode() */
1277 Return Unicode code point corresponding to the glyph-id CODE.
1280 extern int OTF_get_unicode (OTF *otf, OTF_GlyphID code);
1282 /*** (4) API for error handling ***/
1284 /*** (4-1) Error codes ***/
1287 Global variable holding an error code.
1289 The variable OTF_error is set to one of OTF_ERROR_XXX macros when
1290 an error is detected in the OTF library. */
1291 extern int OTF_error;
1294 Memory allocation error
1296 This error indicates that the library couldn't allocate
1298 #define OTF_ERROR_MEMORY 1
1303 This error indicates that the library fails in opening, reading,
1304 or seeking an OTF file. */
1305 #define OTF_ERROR_FILE 2
1308 Invalid table contents
1310 This error indicates that an OTF file contains invalid data. */
1311 #define OTF_ERROR_TABLE 3
1316 See the function otf_drive_cmap() for more detail. */
1317 #define OTF_ERROR_CMAP_DRIVE 4
1322 See the function OTF_drive_gdef() for more detail. */
1323 #define OTF_ERROR_GDEF_DRIVE 5
1328 See the function OTF_drive_gsub() for more detail. */
1329 #define OTF_ERROR_GSUB_DRIVE 6
1334 See the function OTF_drive_gpos() for more detail. */
1335 #define OTF_ERROR_GPOS_DRIVE 7
1338 /*** (4-2) OTF_perror() */
1341 Print an OTF error message
1343 The OTF_perror() function produces a message on the standard error
1344 output, describing the last error encountered during a call to the
1345 OTF library function. If $PREFIX is not NULL, it is printed
1346 first, followed by a colon and a blank. Then the message and a
1349 extern void OTF_perror (char *prefix);
1352 /*** (5) API miscellaneous ***/
1355 Return OTF tag of a specified name string.
1357 The OTF_tag() function returns OTF tag of name $NAME. If $NAME is
1358 NULL, return 0. Otherwise, $NAME must be at least 4-byte length.
1359 Only the first 4 characters are took into an account. */
1361 extern OTF_Tag OTF_tag (char *name);
1364 Convert OTF tag to name string.
1366 The OTF_tag_name() function converts OTF tag $TAG to a 5-byte name
1367 string (including the terminating NULL), and store it in $NAME.
1368 At least 5-byte space must be at $NAME. */
1370 extern void OTF_tag_name (OTF_Tag tag, char *name);
1373 #endif /* not _OTF_H_ */