OLD | NEW |
| (Empty) |
1 /***************************************************************************/ | |
2 /* */ | |
3 /* cffgload.h */ | |
4 /* */ | |
5 /* OpenType Glyph Loader (specification). */ | |
6 /* */ | |
7 /* Copyright 1996-2004, 2006-2009, 2013 by */ | |
8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ | |
9 /* */ | |
10 /* This file is part of the FreeType project, and may only be used, */ | |
11 /* modified, and distributed under the terms of the FreeType project */ | |
12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ | |
13 /* this file you indicate that you have read the license and */ | |
14 /* understand and accept it fully. */ | |
15 /* */ | |
16 /***************************************************************************/ | |
17 | |
18 | |
19 #ifndef __CFFGLOAD_H__ | |
20 #define __CFFGLOAD_H__ | |
21 | |
22 | |
23 #include "../../include/ft2build.h" | |
24 #include "../../include/freetype/freetype.h" | |
25 #include "cffobjs.h" | |
26 | |
27 | |
28 FT_BEGIN_HEADER | |
29 | |
30 | |
31 #define CFF_MAX_OPERANDS 48 | |
32 #define CFF_MAX_SUBRS_CALLS 32 | |
33 #define CFF_MAX_TRANS_ELEMENTS 32 | |
34 | |
35 | |
36 /*************************************************************************/ | |
37 /* */ | |
38 /* <Structure> */ | |
39 /* CFF_Builder */ | |
40 /* */ | |
41 /* <Description> */ | |
42 /* A structure used during glyph loading to store its outline. */ | |
43 /* */ | |
44 /* <Fields> */ | |
45 /* memory :: The current memory object. */ | |
46 /* */ | |
47 /* face :: The current face object. */ | |
48 /* */ | |
49 /* glyph :: The current glyph slot. */ | |
50 /* */ | |
51 /* loader :: The current glyph loader. */ | |
52 /* */ | |
53 /* base :: The base glyph outline. */ | |
54 /* */ | |
55 /* current :: The current glyph outline. */ | |
56 /* */ | |
57 /* pos_x :: The horizontal translation (if composite glyph). */ | |
58 /* */ | |
59 /* pos_y :: The vertical translation (if composite glyph). */ | |
60 /* */ | |
61 /* left_bearing :: The left side bearing point. */ | |
62 /* */ | |
63 /* advance :: The horizontal advance vector. */ | |
64 /* */ | |
65 /* bbox :: Unused. */ | |
66 /* */ | |
67 /* path_begun :: A flag which indicates that a new path has begun. */ | |
68 /* */ | |
69 /* load_points :: If this flag is not set, no points are loaded. */ | |
70 /* */ | |
71 /* no_recurse :: Set but not used. */ | |
72 /* */ | |
73 /* metrics_only :: A boolean indicating that we only want to compute */ | |
74 /* the metrics of a given glyph, not load all of its */ | |
75 /* points. */ | |
76 /* */ | |
77 /* hints_funcs :: Auxiliary pointer for hinting. */ | |
78 /* */ | |
79 /* hints_globals :: Auxiliary pointer for hinting. */ | |
80 /* */ | |
81 typedef struct CFF_Builder_ | |
82 { | |
83 FT_Memory memory; | |
84 TT_Face face; | |
85 CFF_GlyphSlot glyph; | |
86 FT_GlyphLoader loader; | |
87 FT_Outline* base; | |
88 FT_Outline* current; | |
89 | |
90 FT_Pos pos_x; | |
91 FT_Pos pos_y; | |
92 | |
93 FT_Vector left_bearing; | |
94 FT_Vector advance; | |
95 | |
96 FT_BBox bbox; /* bounding box */ | |
97 FT_Bool path_begun; | |
98 FT_Bool load_points; | |
99 FT_Bool no_recurse; | |
100 | |
101 FT_Bool metrics_only; | |
102 | |
103 void* hints_funcs; /* hinter-specific */ | |
104 void* hints_globals; /* hinter-specific */ | |
105 | |
106 } CFF_Builder; | |
107 | |
108 | |
109 FT_LOCAL( FT_Error ) | |
110 cff_check_points( CFF_Builder* builder, | |
111 FT_Int count ); | |
112 | |
113 FT_LOCAL( void ) | |
114 cff_builder_add_point( CFF_Builder* builder, | |
115 FT_Pos x, | |
116 FT_Pos y, | |
117 FT_Byte flag ); | |
118 FT_LOCAL( FT_Error ) | |
119 cff_builder_add_point1( CFF_Builder* builder, | |
120 FT_Pos x, | |
121 FT_Pos y ); | |
122 FT_LOCAL( FT_Error ) | |
123 cff_builder_start_point( CFF_Builder* builder, | |
124 FT_Pos x, | |
125 FT_Pos y ); | |
126 FT_LOCAL( void ) | |
127 cff_builder_close_contour( CFF_Builder* builder ); | |
128 | |
129 | |
130 FT_LOCAL( FT_Int ) | |
131 cff_lookup_glyph_by_stdcharcode( CFF_Font cff, | |
132 FT_Int charcode ); | |
133 FT_LOCAL( FT_Error ) | |
134 cff_get_glyph_data( TT_Face face, | |
135 FT_UInt glyph_index, | |
136 FT_Byte** pointer, | |
137 FT_ULong* length ); | |
138 FT_LOCAL( void ) | |
139 cff_free_glyph_data( TT_Face face, | |
140 FT_Byte** pointer, | |
141 FT_ULong length ); | |
142 | |
143 | |
144 /* execution context charstring zone */ | |
145 | |
146 typedef struct CFF_Decoder_Zone_ | |
147 { | |
148 FT_Byte* base; | |
149 FT_Byte* limit; | |
150 FT_Byte* cursor; | |
151 | |
152 } CFF_Decoder_Zone; | |
153 | |
154 | |
155 typedef struct CFF_Decoder_ | |
156 { | |
157 CFF_Builder builder; | |
158 CFF_Font cff; | |
159 | |
160 FT_Fixed stack[CFF_MAX_OPERANDS + 1]; | |
161 FT_Fixed* top; | |
162 | |
163 CFF_Decoder_Zone zones[CFF_MAX_SUBRS_CALLS + 1]; | |
164 CFF_Decoder_Zone* zone; | |
165 | |
166 FT_Int flex_state; | |
167 FT_Int num_flex_vectors; | |
168 FT_Vector flex_vectors[7]; | |
169 | |
170 FT_Pos glyph_width; | |
171 FT_Pos nominal_width; | |
172 | |
173 FT_Bool read_width; | |
174 FT_Bool width_only; | |
175 FT_Int num_hints; | |
176 FT_Fixed buildchar[CFF_MAX_TRANS_ELEMENTS]; | |
177 | |
178 FT_UInt num_locals; | |
179 FT_UInt num_globals; | |
180 | |
181 FT_Int locals_bias; | |
182 FT_Int globals_bias; | |
183 | |
184 FT_Byte** locals; | |
185 FT_Byte** globals; | |
186 | |
187 FT_Byte** glyph_names; /* for pure CFF fonts only */ | |
188 FT_UInt num_glyphs; /* number of glyphs in font */ | |
189 | |
190 FT_Render_Mode hint_mode; | |
191 | |
192 FT_Bool seac; | |
193 | |
194 CFF_SubFont current_subfont; /* for current glyph_index */ | |
195 | |
196 } CFF_Decoder; | |
197 | |
198 | |
199 FT_LOCAL( void ) | |
200 cff_decoder_init( CFF_Decoder* decoder, | |
201 TT_Face face, | |
202 CFF_Size size, | |
203 CFF_GlyphSlot slot, | |
204 FT_Bool hinting, | |
205 FT_Render_Mode hint_mode ); | |
206 | |
207 FT_LOCAL( FT_Error ) | |
208 cff_decoder_prepare( CFF_Decoder* decoder, | |
209 CFF_Size size, | |
210 FT_UInt glyph_index ); | |
211 | |
212 #if 0 /* unused until we support pure CFF fonts */ | |
213 | |
214 /* Compute the maximum advance width of a font through quick parsing */ | |
215 FT_LOCAL( FT_Error ) | |
216 cff_compute_max_advance( TT_Face face, | |
217 FT_Int* max_advance ); | |
218 | |
219 #endif /* 0 */ | |
220 | |
221 #ifdef CFF_CONFIG_OPTION_OLD_ENGINE | |
222 FT_LOCAL( FT_Error ) | |
223 cff_decoder_parse_charstrings( CFF_Decoder* decoder, | |
224 FT_Byte* charstring_base, | |
225 FT_ULong charstring_len ); | |
226 #endif | |
227 | |
228 FT_LOCAL( FT_Error ) | |
229 cff_slot_load( CFF_GlyphSlot glyph, | |
230 CFF_Size size, | |
231 FT_UInt glyph_index, | |
232 FT_Int32 load_flags ); | |
233 | |
234 | |
235 FT_END_HEADER | |
236 | |
237 #endif /* __CFFGLOAD_H__ */ | |
238 | |
239 | |
240 /* END */ | |
OLD | NEW |