]> git.saurik.com Git - wxWidgets.git/blob - src/freetype/cff/t2gload.h
use the new wxSystemSettings API everywhere
[wxWidgets.git] / src / freetype / cff / t2gload.h
1 /***************************************************************************/
2 /* */
3 /* t2gload.h */
4 /* */
5 /* OpenType Glyph Loader (specification). */
6 /* */
7 /* Copyright 1996-2000 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 T2GLOAD_H
20 #define T2GLOAD_H
21
22 #include <freetype/freetype.h>
23
24
25 #ifdef FT_FLAT_COMPILE
26
27 #include "t2objs.h"
28
29 #else
30
31 #include <cff/t2objs.h>
32
33 #endif
34
35
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39
40
41 #define T2_MAX_OPERANDS 48
42 #define T2_MAX_SUBRS_CALLS 32
43
44
45 /*************************************************************************/
46 /* */
47 /* <Structure> */
48 /* T2_Builder */
49 /* */
50 /* <Description> */
51 /* A structure used during glyph loading to store its outline. */
52 /* */
53 /* <Fields> */
54 /* memory :: The current memory object. */
55 /* */
56 /* face :: The current face object. */
57 /* */
58 /* glyph :: The current glyph slot. */
59 /* */
60 /* current :: The current glyph outline. */
61 /* */
62 /* base :: The base glyph outline. */
63 /* */
64 /* max_points :: maximum points in builder outline */
65 /* */
66 /* max_contours :: Maximal number of contours in builder outline. */
67 /* */
68 /* last :: The last point position. */
69 /* */
70 /* scale_x :: The horizontal scale (FUnits to sub-pixels). */
71 /* */
72 /* scale_y :: The vertical scale (FUnits to sub-pixels). */
73 /* */
74 /* pos_x :: The horizontal translation (if composite glyph). */
75 /* */
76 /* pos_y :: The vertical translation (if composite glyph). */
77 /* */
78 /* left_bearing :: The left side bearing point. */
79 /* */
80 /* advance :: The horizontal advance vector. */
81 /* */
82 /* bbox :: Unused. */
83 /* */
84 /* path_begun :: A flag which indicates that a new path has begun. */
85 /* */
86 /* load_points :: If this flag is not set, no points are loaded. */
87 /* */
88 /* no_recurse :: Set but not used. */
89 /* */
90 /* error :: An error code that is only used to report memory */
91 /* allocation problems. */
92 /* */
93 /* metrics_only :: A boolean indicating that we only want to compute */
94 /* the metrics of a given glyph, not load all of its */
95 /* points. */
96 /* */
97 typedef struct T2_Builder_
98 {
99 FT_Memory memory;
100 TT_Face face;
101 T2_GlyphSlot glyph;
102 FT_GlyphLoader* loader;
103 FT_Outline* base;
104 FT_Outline* current;
105
106 FT_Vector last;
107
108 FT_Fixed scale_x;
109 FT_Fixed scale_y;
110
111 FT_Pos pos_x;
112 FT_Pos pos_y;
113
114 FT_Vector left_bearing;
115 FT_Vector advance;
116
117 FT_BBox bbox; /* bounding box */
118 FT_Bool path_begun;
119 FT_Bool load_points;
120 FT_Bool no_recurse;
121
122 FT_Error error; /* only used for memory errors */
123 FT_Bool metrics_only;
124
125 } T2_Builder;
126
127
128 /* execution context charstring zone */
129
130 typedef struct T2_Decoder_Zone_
131 {
132 FT_Byte* base;
133 FT_Byte* limit;
134 FT_Byte* cursor;
135
136 } T2_Decoder_Zone;
137
138
139 typedef struct T2_Decoder_
140 {
141 T2_Builder builder;
142 CFF_Font* cff;
143
144 FT_Fixed stack[T2_MAX_OPERANDS + 1];
145 FT_Fixed* top;
146
147 T2_Decoder_Zone zones[T2_MAX_SUBRS_CALLS + 1];
148 T2_Decoder_Zone* zone;
149
150 FT_Int flex_state;
151 FT_Int num_flex_vectors;
152 FT_Vector flex_vectors[7];
153
154 FT_Pos glyph_width;
155 FT_Pos nominal_width;
156
157 FT_Bool read_width;
158 FT_Int num_hints;
159 FT_Fixed* buildchar;
160 FT_Int len_buildchar;
161
162 FT_UInt num_locals;
163 FT_UInt num_globals;
164
165 FT_Int locals_bias;
166 FT_Int globals_bias;
167
168 FT_Byte** locals;
169 FT_Byte** globals;
170
171 } T2_Decoder;
172
173
174 LOCAL_DEF
175 void T2_Init_Decoder( T2_Decoder* decoder,
176 TT_Face face,
177 T2_Size size,
178 T2_GlyphSlot slot );
179
180 LOCAL_DEF
181 void T2_Prepare_Decoder( T2_Decoder* decoder,
182 FT_UInt glyph_index );
183
184 #if 0 /* unused until we support pure CFF fonts */
185
186 /* Compute the maximum advance width of a font through quick parsing */
187 LOCAL_DEF
188 FT_Error T2_Compute_Max_Advance( TT_Face face,
189 FT_Int* max_advance );
190
191 #endif /* 0 */
192
193 LOCAL_DEF
194 FT_Error T2_Parse_CharStrings( T2_Decoder* decoder,
195 FT_Byte* charstring_base,
196 FT_Int charstring_len );
197
198 LOCAL_DEF
199 FT_Error T2_Load_Glyph( T2_GlyphSlot glyph,
200 T2_Size size,
201 FT_Int glyph_index,
202 FT_Int load_flags );
203
204
205 #ifdef __cplusplus
206 }
207 #endif
208
209
210 #endif /* T2GLOAD_H */
211
212
213 /* END */