1 /***************************************************************************/
5 /* Basic OpenType/CFF type definitions and interface (specification */
8 /* Copyright 1996-2001, 2002 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
31 /*************************************************************************/
37 /* A structure used to model a CFF Index table. */
40 /* stream :: The source input stream. */
42 /* count :: The number of elements in the index. */
44 /* off_size :: The size in bytes of object offsets in index. */
46 /* data_offset :: The position of first data byte in the index's */
49 /* offsets :: A table of element offsets in the index. */
51 /* bytes :: If the index is loaded in memory, its bytes. */
53 typedef struct CFF_IndexRec_
63 } CFF_IndexRec, *CFF_Index;
66 typedef struct CFF_EncodingRec_
72 FT_UShort sids [256]; /* avoid dynamic allocations */
75 } CFF_EncodingRec, *CFF_Encoding;
78 typedef struct CFF_CharsetRec_
86 } CFF_CharsetRec, *CFF_Charset;
89 typedef struct CFF_FontRecDictRec_
97 FT_Bool is_fixed_pitch;
98 FT_Fixed italic_angle;
99 FT_Pos underline_position;
100 FT_Pos underline_thickness;
102 FT_Int charstring_type;
103 FT_Matrix font_matrix;
104 FT_UShort units_per_em;
105 FT_Vector font_offset;
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;
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;
124 FT_Long cid_font_version;
125 FT_Long cid_font_revision;
126 FT_Long cid_font_type;
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;
133 } CFF_FontRecDictRec, *CFF_FontRecDict;
136 typedef struct CFF_PrivateRec_
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;
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];
151 FT_Pos standard_width;
152 FT_Pos standard_height;
154 FT_Byte num_snap_widths;
155 FT_Byte num_snap_heights;
156 FT_Pos snap_widths[13];
157 FT_Pos snap_heights[13];
159 FT_Fixed force_bold_threshold;
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;
168 } CFF_PrivateRec, *CFF_Private;
171 typedef struct CFF_FDSelectRec_
176 /* that's the table, taken from the file `as is' */
180 /* small cache for format 3 only */
185 } CFF_FDSelectRec, *CFF_FDSelect;
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_
192 CFF_FontRecDictRec font_dict;
193 CFF_PrivateRec private_dict;
195 CFF_IndexRec local_subrs_index;
196 FT_UInt num_local_subrs;
197 FT_Byte** local_subrs;
199 } CFF_SubFontRec, *CFF_SubFont;
202 /* maximum number of sub-fonts in a CID-keyed file */
203 #define CFF_MAX_CID_FONTS 16
206 typedef struct CFF_FontRec_
213 FT_Byte version_major;
214 FT_Byte version_minor;
216 FT_Byte absolute_offsize;
219 CFF_IndexRec name_index;
220 CFF_IndexRec top_dict_index;
221 CFF_IndexRec string_index;
222 CFF_IndexRec global_subrs_index;
224 CFF_EncodingRec encoding;
225 CFF_CharsetRec charset;
227 CFF_IndexRec charstrings_index;
228 CFF_IndexRec font_dict_index;
229 CFF_IndexRec private_index;
230 CFF_IndexRec local_subrs_index;
232 FT_String* font_name;
233 FT_UInt num_global_subrs;
234 FT_Byte** global_subrs;
236 CFF_SubFontRec top_font;
237 FT_UInt num_subfonts;
238 CFF_SubFont subfonts[CFF_MAX_CID_FONTS];
240 CFF_FDSelectRec fd_select;
242 /* interface to PostScript hinter */
245 /* interface to Postscript Names service */
248 } CFF_FontRec, *CFF_Font;
253 #endif /* __CFFTYPES_H__ */