1 /***************************************************************************/
5 /* Basic OpenType/CFF type definitions and interface (specification */
8 /* Copyright 1996-2001, 2002, 2003, 2006, 2007, 2008 by */
9 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
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. */
17 /***************************************************************************/
20 #ifndef __CFFTYPES_H__
21 #define __CFFTYPES_H__
25 #include FT_FREETYPE_H
26 #include FT_TYPE1_TABLES_H
32 /*************************************************************************/
38 /* A structure used to model a CFF Index table. */
41 /* stream :: The source input stream. */
43 /* start :: The position of the first index byte in the */
46 /* count :: The number of elements in the index. */
48 /* off_size :: The size in bytes of object offsets in index. */
50 /* data_offset :: The position of first data byte in the index's */
53 /* data_size :: The size of the data table in this index. */
55 /* offsets :: A table of element offsets in the index. Must be */
56 /* loaded explicitly. */
58 /* bytes :: If the index is loaded in memory, its bytes. */
60 typedef struct CFF_IndexRec_
72 } CFF_IndexRec, *CFF_Index;
75 typedef struct CFF_EncodingRec_
81 FT_UShort sids [256]; /* avoid dynamic allocations */
84 } CFF_EncodingRec, *CFF_Encoding;
87 typedef struct CFF_CharsetRec_
94 FT_UShort* cids; /* the inverse mapping of `sids'; only needed */
95 /* for CID-keyed fonts */
99 } CFF_CharsetRec, *CFF_Charset;
102 typedef struct CFF_FontRecDictRec_
110 FT_Bool is_fixed_pitch;
111 FT_Fixed italic_angle;
112 FT_Fixed underline_position;
113 FT_Fixed underline_thickness;
115 FT_Int charstring_type;
116 FT_Matrix font_matrix;
117 FT_ULong units_per_em; /* temporarily used as scaling value also */
118 FT_Vector font_offset;
122 FT_ULong charset_offset;
123 FT_ULong encoding_offset;
124 FT_ULong charstrings_offset;
125 FT_ULong private_offset;
126 FT_ULong private_size;
127 FT_Long synthetic_base;
128 FT_UInt embedded_postscript;
130 /* these should only be used for the top-level font dictionary */
131 FT_UInt cid_registry;
132 FT_UInt cid_ordering;
133 FT_Long cid_supplement;
135 FT_Long cid_font_version;
136 FT_Long cid_font_revision;
137 FT_Long cid_font_type;
139 FT_ULong cid_uid_base;
140 FT_ULong cid_fd_array_offset;
141 FT_ULong cid_fd_select_offset;
142 FT_UInt cid_font_name;
144 } CFF_FontRecDictRec, *CFF_FontRecDict;
147 typedef struct CFF_PrivateRec_
149 FT_Byte num_blue_values;
150 FT_Byte num_other_blues;
151 FT_Byte num_family_blues;
152 FT_Byte num_family_other_blues;
154 FT_Pos blue_values[14];
155 FT_Pos other_blues[10];
156 FT_Pos family_blues[14];
157 FT_Pos family_other_blues[10];
162 FT_Pos standard_width;
163 FT_Pos standard_height;
165 FT_Byte num_snap_widths;
166 FT_Byte num_snap_heights;
167 FT_Pos snap_widths[13];
168 FT_Pos snap_heights[13];
170 FT_Fixed force_bold_threshold;
172 FT_Int language_group;
173 FT_Fixed expansion_factor;
174 FT_Long initial_random_seed;
175 FT_ULong local_subrs_offset;
176 FT_Pos default_width;
177 FT_Pos nominal_width;
179 } CFF_PrivateRec, *CFF_Private;
182 typedef struct CFF_FDSelectRec_
187 /* that's the table, taken from the file `as is' */
191 /* small cache for format 3 only */
196 } CFF_FDSelectRec, *CFF_FDSelect;
199 /* A SubFont packs a font dict and a private dict together. They are */
200 /* needed to support CID-keyed CFF fonts. */
201 typedef struct CFF_SubFontRec_
203 CFF_FontRecDictRec font_dict;
204 CFF_PrivateRec private_dict;
206 CFF_IndexRec local_subrs_index;
207 FT_UInt num_local_subrs;
208 FT_Byte** local_subrs;
210 } CFF_SubFontRec, *CFF_SubFont;
213 /* maximum number of sub-fonts in a CID-keyed file */
214 #define CFF_MAX_CID_FONTS 32
217 typedef struct CFF_FontRec_
224 FT_Byte version_major;
225 FT_Byte version_minor;
227 FT_Byte absolute_offsize;
230 CFF_IndexRec name_index;
231 CFF_IndexRec top_dict_index;
232 CFF_IndexRec string_index;
233 CFF_IndexRec global_subrs_index;
235 CFF_EncodingRec encoding;
236 CFF_CharsetRec charset;
238 CFF_IndexRec charstrings_index;
239 CFF_IndexRec font_dict_index;
240 CFF_IndexRec private_index;
241 CFF_IndexRec local_subrs_index;
243 FT_String* font_name;
244 FT_UInt num_global_subrs;
245 FT_Byte** global_subrs;
247 CFF_SubFontRec top_font;
248 FT_UInt num_subfonts;
249 CFF_SubFont subfonts[CFF_MAX_CID_FONTS];
251 CFF_FDSelectRec fd_select;
253 /* interface to PostScript hinter */
256 /* interface to Postscript Names service */
259 /* since version 2.3.0 */
260 PS_FontInfoRec* font_info; /* font info dictionary */
262 /* since version 2.3.6 */
266 } CFF_FontRec, *CFF_Font;
271 #endif /* __CFFTYPES_H__ */