1 /***************************************************************************/
2 /* */
3 /* cfftypes.h */
4 /* */
5 /* Basic OpenType/CFF type definitions and interface (specification */
6 /* only). */
7 /* */
8 /* Copyright 1996-2001 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 /***************************************************************************/
20 #ifndef __CFFTYPES_H__
21 #define __CFFTYPES_H__
24 #include <ft2build.h>
25 #include FT_FREETYPE_H
28 FT_BEGIN_HEADER
31 /*************************************************************************/
32 /* */
33 /* <Struct> */
34 /* CFF_Index */
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_Index_
54 {
55 FT_Stream stream;
56 FT_UInt count;
57 FT_Byte off_size;
58 FT_ULong data_offset;
60 FT_ULong* offsets;
61 FT_Byte* bytes;
63 } CFF_Index;
66 typedef struct CFF_Encoding_
67 {
68 FT_UInt format;
69 FT_ULong offset;
71 FT_UShort* sids;
72 FT_UShort* codes;
74 } CFF_Encoding;
77 typedef struct CFF_Charset_
78 {
80 FT_UInt format;
81 FT_ULong offset;
83 FT_UShort* sids;
85 } CFF_Charset;
88 typedef struct CFF_Font_Dict_
89 {
90 FT_UInt version;
91 FT_UInt notice;
92 FT_UInt copyright;
93 FT_UInt full_name;
94 FT_UInt family_name;
95 FT_UInt weight;
96 FT_Bool is_fixed_pitch;
97 FT_Fixed italic_angle;
98 FT_Pos underline_position;
99 FT_Pos underline_thickness;
100 FT_Int paint_type;
101 FT_Int charstring_type;
102 FT_Matrix font_matrix;
103 FT_UShort units_per_em;
104 FT_Vector font_offset;
105 FT_ULong unique_id;
106 FT_BBox font_bbox;
107 FT_Pos stroke_width;
108 FT_ULong charset_offset;
109 FT_ULong encoding_offset;
110 FT_ULong charstrings_offset;
111 FT_ULong private_offset;
112 FT_ULong private_size;
113 FT_Long synthetic_base;
114 FT_UInt embedded_postscript;
115 FT_UInt base_font_name;
116 FT_UInt postscript;
118 /* these should only be used for the top-level font dictionary */
119 FT_UInt cid_registry;
120 FT_UInt cid_ordering;
121 FT_ULong cid_supplement;
123 FT_Long cid_font_version;
124 FT_Long cid_font_revision;
125 FT_Long cid_font_type;
126 FT_Long cid_count;
127 FT_ULong cid_uid_base;
128 FT_ULong cid_fd_array_offset;
129 FT_ULong cid_fd_select_offset;
130 FT_UInt cid_font_name;
132 } CFF_Font_Dict;
135 typedef struct CFF_Private_
136 {
137 FT_Byte num_blue_values;
138 FT_Byte num_other_blues;
139 FT_Byte num_family_blues;
140 FT_Byte num_family_other_blues;
142 FT_Pos blue_values[14];
143 FT_Pos other_blues[10];
144 FT_Pos family_blues[14];
145 FT_Pos family_other_blues[10];
147 FT_Fixed blue_scale;
148 FT_Pos blue_shift;
149 FT_Pos blue_fuzz;
150 FT_Pos standard_width;
151 FT_Pos standard_height;
153 FT_Byte num_snap_widths;
154 FT_Byte num_snap_heights;
155 FT_Pos snap_widths[13];
156 FT_Pos snap_heights[13];
157 FT_Bool force_bold;
158 FT_Fixed force_bold_threshold;
159 FT_Int lenIV;
160 FT_Int language_group;
161 FT_Fixed expansion_factor;
162 FT_Long initial_random_seed;
163 FT_ULong local_subrs_offset;
164 FT_Pos default_width;
165 FT_Pos nominal_width;
167 } CFF_Private;
170 typedef struct CFF_FD_Select_
171 {
172 FT_Byte format;
173 FT_UInt range_count;
175 /* that's the table, taken from the file `as is' */
176 FT_Byte* data;
177 FT_UInt data_size;
179 /* small cache for format 3 only */
180 FT_UInt cache_first;
181 FT_UInt cache_count;
182 FT_Byte cache_fd;
184 } CFF_FD_Select;
187 /* A SubFont packs a font dict and a private dict together. They are */
188 /* needed to support CID-keyed CFF fonts. */
189 typedef struct CFF_SubFont_
190 {
191 CFF_Font_Dict font_dict;
192 CFF_Private private_dict;
194 CFF_Index local_subrs_index;
195 FT_UInt num_local_subrs;
196 FT_Byte** local_subrs;
198 } CFF_SubFont;
201 /* maximum number of sub-fonts in a CID-keyed file */
202 #define CFF_MAX_CID_FONTS 16
205 typedef struct CFF_Font_
206 {
207 FT_Stream stream;
208 FT_Memory memory;
209 FT_UInt num_faces;
210 FT_UInt num_glyphs;
212 FT_Byte version_major;
213 FT_Byte version_minor;
214 FT_Byte header_size;
215 FT_Byte absolute_offsize;
218 CFF_Index name_index;
219 CFF_Index top_dict_index;
220 CFF_Index string_index;
221 CFF_Index global_subrs_index;
223 CFF_Encoding encoding;
224 CFF_Charset charset;
226 CFF_Index charstrings_index;
227 CFF_Index font_dict_index;
228 CFF_Index private_index;
229 CFF_Index local_subrs_index;
231 FT_String* font_name;
232 FT_UInt num_global_subrs;
233 FT_Byte** global_subrs;
235 CFF_SubFont top_font;
236 FT_UInt num_subfonts;
237 CFF_SubFont* subfonts[CFF_MAX_CID_FONTS];
239 CFF_FD_Select fd_select;
241 } CFF_Font;
244 FT_END_HEADER
246 #endif /* __CFFTYPES_H__ */
249 /* END */