1 /***************************************************************************/
5 /* Basic OpenType/CFF type definitions and interface (specification */
8 /* Copyright 1996-2003, 2006-2008, 2010-2011, 2013 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_Bool has_font_matrix;
121 FT_ULong units_per_em; /* temporarily used as scaling value also */
122 FT_Vector font_offset;
126 FT_ULong charset_offset;
127 FT_ULong encoding_offset;
128 FT_ULong charstrings_offset;
129 FT_ULong private_offset;
130 FT_ULong private_size;
131 FT_Long synthetic_base;
132 FT_UInt embedded_postscript;
134 /* these should only be used for the top-level font dictionary */
135 FT_UInt cid_registry;
136 FT_UInt cid_ordering;
137 FT_Long cid_supplement;
139 FT_Long cid_font_version;
140 FT_Long cid_font_revision;
141 FT_Long cid_font_type;
143 FT_ULong cid_uid_base;
144 FT_ULong cid_fd_array_offset;
145 FT_ULong cid_fd_select_offset;
146 FT_UInt cid_font_name;
148 } CFF_FontRecDictRec, *CFF_FontRecDict;
151 typedef struct CFF_PrivateRec_
153 FT_Byte num_blue_values;
154 FT_Byte num_other_blues;
155 FT_Byte num_family_blues;
156 FT_Byte num_family_other_blues;
158 FT_Pos blue_values[14];
159 FT_Pos other_blues[10];
160 FT_Pos family_blues[14];
161 FT_Pos family_other_blues[10];
166 FT_Pos standard_width;
167 FT_Pos standard_height;
169 FT_Byte num_snap_widths;
170 FT_Byte num_snap_heights;
171 FT_Pos snap_widths[13];
172 FT_Pos snap_heights[13];
174 FT_Fixed force_bold_threshold;
176 FT_Int language_group;
177 FT_Fixed expansion_factor;
178 FT_Long initial_random_seed;
179 FT_ULong local_subrs_offset;
180 FT_Pos default_width;
181 FT_Pos nominal_width;
183 } CFF_PrivateRec, *CFF_Private;
186 typedef struct CFF_FDSelectRec_
191 /* that's the table, taken from the file `as is' */
195 /* small cache for format 3 only */
200 } CFF_FDSelectRec, *CFF_FDSelect;
203 /* A SubFont packs a font dict and a private dict together. They are */
204 /* needed to support CID-keyed CFF fonts. */
205 typedef struct CFF_SubFontRec_
207 CFF_FontRecDictRec font_dict;
208 CFF_PrivateRec private_dict;
210 CFF_IndexRec local_subrs_index;
211 FT_Byte** local_subrs; /* array of pointers into Local Subrs INDEX data */
213 } CFF_SubFontRec, *CFF_SubFont;
216 #define CFF_MAX_CID_FONTS 256
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 /* since version 2.4.12 */
274 FT_Generic cf2_instance;
276 } CFF_FontRec, *CFF_Font;
281 #endif /* __CFFTYPES_H__ */