]>
Commit | Line | Data |
---|---|---|
cabec872 RR |
1 | /***************************************************************************/ |
2 | /* */ | |
3 | /* cidgload.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 CIDGLOAD_H | |
20 | #define CIDGLOAD_H | |
21 | ||
22 | ||
23 | #ifdef FT_FLAT_COMPILE | |
24 | ||
25 | #include "cidobjs.h" | |
26 | ||
27 | #else | |
28 | ||
29 | #include <cid/cidobjs.h> | |
30 | ||
31 | #endif | |
32 | ||
33 | ||
34 | #ifdef __cplusplus | |
35 | extern "C" { | |
36 | #endif | |
37 | ||
38 | ||
39 | /*************************************************************************/ | |
40 | /* */ | |
41 | /* <Structure> */ | |
42 | /* CID_Builder */ | |
43 | /* */ | |
44 | /* <Description> */ | |
45 | /* A structure used during glyph loading to store its outline. */ | |
46 | /* */ | |
47 | /* <Fields> */ | |
48 | /* memory :: The current memory object. */ | |
49 | /* */ | |
50 | /* face :: The current face object. */ | |
51 | /* */ | |
52 | /* glyph :: The current glyph slot. */ | |
53 | /* */ | |
54 | /* current :: The current glyph outline. */ | |
55 | /* */ | |
56 | /* base :: The base glyph outline. */ | |
57 | /* */ | |
58 | /* max_points :: maximum points in builder outline */ | |
59 | /* */ | |
60 | /* max_contours :: Maximal number of contours in builder outline. */ | |
61 | /* */ | |
62 | /* last :: The last point position. */ | |
63 | /* */ | |
64 | /* scale_x :: The horizontal scale (FUnits to sub-pixels). */ | |
65 | /* */ | |
66 | /* scale_y :: The vertical scale (FUnits to sub-pixels). */ | |
67 | /* */ | |
68 | /* pos_x :: The horizontal translation (if composite glyph). */ | |
69 | /* */ | |
70 | /* pos_y :: The vertical translation (if composite glyph). */ | |
71 | /* */ | |
72 | /* left_bearing :: The left side bearing point. */ | |
73 | /* */ | |
74 | /* advance :: The horizontal advance vector. */ | |
75 | /* */ | |
76 | /* bbox :: Unused. */ | |
77 | /* */ | |
78 | /* path_begun :: A flag which indicates that a new path has begun. */ | |
79 | /* */ | |
80 | /* load_points :: If this flag is not set, no points are loaded. */ | |
81 | /* */ | |
82 | /* no_recurse :: Set but not used. */ | |
83 | /* */ | |
84 | /* error :: An error code that is only used to report memory */ | |
85 | /* allocation problems. */ | |
86 | /* */ | |
87 | /* metrics_only :: A boolean indicating that we only want to compute */ | |
88 | /* the metrics of a given glyph, not load all of its */ | |
89 | /* points. */ | |
90 | /* */ | |
91 | typedef struct CID_Builder_ | |
92 | { | |
93 | FT_Memory memory; | |
94 | CID_Face face; | |
95 | CID_GlyphSlot glyph; | |
96 | FT_GlyphLoader* loader; | |
97 | FT_Outline* base; | |
98 | FT_Outline* current; | |
99 | ||
100 | FT_Vector last; | |
101 | ||
102 | FT_Fixed scale_x; | |
103 | FT_Fixed scale_y; | |
104 | ||
105 | FT_Pos pos_x; | |
106 | FT_Pos pos_y; | |
107 | ||
108 | FT_Vector left_bearing; | |
109 | FT_Vector advance; | |
110 | ||
111 | FT_BBox bbox; /* bounding box */ | |
112 | FT_Bool path_begun; | |
113 | FT_Bool load_points; | |
114 | FT_Bool no_recurse; | |
115 | ||
116 | FT_Error error; /* only used for memory errors */ | |
117 | FT_Bool metrics_only; | |
118 | ||
119 | } CID_Builder; | |
120 | ||
121 | ||
122 | /* execution context charstring zone */ | |
123 | ||
124 | typedef struct CID_Decoder_Zone_ | |
125 | { | |
126 | FT_Byte* base; | |
127 | FT_Byte* limit; | |
128 | FT_Byte* cursor; | |
129 | ||
130 | } CID_Decoder_Zone; | |
131 | ||
132 | ||
133 | typedef struct CID_Decoder_ | |
134 | { | |
135 | CID_Builder builder; | |
136 | ||
137 | FT_Int stack[T1_MAX_CHARSTRINGS_OPERANDS]; | |
138 | FT_Int* top; | |
139 | ||
140 | CID_Decoder_Zone zones[T1_MAX_SUBRS_CALLS + 1]; | |
141 | CID_Decoder_Zone* zone; | |
142 | ||
143 | FT_Matrix font_matrix; | |
144 | CID_Subrs* subrs; | |
145 | FT_UInt lenIV; | |
146 | ||
147 | FT_Int flex_state; | |
148 | FT_Int num_flex_vectors; | |
149 | FT_Vector flex_vectors[7]; | |
150 | ||
151 | } CID_Decoder; | |
152 | ||
153 | ||
154 | LOCAL_DEF | |
155 | void CID_Init_Builder( CID_Builder* builder, | |
156 | CID_Face face, | |
157 | CID_Size size, | |
158 | CID_GlyphSlot glyph ); | |
159 | ||
160 | LOCAL_DEF | |
161 | void CID_Done_Builder( CID_Builder* builder ); | |
162 | ||
163 | ||
164 | LOCAL_DEF | |
165 | void CID_Init_Decoder( CID_Decoder* decoder ); | |
166 | ||
167 | ||
168 | #if 0 | |
169 | ||
170 | /* Compute the maximum advance width of a font through quick parsing */ | |
171 | LOCAL_DEF | |
172 | FT_Error CID_Compute_Max_Advance( CID_Face face, | |
173 | FT_Int* max_advance ); | |
174 | ||
175 | #endif | |
176 | ||
177 | /* This function is exported, because it is used by the T1Dump utility */ | |
178 | LOCAL_DEF | |
179 | FT_Error CID_Parse_CharStrings( CID_Decoder* decoder, | |
180 | FT_Byte* charstring_base, | |
181 | FT_Int charstring_len ); | |
182 | ||
183 | LOCAL_DEF | |
184 | FT_Error CID_Load_Glyph( CID_GlyphSlot glyph, | |
185 | CID_Size size, | |
186 | FT_Int glyph_index, | |
187 | FT_Int load_flags ); | |
188 | ||
189 | ||
190 | #ifdef __cplusplus | |
191 | } | |
192 | #endif | |
193 | ||
194 | ||
195 | #endif /* CIDGLOAD_H */ | |
196 | ||
197 | ||
198 | /* END */ |