1 /***************************************************************************/ 2 /* */ 3 /* t1types.h */ 4 /* */ 5 /* Basic Type1/Type2 type definitions and interface (specification */ 6 /* only). */ 7 /* */ 8 /* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2008, 2009 by */ 9 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 10 /* */ 11 /* This file is part of the FreeType project, and may only be used, */ 12 /* modified, and distributed under the terms of the FreeType project */ 13 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 14 /* this file you indicate that you have read the license and */ 15 /* understand and accept it fully. */ 16 /* */ 17 /***************************************************************************/ 18 19 20 #ifndef __T1TYPES_H__ 21 #define __T1TYPES_H__ 22 23 24 #include <ft2build.h> 25 #include FT_TYPE1_TABLES_H 26 #include FT_INTERNAL_POSTSCRIPT_HINTS_H 27 #include FT_INTERNAL_SERVICE_H 28 #include FT_SERVICE_POSTSCRIPT_CMAPS_H 29 30 31 FT_BEGIN_HEADER 32 33 34 /*************************************************************************/ 35 /*************************************************************************/ 36 /*************************************************************************/ 37 /*** ***/ 38 /*** ***/ 39 /*** REQUIRED TYPE1/TYPE2 TABLES DEFINITIONS ***/ 40 /*** ***/ 41 /*** ***/ 42 /*************************************************************************/ 43 /*************************************************************************/ 44 /*************************************************************************/ 45 46 47 /*************************************************************************/ 48 /* */ 49 /* <Struct> */ 50 /* T1_EncodingRec */ 51 /* */ 52 /* <Description> */ 53 /* A structure modeling a custom encoding. */ 54 /* */ 55 /* <Fields> */ 56 /* num_chars :: The number of character codes in the encoding. */ 57 /* Usually 256. */ 58 /* */ 59 /* code_first :: The lowest valid character code in the encoding. */ 60 /* */ 61 /* code_last :: The highest valid character code in the encoding */ 62 /* + 1. When equal to code_first there are no valid */ 63 /* character codes. */ 64 /* */ 65 /* char_index :: An array of corresponding glyph indices. */ 66 /* */ 67 /* char_name :: An array of corresponding glyph names. */ 68 /* */ 69 typedef struct T1_EncodingRecRec_ 70 { 71 FT_Int num_chars; 72 FT_Int code_first; 73 FT_Int code_last; 74 75 FT_UShort* char_index; 76 FT_String** char_name; 77 78 } T1_EncodingRec, *T1_Encoding; 79 80 81 typedef enum T1_EncodingType_ 82 { 83 T1_ENCODING_TYPE_NONE = 0, 84 T1_ENCODING_TYPE_ARRAY, 85 T1_ENCODING_TYPE_STANDARD, 86 T1_ENCODING_TYPE_ISOLATIN1, 87 T1_ENCODING_TYPE_EXPERT 88 89 } T1_EncodingType; 90 91 92 /* used to hold extra data of PS_FontInfoRec that 93 * cannot be stored in the publicly defined structure. 94 * 95 * Note these can't be blended with multiple-masters. 96 */ 97 typedef struct PS_FontExtraRec_ 98 { 99 FT_UShort fs_type; 100 101 } PS_FontExtraRec; 102 103 104 typedef struct T1_FontRec_ 105 { 106 PS_FontInfoRec font_info; /* font info dictionary */ 107 PS_FontExtraRec font_extra; /* font info extra fields */ 108 PS_PrivateRec private_dict; /* private dictionary */ 109 FT_String* font_name; /* top-level dictionary */ 110 111 T1_EncodingType encoding_type; 112 T1_EncodingRec encoding; 113 114 FT_Byte* subrs_block; 115 FT_Byte* charstrings_block; 116 FT_Byte* glyph_names_block; 117 118 FT_Int num_subrs; 119 FT_Byte** subrs; 120 FT_PtrDist* subrs_len; 121 122 FT_Int num_glyphs; 123 FT_String** glyph_names; /* array of glyph names */ 124 FT_Byte** charstrings; /* array of glyph charstrings */ 125 FT_PtrDist* charstrings_len; 126 127 FT_Byte paint_type; 128 FT_Byte font_type; 129 FT_Matrix font_matrix; 130 FT_Vector font_offset; 131 FT_BBox font_bbox; 132 FT_Long font_id; 133 134 FT_Fixed stroke_width; 135 136 } T1_FontRec, *T1_Font; 137 138 139 typedef struct CID_SubrsRec_ 140 { 141 FT_UInt num_subrs; 142 FT_Byte** code; 143 144 } CID_SubrsRec, *CID_Subrs; 145 146 147 /*************************************************************************/ 148 /*************************************************************************/ 149 /*************************************************************************/ 150 /*** ***/ 151 /*** ***/ 152 /*** AFM FONT INFORMATION STRUCTURES ***/ 153 /*** ***/ 154 /*** ***/ 155 /*************************************************************************/ 156 /*************************************************************************/ 157 /*************************************************************************/ 158 159 typedef struct AFM_TrackKernRec_ 160 { 161 FT_Int degree; 162 FT_Fixed min_ptsize; 163 FT_Fixed min_kern; 164 FT_Fixed max_ptsize; 165 FT_Fixed max_kern; 166 167 } AFM_TrackKernRec, *AFM_TrackKern; 168 169 typedef struct AFM_KernPairRec_ 170 { 171 FT_Int index1; 172 FT_Int index2; 173 FT_Int x; 174 FT_Int y; 175 176 } AFM_KernPairRec, *AFM_KernPair; 177 178 typedef struct AFM_FontInfoRec_ 179 { 180 FT_Bool IsCIDFont; 181 FT_BBox FontBBox; 182 FT_Fixed Ascender; 183 FT_Fixed Descender; 184 AFM_TrackKern TrackKerns; /* free if non-NULL */ 185 FT_Int NumTrackKern; 186 AFM_KernPair KernPairs; /* free if non-NULL */ 187 FT_Int NumKernPair; 188 189 } AFM_FontInfoRec, *AFM_FontInfo; 190 191 192 /*************************************************************************/ 193 /*************************************************************************/ 194 /*************************************************************************/ 195 /*** ***/ 196 /*** ***/ 197 /*** ORIGINAL T1_FACE CLASS DEFINITION ***/ 198 /*** ***/ 199 /*** ***/ 200 /*************************************************************************/ 201 /*************************************************************************/ 202 /*************************************************************************/ 203 204 205 typedef struct T1_FaceRec_* T1_Face; 206 typedef struct CID_FaceRec_* CID_Face; 207 208 209 typedef struct T1_FaceRec_ 210 { 211 FT_FaceRec root; 212 T1_FontRec type1; 213 const void* psnames; 214 const void* psaux; 215 const void* afm_data; 216 FT_CharMapRec charmaprecs[2]; 217 FT_CharMap charmaps[2]; 218 219 #ifdef FT_CONFIG_OPTION_OLD_INTERNALS 220 PS_Unicodes unicode_map; 221 #endif 222 223 /* support for Multiple Masters fonts */ 224 PS_Blend blend; 225 226 /* undocumented, optional: indices of subroutines that express */ 227 /* the NormalizeDesignVector and the ConvertDesignVector procedure, */ 228 /* respectively, as Type 2 charstrings; -1 if keywords not present */ 229 FT_Int ndv_idx; 230 FT_Int cdv_idx; 231 232 /* undocumented, optional: has the same meaning as len_buildchar */ 233 /* for Type 2 fonts; manipulated by othersubrs 19, 24, and 25 */ 234 FT_UInt len_buildchar; 235 FT_Long* buildchar; 236 237 /* since version 2.1 - interface to PostScript hinter */ 238 const void* pshinter; 239 240 } T1_FaceRec; 241 242 243 typedef struct CID_FaceRec_ 244 { 245 FT_FaceRec root; 246 void* psnames; 247 void* psaux; 248 CID_FaceInfoRec cid; 249 PS_FontExtraRec font_extra; 250 #if 0 251 void* afm_data; 252 #endif 253 CID_Subrs subrs; 254 255 /* since version 2.1 - interface to PostScript hinter */ 256 void* pshinter; 257 258 /* since version 2.1.8, but was originally positioned after `afm_data' */ 259 FT_Byte* binary_data; /* used if hex data has been converted */ 260 FT_Stream cid_stream; 261 262 } CID_FaceRec; 263 264 265 FT_END_HEADER 266 267 #endif /* __T1TYPES_H__ */ 268 269 270 /* END */ 271