1 /***************************************************************************/ 2 /* */ 3 /* cfftypes.h */ 4 /* */ 5 /* Basic OpenType/CFF type definitions and interface (specification */ 6 /* only). */ 7 /* */ 8 /* Copyright 1996-2001, 2002 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 __CFFTYPES_H__ 21 #define __CFFTYPES_H__ 22 23 24 #include <ft2build.h> 25 #include FT_FREETYPE_H 26 27 28 FT_BEGIN_HEADER 29 30 31 /*************************************************************************/ 32 /* */ 33 /* <Struct> */ 34 /* CFF_IndexRec */ 35 /* */ 36 /* <Description> */ 37 /* A structure used to model a CFF Index table. */ 38 /* */ 39 /* <Fields> */ 40 /* stream :: The source input stream. */ 41 /* */ 42 /* count :: The number of elements in the index. */ 43 /* */ 44 /* off_size :: The size in bytes of object offsets in index. */ 45 /* */ 46 /* data_offset :: The position of first data byte in the index's */ 47 /* bytes. */ 48 /* */ 49 /* offsets :: A table of element offsets in the index. */ 50 /* */ 51 /* bytes :: If the index is loaded in memory, its bytes. */ 52 /* */ 53 typedef struct CFF_IndexRec_ 54 { 55 FT_Stream stream; 56 FT_UInt count; 57 FT_Byte off_size; 58 FT_ULong data_offset; 59 60 FT_ULong* offsets; 61 FT_Byte* bytes; 62 63 } CFF_IndexRec, *CFF_Index; 64 65 66 typedef struct CFF_EncodingRec_ 67 { 68 FT_UInt format; 69 FT_ULong offset; 70 71 FT_UInt count; 72 FT_UShort sids [256]; /* avoid dynamic allocations */ 73 FT_UShort codes[256]; 74 75 } CFF_EncodingRec, *CFF_Encoding; 76 77 78 typedef struct CFF_CharsetRec_ 79 { 80 81 FT_UInt format; 82 FT_ULong offset; 83 84 FT_UShort* sids; 85 86 } CFF_CharsetRec, *CFF_Charset; 87 88 89 typedef struct CFF_FontRecDictRec_ 90 { 91 FT_UInt version; 92 FT_UInt notice; 93 FT_UInt copyright; 94 FT_UInt full_name; 95 FT_UInt family_name; 96 FT_UInt weight; 97 FT_Bool is_fixed_pitch; 98 FT_Fixed italic_angle; 99 FT_Pos underline_position; 100 FT_Pos underline_thickness; 101 FT_Int paint_type; 102 FT_Int charstring_type; 103 FT_Matrix font_matrix; 104 FT_UShort units_per_em; 105 FT_Vector font_offset; 106 FT_ULong unique_id; 107 FT_BBox font_bbox; 108 FT_Pos stroke_width; 109 FT_ULong charset_offset; 110 FT_ULong encoding_offset; 111 FT_ULong charstrings_offset; 112 FT_ULong private_offset; 113 FT_ULong private_size; 114 FT_Long synthetic_base; 115 FT_UInt embedded_postscript; 116 FT_UInt base_font_name; 117 FT_UInt postscript; 118 119 /* these should only be used for the top-level font dictionary */ 120 FT_UInt cid_registry; 121 FT_UInt cid_ordering; 122 FT_ULong cid_supplement; 123 124 FT_Long cid_font_version; 125 FT_Long cid_font_revision; 126 FT_Long cid_font_type; 127 FT_Long cid_count; 128 FT_ULong cid_uid_base; 129 FT_ULong cid_fd_array_offset; 130 FT_ULong cid_fd_select_offset; 131 FT_UInt cid_font_name; 132 133 } CFF_FontRecDictRec, *CFF_FontRecDict; 134 135 136 typedef struct CFF_PrivateRec_ 137 { 138 FT_Byte num_blue_values; 139 FT_Byte num_other_blues; 140 FT_Byte num_family_blues; 141 FT_Byte num_family_other_blues; 142 143 FT_Pos blue_values[14]; 144 FT_Pos other_blues[10]; 145 FT_Pos family_blues[14]; 146 FT_Pos family_other_blues[10]; 147 148 FT_Fixed blue_scale; 149 FT_Pos blue_shift; 150 FT_Pos blue_fuzz; 151 FT_Pos standard_width; 152 FT_Pos standard_height; 153 154 FT_Byte num_snap_widths; 155 FT_Byte num_snap_heights; 156 FT_Pos snap_widths[13]; 157 FT_Pos snap_heights[13]; 158 FT_Bool force_bold; 159 FT_Fixed force_bold_threshold; 160 FT_Int lenIV; 161 FT_Int language_group; 162 FT_Fixed expansion_factor; 163 FT_Long initial_random_seed; 164 FT_ULong local_subrs_offset; 165 FT_Pos default_width; 166 FT_Pos nominal_width; 167 168 } CFF_PrivateRec, *CFF_Private; 169 170 171 typedef struct CFF_FDSelectRec_ 172 { 173 FT_Byte format; 174 FT_UInt range_count; 175 176 /* that's the table, taken from the file `as is' */ 177 FT_Byte* data; 178 FT_UInt data_size; 179 180 /* small cache for format 3 only */ 181 FT_UInt cache_first; 182 FT_UInt cache_count; 183 FT_Byte cache_fd; 184 185 } CFF_FDSelectRec, *CFF_FDSelect; 186 187 188 /* A SubFont packs a font dict and a private dict together. They are */ 189 /* needed to support CID-keyed CFF fonts. */ 190 typedef struct CFF_SubFontRec_ 191 { 192 CFF_FontRecDictRec font_dict; 193 CFF_PrivateRec private_dict; 194 195 CFF_IndexRec local_subrs_index; 196 FT_UInt num_local_subrs; 197 FT_Byte** local_subrs; 198 199 } CFF_SubFontRec, *CFF_SubFont; 200 201 202 /* maximum number of sub-fonts in a CID-keyed file */ 203 #define CFF_MAX_CID_FONTS 16 204 205 206 typedef struct CFF_FontRec_ 207 { 208 FT_Stream stream; 209 FT_Memory memory; 210 FT_UInt num_faces; 211 FT_UInt num_glyphs; 212 213 FT_Byte version_major; 214 FT_Byte version_minor; 215 FT_Byte header_size; 216 FT_Byte absolute_offsize; 217 218 219 CFF_IndexRec name_index; 220 CFF_IndexRec top_dict_index; 221 CFF_IndexRec string_index; 222 CFF_IndexRec global_subrs_index; 223 224 CFF_EncodingRec encoding; 225 CFF_CharsetRec charset; 226 227 CFF_IndexRec charstrings_index; 228 CFF_IndexRec font_dict_index; 229 CFF_IndexRec private_index; 230 CFF_IndexRec local_subrs_index; 231 232 FT_String* font_name; 233 FT_UInt num_global_subrs; 234 FT_Byte** global_subrs; 235 236 CFF_SubFontRec top_font; 237 FT_UInt num_subfonts; 238 CFF_SubFont subfonts[CFF_MAX_CID_FONTS]; 239 240 CFF_FDSelectRec fd_select; 241 242 /* interface to PostScript hinter */ 243 void* pshinter; 244 245 /* interface to Postscript Names service */ 246 void* psnames; 247 248 } CFF_FontRec, *CFF_Font; 249 250 251 FT_END_HEADER 252 253 #endif /* __CFFTYPES_H__ */ 254 255 256 /* END */ 257