1 /***************************************************************************/
5 /* Basic OpenType/CFF type definitions and interface (specification */
8 /* Copyright 1996-2001, 2002, 2003, 2006, 2007, 2008, 2010 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
27 #include FT_INTERNAL_SERVICE_H
28 #include FT_SERVICE_POSTSCRIPT_CMAPS_H
29 #include FT_INTERNAL_POSTSCRIPT_HINTS_H
35 /*************************************************************************/
41 /* A structure used to model a CFF Index table. */
44 /* stream :: The source input stream. */
46 /* start :: The position of the first index byte in the */
49 /* count :: The number of elements in the index. */
51 /* off_size :: The size in bytes of object offsets in index. */
53 /* data_offset :: The position of first data byte in the index's */
56 /* data_size :: The size of the data table in this index. */
58 /* offsets :: A table of element offsets in the index. Must be */
59 /* loaded explicitly. */
61 /* bytes :: If the index is loaded in memory, its bytes. */
63 typedef struct CFF_IndexRec_
75 } CFF_IndexRec, *CFF_Index;
78 typedef struct CFF_EncodingRec_
84 FT_UShort sids [256]; /* avoid dynamic allocations */
87 } CFF_EncodingRec, *CFF_Encoding;
90 typedef struct CFF_CharsetRec_
97 FT_UShort* cids; /* the inverse mapping of `sids'; only needed */
98 /* for CID-keyed fonts */
102 } CFF_CharsetRec, *CFF_Charset;
105 typedef struct CFF_FontRecDictRec_
113 FT_Bool is_fixed_pitch;
114 FT_Fixed italic_angle;
115 FT_Fixed underline_position;
116 FT_Fixed underline_thickness;
118 FT_Int charstring_type;
119 FT_Matrix font_matrix;
120 FT_ULong units_per_em; /* temporarily used as scaling value also */
121 FT_Vector font_offset;
125 FT_ULong charset_offset;
126 FT_ULong encoding_offset;
127 FT_ULong charstrings_offset;
128 FT_ULong private_offset;
129 FT_ULong private_size;
130 FT_Long synthetic_base;
131 FT_UInt embedded_postscript;
133 /* these should only be used for the top-level font dictionary */
134 FT_UInt cid_registry;
135 FT_UInt cid_ordering;
136 FT_Long cid_supplement;
138 FT_Long cid_font_version;
139 FT_Long cid_font_revision;
140 FT_Long cid_font_type;
142 FT_ULong cid_uid_base;
143 FT_ULong cid_fd_array_offset;
144 FT_ULong cid_fd_select_offset;
145 FT_UInt cid_font_name;
147 } CFF_FontRecDictRec, *CFF_FontRecDict;
150 typedef struct CFF_PrivateRec_
152 FT_Byte num_blue_values;
153 FT_Byte num_other_blues;
154 FT_Byte num_family_blues;
155 FT_Byte num_family_other_blues;
157 FT_Pos blue_values[14];
158 FT_Pos other_blues[10];
159 FT_Pos family_blues[14];
160 FT_Pos family_other_blues[10];
165 FT_Pos standard_width;
166 FT_Pos standard_height;
168 FT_Byte num_snap_widths;
169 FT_Byte num_snap_heights;
170 FT_Pos snap_widths[13];
171 FT_Pos snap_heights[13];
173 FT_Fixed force_bold_threshold;
175 FT_Int language_group;
176 FT_Fixed expansion_factor;
177 FT_Long initial_random_seed;
178 FT_ULong local_subrs_offset;
179 FT_Pos default_width;
180 FT_Pos nominal_width;
182 } CFF_PrivateRec, *CFF_Private;
185 typedef struct CFF_FDSelectRec_
190 /* that's the table, taken from the file `as is' */
194 /* small cache for format 3 only */
199 } CFF_FDSelectRec, *CFF_FDSelect;
202 /* A SubFont packs a font dict and a private dict together. They are */
203 /* needed to support CID-keyed CFF fonts. */
204 typedef struct CFF_SubFontRec_
206 CFF_FontRecDictRec font_dict;
207 CFF_PrivateRec private_dict;
209 CFF_IndexRec local_subrs_index;
210 FT_Byte** local_subrs; /* array of pointers into Local Subrs INDEX data */
212 } CFF_SubFontRec, *CFF_SubFont;
215 /* maximum number of sub-fonts in a CID-keyed file */
216 #define CFF_MAX_CID_FONTS 32
219 typedef struct CFF_FontRec_
226 FT_Byte version_major;
227 FT_Byte version_minor;
229 FT_Byte absolute_offsize;
232 CFF_IndexRec name_index;
233 CFF_IndexRec top_dict_index;
234 CFF_IndexRec global_subrs_index;
236 CFF_EncodingRec encoding;
237 CFF_CharsetRec charset;
239 CFF_IndexRec charstrings_index;
240 CFF_IndexRec font_dict_index;
241 CFF_IndexRec private_index;
242 CFF_IndexRec local_subrs_index;
244 FT_String* font_name;
246 /* array of pointers into Global Subrs INDEX data */
247 FT_Byte** global_subrs;
249 /* array of pointers into String INDEX data stored at string_pool */
252 FT_Byte* string_pool;
254 CFF_SubFontRec top_font;
255 FT_UInt num_subfonts;
256 CFF_SubFont subfonts[CFF_MAX_CID_FONTS];
258 CFF_FDSelectRec fd_select;
260 /* interface to PostScript hinter */
261 PSHinter_Service pshinter;
263 /* interface to Postscript Names service */
264 FT_Service_PsCMaps psnames;
266 /* since version 2.3.0 */
267 PS_FontInfoRec* font_info; /* font info dictionary */
269 /* since version 2.3.6 */
273 } CFF_FontRec, *CFF_Font;
278 #endif /* __CFFTYPES_H__ */