]> git.saurik.com Git - wxWidgets.git/blob - src/freetype/type1/t1parse.h
minor flicker reduction in the virtual list ctrl
[wxWidgets.git] / src / freetype / type1 / t1parse.h
1 /***************************************************************************/
2 /* */
3 /* t1parse.h */
4 /* */
5 /* Type 1 parser (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 /*************************************************************************/
20 /* */
21 /* The Type1 parser component is in charge of simply parsing the font */
22 /* input stream and convert simple tokens and elements into integers, */
23 /* floats, matrices, strings, etc. */
24 /* */
25 /* It is used by the Type1 loader. */
26 /* */
27 /*************************************************************************/
28
29
30 #ifndef T1PARSE_H
31 #define T1PARSE_H
32
33 #include <freetype/internal/ftstream.h>
34
35
36 #ifdef FT_FLAT_COMPILE
37
38 #include "t1tokens.h"
39
40 #else
41
42 #include <type1/t1tokens.h>
43
44 #endif
45
46
47 #ifdef __cplusplus
48 extern "C" {
49 #endif
50
51
52 /*************************************************************************/
53 /* */
54 /* <Enum> */
55 /* T1_DictState */
56 /* */
57 /* <Description> */
58 /* An enumeration used to describe the Type 1 parser's state, i.e. */
59 /* which dictionary (or array) it is scanning and processing at the */
60 /* current moment. */
61 /* */
62 typedef enum T1_DictState_
63 {
64 dict_none = 0,
65 dict_font, /* parsing the font dictionary */
66 dict_fontinfo, /* parsing the font info dictionary */
67 dict_none2, /* beginning to parse the encrypted section */
68 dict_private, /* parsing the private dictionary */
69 dict_encoding, /* parsing the encoding array */
70 dict_subrs, /* parsing the subrs array */
71 dict_othersubrs, /* parsing the othersubrs array (?) */
72 dict_charstrings, /* parsing the charstrings dictionary */
73 dict_unknown_array, /* parsing/ignoring an unknown array */
74 dict_unknown_dict, /* parsing/ignoring an unknown dictionary */
75
76 dict_max /* do not remove from list */
77
78 } T1_DictState;
79
80
81 /*************************************************************************/
82 /* */
83 /* <Struct> */
84 /* T1_Table */
85 /* */
86 /* <Description> */
87 /* A T1_Table is a simple object used to store an array of objects in */
88 /* a single memory block. */
89 /* */
90 /* <Fields> */
91 /* block :: The address in memory of the growheap's block. This */
92 /* can change between two object adds, due to */
93 /* reallocation. */
94 /* */
95 /* cursor :: The current top of the grow heap within its block. */
96 /* */
97 /* capacity :: The current size of the heap block. Increments by */
98 /* 1kByte chunks. */
99 /* */
100 /* max_elems :: The maximum number of elements in table. */
101 /* */
102 /* num_elems :: The current number of elements in table. */
103 /* */
104 /* elements :: A table of element addresses within the block. */
105 /* */
106 /* lengths :: A table of element sizes within the block. */
107 /* */
108 /* memory :: The object used for memory operations */
109 /* (alloc/realloc). */
110 /* */
111 typedef struct T1_Table_
112 {
113 FT_Byte* block; /* current memory block */
114 FT_Int cursor; /* current cursor in memory block */
115 FT_Int capacity; /* current size of memory block */
116
117 FT_Int max_elems;
118 FT_Int num_elems;
119 FT_Byte** elements; /* addresses of table elements */
120 FT_Int* lengths; /* lengths of table elements */
121
122 FT_Memory memory;
123
124 } T1_Table;
125
126
127 /*************************************************************************/
128 /* */
129 /* <Struct> */
130 /* T1_Parser */
131 /* */
132 /* <Description> */
133 /* A Type 1 parser. This object is in charge of parsing Type 1 ASCII */
134 /* streams and builds dictionaries for a T1_Face object. */
135 /* */
136 /* <Fields> */
137 /* error :: The current error code. 0 means success. */
138 /* */
139 /* face :: The target T1_Face object being built. */
140 /* */
141 /* tokenizer :: The tokenizer (lexical analyser) used for */
142 /* processing the input stream. */
143 /* */
144 /* dump_tokens :: XXX */
145 /* */
146 /* stack :: The current token stack. Note that we don't */
147 /* use intermediate Postscript objects here! */
148 /* */
149 /* top :: The current top of token stack. */
150 /* */
151 /* limit :: The current upper bound of the token stack. */
152 /* Used for overflow checks. */
153 /* */
154 /* args :: The arguments of a given operator. Used and */
155 /* increased by the various CopyXXX() functions. */
156 /* */
157 /* state_index :: The index of the top of the dictionary state */
158 /* stack. */
159 /* */
160 /* state_stack :: The dictionary states stack. */
161 /* */
162 /* table :: A T1_Table object used to record various kinds */
163 /* of dictionaries or arrays (like `/Encoding', */
164 /* `/Subrs', `/CharStrings'). */
165 /* */
166 /* cur_name :: XXX */
167 /* */
168 /* encoding_type :: XXX */
169 /* */
170 /* encoding_names :: XXX */
171 /* */
172 /* encoding_lengths :: XXX */
173 /* */
174 /* encoding_offsets :: XXX */
175 /* */
176 /* subrs :: XXX */
177 /* */
178 /* charstrings :: XXX */
179 /* */
180 typedef struct T1_Parser_
181 {
182 FT_Error error;
183 T1_Face face;
184
185 T1_Tokenizer tokenizer;
186 FT_Bool dump_tokens;
187
188 T1_Token stack[T1_MAX_STACK_DEPTH];
189 T1_Token* top;
190 T1_Token* limit;
191 T1_Token* args;
192
193 FT_Int state_index;
194 T1_DictState state_stack[T1_MAX_DICT_DEPTH];
195
196 T1_Table table;
197
198 FT_Int cur_name;
199
200 T1_EncodingType encoding_type;
201 FT_Byte* encoding_names;
202 FT_Int* encoding_lengths;
203 FT_Byte** encoding_offsets;
204
205 FT_Byte* subrs;
206 FT_Byte* charstrings;
207
208 } T1_Parser;
209
210
211 LOCAL_DEF
212 FT_Error T1_New_Table( T1_Table* table,
213 FT_Int count,
214 FT_Memory memory );
215
216 LOCAL_DEF
217 FT_Error T1_Add_Table( T1_Table* table,
218 FT_Int index,
219 void* object,
220 FT_Int length );
221
222 LOCAL_DEF
223 void T1_Done_Table( T1_Table* table );
224
225
226 LOCAL_DEF
227 FT_String* CopyString( T1_Parser* parser );
228
229 LOCAL_DEF
230 FT_Long CopyInteger( T1_Parser* parser );
231
232 LOCAL_DEF
233 FT_Bool CopyBoolean( T1_Parser* parser );
234
235 LOCAL_DEF
236 FT_Long CopyFloat( T1_Parser* parser,
237 FT_Int scale );
238
239 LOCAL_DEF
240 void CopyBBox( T1_Parser* parser,
241 FT_BBox* bbox );
242
243 LOCAL_DEF
244 void CopyMatrix( T1_Parser* parser,
245 FT_Matrix* matrix );
246
247 LOCAL_DEF
248 void CopyArray( T1_Parser* parser,
249 FT_Byte* num_elements,
250 FT_Short* elements,
251 FT_Int max_elements );
252
253
254 #ifdef __cplusplus
255 }
256 #endif
257
258 #endif /* T1PARSE_H */
259
260
261 /* END */