Eneboo - Documentación para desarrolladores
|
00001 /******************************************************************* 00002 * 00003 * ftxgdef.h 00004 * 00005 * TrueType Open GDEF table support 00006 * 00007 * Copyright 1996-2000 by 00008 * David Turner, Robert Wilhelm, and Werner Lemberg. 00009 * 00010 * This file is part of the FreeType project, and may only be used 00011 * modified and distributed under the terms of the FreeType project 00012 * license, LICENSE.TXT. By continuing to use, modify, or distribute 00013 * this file you indicate that you have read the license and 00014 * understand and accept it fully. 00015 * 00016 ******************************************************************/ 00017 00018 #ifndef FTXOPEN_H 00019 #error "Don't include this file! Use ftxopen.h instead." 00020 #endif 00021 00022 #ifndef FTXGDEF_H 00023 #define FTXGDEF_H 00024 00025 #ifdef __cplusplus 00026 extern "C" { 00027 #endif 00028 00029 #define TTO_Err_Invalid_GDEF_SubTable_Format 0x1030 00030 #define TTO_Err_Invalid_GDEF_SubTable 0x1031 00031 00032 00033 /* GDEF glyph classes */ 00034 00035 #define UNCLASSIFIED_GLYPH 0 00036 #define SIMPLE_GLYPH 1 00037 #define LIGATURE_GLYPH 2 00038 #define MARK_GLYPH 3 00039 #define COMPONENT_GLYPH 4 00040 00041 /* GDEF glyph properties, corresponding to class values 1-4. Note that 00042 TTO_COMPONENT has no corresponding flag in the LookupFlag field. */ 00043 00044 #define TTO_BASE_GLYPH 0x0002 00045 #define TTO_LIGATURE 0x0004 00046 #define TTO_MARK 0x0008 00047 #define TTO_COMPONENT 0x0010 00048 00049 00050 /* Attachment related structures */ 00051 00052 struct TTO_AttachPoint_ 00053 { 00054 FT_UShort PointCount; /* size of the PointIndex array */ 00055 FT_UShort* PointIndex; /* array of contour points */ 00056 }; 00057 00058 typedef struct TTO_AttachPoint_ TTO_AttachPoint; 00059 00060 00061 struct TTO_AttachList_ 00062 { 00063 FT_Bool loaded; 00064 00065 TTO_Coverage Coverage; /* Coverage table */ 00066 FT_UShort GlyphCount; /* number of glyphs with 00067 attachments */ 00068 TTO_AttachPoint* AttachPoint; /* array of AttachPoint tables */ 00069 }; 00070 00071 typedef struct TTO_AttachList_ TTO_AttachList; 00072 00073 00074 /* Ligature Caret related structures */ 00075 00076 struct TTO_CaretValueFormat1_ 00077 { 00078 FT_Short Coordinate; /* x or y value (in design units) */ 00079 }; 00080 00081 typedef struct TTO_CaretValueFormat1_ TTO_CaretValueFormat1; 00082 00083 00084 struct TTO_CaretValueFormat2_ 00085 { 00086 FT_UShort CaretValuePoint; /* contour point index on glyph */ 00087 }; 00088 00089 typedef struct TTO_CaretValueFormat2_ TTO_CaretValueFormat2; 00090 00091 00092 struct TTO_CaretValueFormat3_ 00093 { 00094 FT_Short Coordinate; /* x or y value (in design units) */ 00095 TTO_Device Device; /* Device table for x or y value */ 00096 }; 00097 00098 typedef struct TTO_CaretValueFormat3_ TTO_CaretValueFormat3; 00099 00100 00101 struct TTO_CaretValueFormat4_ 00102 { 00103 FT_UShort IdCaretValue; /* metric ID */ 00104 }; 00105 00106 typedef struct TTO_CaretValueFormat4_ TTO_CaretValueFormat4; 00107 00108 00109 struct TTO_CaretValue_ 00110 { 00111 FT_UShort CaretValueFormat; /* 1, 2, 3, or 4 */ 00112 00113 union 00114 { 00115 TTO_CaretValueFormat1 cvf1; 00116 TTO_CaretValueFormat2 cvf2; 00117 TTO_CaretValueFormat3 cvf3; 00118 TTO_CaretValueFormat4 cvf4; 00119 } cvf; 00120 }; 00121 00122 typedef struct TTO_CaretValue_ TTO_CaretValue; 00123 00124 00125 struct TTO_LigGlyph_ 00126 { 00127 FT_Bool loaded; 00128 00129 FT_UShort CaretCount; /* number of caret values */ 00130 TTO_CaretValue* CaretValue; /* array of caret values */ 00131 }; 00132 00133 typedef struct TTO_LigGlyph_ TTO_LigGlyph; 00134 00135 00136 struct TTO_LigCaretList_ 00137 { 00138 FT_Bool loaded; 00139 00140 TTO_Coverage Coverage; /* Coverage table */ 00141 FT_UShort LigGlyphCount; /* number of ligature glyphs */ 00142 TTO_LigGlyph* LigGlyph; /* array of LigGlyph tables */ 00143 }; 00144 00145 typedef struct TTO_LigCaretList_ TTO_LigCaretList; 00146 00147 00148 /* The `NewGlyphClasses' field is not defined in the TTO specification. 00149 We use it for fonts with a constructed `GlyphClassDef' structure 00150 (i.e., which don't have a GDEF table) to collect glyph classes 00151 assigned during the lookup process. The number of arrays in this 00152 pointer array is GlyphClassDef->cd.cd2.ClassRangeCount+1; the nth 00153 array then contains the glyph class values of the glyphs not covered 00154 by the ClassRangeRecords structures with index n-1 and n. We store 00155 glyph class values for four glyphs in a single array element. 00156 00157 `LastGlyph' is identical to the number of glyphs minus one in the 00158 font; we need it only if `NewGlyphClasses' is not NULL (to have an 00159 upper bound for the last array). 00160 00161 Note that we first store the file offset to the `MarkAttachClassDef' 00162 field (which has been introduced in OpenType 1.2) -- since the 00163 `Version' field value hasn't been increased to indicate that we have 00164 one more field for some obscure reason, we must parse the GSUB table 00165 to find out whether class values refer to this table. Only then we 00166 can finally load the MarkAttachClassDef structure if necessary. */ 00167 00168 struct TTO_GDEFHeader_ 00169 { 00170 FT_Memory memory; 00171 FT_ULong offset; 00172 00173 FT_Fixed Version; 00174 00175 TTO_ClassDefinition GlyphClassDef; 00176 TTO_AttachList AttachList; 00177 TTO_LigCaretList LigCaretList; 00178 FT_ULong MarkAttachClassDef_offset; 00179 TTO_ClassDefinition MarkAttachClassDef; /* new in OT 1.2 */ 00180 00181 FT_UShort LastGlyph; 00182 FT_UShort** NewGlyphClasses; 00183 }; 00184 00185 typedef struct TTO_GDEFHeader_ TTO_GDEFHeader; 00186 typedef struct TTO_GDEFHeader_* TTO_GDEF; 00187 00188 00189 /* finally, the GDEF API */ 00190 00191 /* EXPORT_DEF 00192 FT_Error TT_Init_GDEF_Extension( TT_Engine engine ); */ 00193 00194 EXPORT_FUNC 00195 FT_Error TT_New_GDEF_Table( FT_Face face, 00196 TTO_GDEFHeader** retptr ); 00197 00198 EXPORT_DEF 00199 FT_Error TT_Load_GDEF_Table( FT_Face face, 00200 TTO_GDEFHeader** gdef ); 00201 00202 EXPORT_DEF 00203 FT_Error TT_Done_GDEF_Table ( TTO_GDEFHeader* gdef ); 00204 00205 EXPORT_DEF 00206 FT_Error TT_GDEF_Get_Glyph_Property( TTO_GDEFHeader* gdef, 00207 FT_UShort glyphID, 00208 FT_UShort* property ); 00209 EXPORT_DEF 00210 FT_Error TT_GDEF_Build_ClassDefinition( TTO_GDEFHeader* gdef, 00211 FT_UShort num_glyphs, 00212 FT_UShort glyph_count, 00213 FT_UShort* glyph_array, 00214 FT_UShort* class_array ); 00215 00216 00217 #ifdef __cplusplus 00218 } 00219 #endif 00220 00221 #endif /* FTXGDEF_H */ 00222 00223 00224 /* END */