]>
Commit | Line | Data |
---|---|---|
cabec872 RR |
1 | /***************************************************************************/ |
2 | /* */ | |
3 | /* z1gload.h */ | |
4 | /* */ | |
5 | /* Experimental Type 1 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 Z1GLOAD_H | |
20 | #define Z1GLOAD_H | |
21 | ||
22 | ||
23 | #ifdef FT_FLAT_COMPILE | |
24 | ||
25 | #include "z1objs.h" | |
26 | ||
27 | #else | |
28 | ||
29 | #include <type1z/z1objs.h> | |
30 | ||
31 | #endif | |
32 | ||
33 | ||
34 | #ifdef __cplusplus | |
35 | extern "C" { | |
36 | #endif | |
37 | ||
38 | ||
39 | /*************************************************************************/ | |
40 | /* */ | |
41 | /* <Structure> */ | |
42 | /* Z1_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 | /* loader :: The current glyph loader. */ | |
55 | /* */ | |
56 | /* current :: The current glyph outline. */ | |
57 | /* */ | |
58 | /* base :: The base glyph outline. */ | |
59 | /* */ | |
60 | /* last :: The last point position. */ | |
61 | /* */ | |
62 | /* scale_x :: The horizontal scale (FUnits to sub-pixels). */ | |
63 | /* */ | |
64 | /* scale_y :: The vertical scale (FUnits to sub-pixels). */ | |
65 | /* */ | |
66 | /* pos_x :: The horizontal translation (for composite glyphs). */ | |
67 | /* */ | |
68 | /* pos_y :: The vertical translation (for composite glyphs). */ | |
69 | /* */ | |
70 | /* left_bearing :: The left side bearing point. */ | |
71 | /* */ | |
72 | /* advance :: The horizontal advance vector. */ | |
73 | /* */ | |
74 | /* no_recurse :: */ | |
75 | /* */ | |
76 | /* bbox :: The glyph's bounding box. */ | |
77 | /* */ | |
78 | /* path_begun :: A flag which indicates that a new path has begun. */ | |
79 | /* */ | |
80 | /* load_points :: A flag which indicates, if not set, that no points */ | |
81 | /* are loaded. */ | |
82 | /* */ | |
83 | /* error :: The current error code. */ | |
84 | /* */ | |
85 | /* metrics_only :: A flag whether to compute metrics only. */ | |
86 | /* */ | |
87 | typedef struct Z1_Builder_ | |
88 | { | |
89 | FT_Memory memory; | |
90 | T1_Face face; | |
91 | Z1_GlyphSlot glyph; | |
92 | FT_GlyphLoader* loader; | |
93 | ||
94 | FT_Outline* current; /* the current glyph outline */ | |
95 | FT_Outline* base; /* the composite glyph outline */ | |
96 | ||
97 | FT_Vector last; | |
98 | ||
99 | FT_Fixed scale_x; | |
100 | FT_Fixed scale_y; | |
101 | ||
102 | FT_Pos pos_x; | |
103 | FT_Pos pos_y; | |
104 | ||
105 | FT_Vector left_bearing; | |
106 | FT_Vector advance; | |
107 | ||
108 | FT_BBox bbox; /* bounding box */ | |
109 | FT_Bool path_begun; | |
110 | FT_Bool load_points; | |
111 | FT_Bool no_recurse; | |
112 | ||
113 | FT_Error error; /* only used for memory errors */ | |
114 | FT_Bool metrics_only; | |
115 | ||
116 | } Z1_Builder; | |
117 | ||
118 | ||
119 | /* execution context charstring zone */ | |
120 | typedef struct Z1_Decoder_Zone_ | |
121 | { | |
122 | FT_Byte* base; | |
123 | FT_Byte* limit; | |
124 | FT_Byte* cursor; | |
125 | ||
126 | } Z1_Decoder_Zone; | |
127 | ||
128 | ||
129 | typedef struct Z1_Decoder_ | |
130 | { | |
131 | Z1_Builder builder; | |
132 | ||
133 | FT_Int stack[T1_MAX_CHARSTRINGS_OPERANDS]; | |
134 | FT_Int* top; | |
135 | ||
136 | Z1_Decoder_Zone zones[T1_MAX_SUBRS_CALLS + 1]; | |
137 | Z1_Decoder_Zone* zone; | |
138 | ||
139 | FT_Int flex_state; | |
140 | FT_Int num_flex_vectors; | |
141 | FT_Vector flex_vectors[7]; | |
142 | ||
143 | T1_Blend* blend; /* for multiple masters */ | |
144 | ||
145 | } Z1_Decoder; | |
146 | ||
147 | ||
148 | LOCAL_DEF | |
149 | void Z1_Init_Builder( Z1_Builder* builder, | |
150 | T1_Face face, | |
151 | Z1_Size size, | |
152 | Z1_GlyphSlot glyph ); | |
153 | ||
154 | LOCAL_DEF | |
155 | void Z1_Done_Builder( Z1_Builder* builder ); | |
156 | ||
157 | LOCAL_DEF | |
158 | void Z1_Init_Decoder( Z1_Decoder* decoder ); | |
159 | ||
160 | LOCAL_DEF | |
161 | FT_Error Z1_Compute_Max_Advance( T1_Face face, | |
162 | FT_Int* max_advance ); | |
163 | ||
164 | LOCAL_DEF | |
165 | FT_Error Z1_Parse_CharStrings( Z1_Decoder* decoder, | |
166 | FT_Byte* charstring_base, | |
167 | FT_Int charstring_len, | |
168 | FT_Int num_subrs, | |
169 | FT_Byte** subrs_base, | |
170 | FT_Int* subrs_len ); | |
171 | ||
172 | LOCAL_DEF | |
173 | FT_Error Z1_Load_Glyph( Z1_GlyphSlot glyph, | |
174 | Z1_Size size, | |
175 | FT_Int glyph_index, | |
176 | FT_Int load_flags ); | |
177 | ||
178 | ||
179 | #ifdef __cplusplus | |
180 | } | |
181 | #endif | |
182 | ||
183 | ||
184 | #endif /* Z1GLOAD_H */ | |
185 | ||
186 | ||
187 | /* END */ |