]> git.saurik.com Git - wxWidgets.git/blob - src/freetype/type1/t1tokens.h
Added FreeType II beta 8.
[wxWidgets.git] / src / freetype / type1 / t1tokens.h
1 /***************************************************************************/
2 /* */
3 /* t1tokens.h */
4 /* */
5 /* Type 1 tokenizer (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 T1TOKENS_H
20 #define T1TOKENS_H
21
22
23 #ifdef FT_FLAT_COMPILE
24
25 #include "t1objs.h"
26
27 #else
28
29 #include <type1/t1objs.h>
30
31 #endif
32
33
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37
38
39 /* enum value of first keyword */
40 #define key_first_ 100
41
42 /* enum value of first immediate name */
43 #define imm_first_ 200
44
45
46 typedef enum T1_TokenType_
47 {
48 tok_error = 0,
49
50 tok_eof, /* end of file */
51
52 /* simple token types */
53
54 tok_keyword, /* keyword */
55 tok_number, /* number (integer or real) */
56 tok_string, /* postscript string */
57 tok_program, /* postscript program */
58 tok_immediate, /* any immediate name */
59 tok_array, /* matrix, array, etc.. */
60 tok_hexarray, /* array of hexadecimal nibbles */
61 tok_any, /* anything else */
62
63 /* Postscript keywords -- placed in lexicographical order */
64
65 key_RD_alternate = key_first_, /* `-|' = alternate form of RD */
66 key_ExpertEncoding,
67 key_ND,
68 key_NP,
69 key_RD,
70 key_StandardEncoding,
71 key_array,
72 key_begin,
73 key_closefile,
74 key_currentdict,
75 key_currentfile,
76 key_def,
77 key_dict,
78 key_dup,
79 key_eexec,
80 key_end,
81 key_execonly,
82 key_false,
83 key_for,
84 key_index,
85 key_noaccess,
86 key_put,
87 key_readonly,
88 key_true,
89 key_userdict,
90 key_NP_alternate, /* `|' = alternate form of NP */
91 key_ND_alternate, /* `|-' = alternate form of ND */
92
93 key_max, /* always keep this value there */
94
95 /* Postscript immediate names -- other names will be ignored, except */
96 /* in charstrings */
97
98 imm_RD_alternate = imm_first_, /* `-|' = alternate form of RD */
99 imm_notdef, /* `/.notdef' immediate */
100 imm_BlendAxisTypes,
101 imm_BlueFuzz,
102 imm_BlueScale,
103 imm_BlueShift,
104 imm_BlueValues,
105 imm_CharStrings,
106 imm_Encoding,
107 imm_FamilyBlues,
108 imm_FamilyName,
109 imm_FamilyOtherBlues,
110 imm_FID,
111 imm_FontBBox,
112 imm_FontID,
113 imm_FontInfo,
114 imm_FontMatrix,
115 imm_FontName,
116 imm_FontType,
117 imm_ForceBold,
118 imm_FullName,
119 imm_ItalicAngle,
120 imm_LanguageGroup,
121 imm_Metrics,
122 imm_MinFeature,
123 imm_ND,
124 imm_NP,
125 imm_Notice,
126 imm_OtherBlues,
127 imm_OtherSubrs,
128 imm_PaintType,
129 imm_Private,
130 imm_RD,
131 imm_RndStemUp,
132 imm_StdHW,
133 imm_StdVW,
134 imm_StemSnapH,
135 imm_StemSnapV,
136 imm_StrokeWidth,
137 imm_Subrs,
138 imm_UnderlinePosition,
139 imm_UnderlineThickness,
140 imm_UniqueID,
141 imm_Weight,
142
143 imm_isFixedPitch,
144 imm_lenIV,
145 imm_password,
146 imm_version,
147
148 imm_NP_alternate, /* `|' = alternate form of NP */
149 imm_ND_alternate, /* `|-' = alternate form of ND */
150
151 imm_max /* always keep this value here */
152
153 } T1_TokenType;
154
155
156 /* these arrays are visible for debugging purposes */
157 extern const char* t1_keywords[];
158 extern const char* t1_immediates[];
159
160
161 /*************************************************************************/
162 /* */
163 /* <Struct> */
164 /* T1_Token */
165 /* */
166 /* <Description> */
167 /* A structure used to describe a token in the current input stream. */
168 /* Note that the Type1 driver doesn't try to interpret tokens until */
169 /* it really needs to. */
170 /* */
171 /* <Fields> */
172 /* kind :: The token type. Describes the token to the loader. */
173 /* */
174 /* kind2 :: Detailed token type. */
175 /* */
176 /* start :: The index of the first character of token in the input */
177 /* stream. */
178 /* */
179 /* len :: The length of the token in characters. */
180 /* */
181 typedef struct T1_Token_
182 {
183 T1_TokenType kind; /* simple type */
184 T1_TokenType kind2; /* detailed type */
185 FT_Int start; /* index of first token character */
186 FT_Int len; /* length of token in chars */
187
188 } T1_Token;
189
190
191 typedef struct T1_TokenParser_
192 {
193 FT_Memory memory;
194 FT_Stream stream;
195
196 FT_Bool in_pfb; /* true if PFB file, PFA otherwise */
197 FT_Bool in_private; /* true if in private dictionary */
198
199 FT_Byte* base; /* base address of current read buffer */
200 FT_Long cursor; /* current position in read buffer */
201 FT_Long limit; /* limit of current read buffer */
202 FT_Long max; /* maximum size of read buffer */
203
204 FT_Error error; /* last error */
205 T1_Token token; /* last token read */
206
207 } T1_TokenParser;
208
209
210 /*************************************************************************/
211 /* */
212 /* <Type> */
213 /* T1_Tokenizer */
214 /* */
215 /* <Description> */
216 /* A handle to an object used to extract tokens from the input. The */
217 /* object is able to perform PFA/PFB recognition, eexec decryption of */
218 /* the private dictionary, as well as eexec decryption of the */
219 /* charstrings. */
220 /* */
221 typedef T1_TokenParser* T1_Tokenizer;
222
223
224 LOCAL_DEF
225 FT_Error New_Tokenizer( FT_Stream stream,
226 T1_Tokenizer* tokenizer );
227
228 LOCAL_DEF
229 FT_Error Done_Tokenizer( T1_Tokenizer tokenizer );
230
231 LOCAL_DEF
232 FT_Error Open_PrivateDict( T1_Tokenizer tokenizer );
233
234 LOCAL_DEF
235 FT_Error Read_Token( T1_Tokenizer tokenizer );
236
237
238 #if 0
239 LOCAL_DEF
240 FT_Error Read_CharStrings( T1_Tokenizer tokenizer,
241 FT_Int num_chars,
242 FT_Byte* buffer );
243 #endif /* 0 */
244
245 LOCAL_DEF
246 void t1_decrypt( FT_Byte* buffer,
247 FT_Int length,
248 FT_UShort seed );
249
250
251 #ifdef __cplusplus
252 }
253 #endif
254
255 #endif /* T1TOKENS_H */
256
257
258 /* END */