1 /***************************************************************************/ 2 /* */ 3 /* t1types.h */ 4 /* */ 5 /* Basic Type1/Type2 type definitions and interface (specification */ 6 /* only). */ 7 /* */ 8 /* Copyright 1996-2004, 2006, 2008, 2009, 2011 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 /* used to hold extra data of PS_FontInfoRec that 82 * cannot be stored in the publicly defined structure. 83 * 84 * Note these can't be blended with multiple-masters. 85 */ 86 typedef struct PS_FontExtraRec_ 87 { 88 FT_UShort fs_type; 89 90 } PS_FontExtraRec; 91 92 93 typedef struct T1_FontRec_ 94 { 95 PS_FontInfoRec font_info; /* font info dictionary */ 96 PS_FontExtraRec font_extra; /* font info extra fields */ 97 PS_PrivateRec private_dict; /* private dictionary */ 98 FT_String* font_name; /* top-level dictionary */ 99 100 T1_EncodingType encoding_type; 101 T1_EncodingRec encoding; 102 103 FT_Byte* subrs_block; 104 FT_Byte* charstrings_block; 105 FT_Byte* glyph_names_block; 106 107 FT_Int num_subrs; 108 FT_Byte** subrs; 109 FT_PtrDist* subrs_len; 110 111 FT_Int num_glyphs; 112 FT_String** glyph_names; /* array of glyph names */ 113 FT_Byte** charstrings; /* array of glyph charstrings */ 114 FT_PtrDist* charstrings_len; 115 116 FT_Byte paint_type; 117 FT_Byte font_type; 118 FT_Matrix font_matrix; 119 FT_Vector font_offset; 120 FT_BBox font_bbox; 121 FT_Long font_id; 122 123 FT_Fixed stroke_width; 124 125 } T1_FontRec, *T1_Font; 126 127 128 typedef struct CID_SubrsRec_ 129 { 130 FT_UInt num_subrs; 131 FT_Byte** code; 132 133 } CID_SubrsRec, *CID_Subrs; 134 135 136 /*************************************************************************/ 137 /*************************************************************************/ 138 /*************************************************************************/ 139 /*** ***/ 140 /*** ***/ 141 /*** AFM FONT INFORMATION STRUCTURES ***/ 142 /*** ***/ 143 /*** ***/ 144 /*************************************************************************/ 145 /*************************************************************************/ 146 /*************************************************************************/ 147 148 typedef struct AFM_TrackKernRec_ 149 { 150 FT_Int degree; 151 FT_Fixed min_ptsize; 152 FT_Fixed min_kern; 153 FT_Fixed max_ptsize; 154 FT_Fixed max_kern; 155 156 } AFM_TrackKernRec, *AFM_TrackKern; 157 158 typedef struct AFM_KernPairRec_ 159 { 160 FT_Int index1; 161 FT_Int index2; 162 FT_Int x; 163 FT_Int y; 164 165 } AFM_KernPairRec, *AFM_KernPair; 166 167 typedef struct AFM_FontInfoRec_ 168 { 169 FT_Bool IsCIDFont; 170 FT_BBox FontBBox; 171 FT_Fixed Ascender; 172 FT_Fixed Descender; 173 AFM_TrackKern TrackKerns; /* free if non-NULL */ 174 FT_Int NumTrackKern; 175 AFM_KernPair KernPairs; /* free if non-NULL */ 176 FT_Int NumKernPair; 177 178 } AFM_FontInfoRec, *AFM_FontInfo; 179 180 181 /*************************************************************************/ 182 /*************************************************************************/ 183 /*************************************************************************/ 184 /*** ***/ 185 /*** ***/ 186 /*** ORIGINAL T1_FACE CLASS DEFINITION ***/ 187 /*** ***/ 188 /*** ***/ 189 /*************************************************************************/ 190 /*************************************************************************/ 191 /*************************************************************************/ 192 193 194 typedef struct T1_FaceRec_* T1_Face; 195 typedef struct CID_FaceRec_* CID_Face; 196 197 198 typedef struct T1_FaceRec_ 199 { 200 FT_FaceRec root; 201 T1_FontRec type1; 202 const void* psnames; 203 const void* psaux; 204 const void* afm_data; 205 FT_CharMapRec charmaprecs[2]; 206 FT_CharMap charmaps[2]; 207 208 #ifdef FT_CONFIG_OPTION_OLD_INTERNALS 209 PS_Unicodes unicode_map; 210 #endif 211 212 /* support for Multiple Masters fonts */ 213 PS_Blend blend; 214 215 /* undocumented, optional: indices of subroutines that express */ 216 /* the NormalizeDesignVector and the ConvertDesignVector procedure, */ 217 /* respectively, as Type 2 charstrings; -1 if keywords not present */ 218 FT_Int ndv_idx; 219 FT_Int cdv_idx; 220 221 /* undocumented, optional: has the same meaning as len_buildchar */ 222 /* for Type 2 fonts; manipulated by othersubrs 19, 24, and 25 */ 223 FT_UInt len_buildchar; 224 FT_Long* buildchar; 225 226 /* since version 2.1 - interface to PostScript hinter */ 227 const void* pshinter; 228 229 } T1_FaceRec; 230 231 232 typedef struct CID_FaceRec_ 233 { 234 FT_FaceRec root; 235 void* psnames; 236 void* psaux; 237 CID_FaceInfoRec cid; 238 PS_FontExtraRec font_extra; 239 #if 0 240 void* afm_data; 241 #endif 242 CID_Subrs subrs; 243 244 /* since version 2.1 - interface to PostScript hinter */ 245 void* pshinter; 246 247 /* since version 2.1.8, but was originally positioned after `afm_data' */ 248 FT_Byte* binary_data; /* used if hex data has been converted */ 249 FT_Stream cid_stream; 250 251 } CID_FaceRec; 252 253 254 FT_END_HEADER 255 256 #endif /* __T1TYPES_H__ */ 257 258 259 /* END */ 260