1 /***************************************************************************/
5 /* Type 1 tokenizer (specification). */
7 /* Copyright 1996-2000 by */
8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
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. */
16 /***************************************************************************/
23 #ifdef FT_FLAT_COMPILE
29 #include <freetype/src/type1/t1objs.h>
39 /* enum value of first keyword */
40 #define key_first_ 100
42 /* enum value of first immediate name */
43 #define imm_first_ 200
46 typedef enum T1_TokenType_
50 tok_eof, /* end of file */
52 /* simple token types */
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 */
63 /* Postscript keywords -- placed in lexicographical order */
65 key_RD_alternate = key_first_, /* `-|' = alternate form of RD */
90 key_NP_alternate, /* `|' = alternate form of NP */
91 key_ND_alternate, /* `|-' = alternate form of ND */
93 key_max, /* always keep this value there */
95 /* Postscript immediate names -- other names will be ignored, except */
98 imm_RD_alternate = imm_first_, /* `-|' = alternate form of RD */
99 imm_notdef, /* `/.notdef' immediate */
109 imm_FamilyOtherBlues,
138 imm_UnderlinePosition,
139 imm_UnderlineThickness,
148 imm_NP_alternate, /* `|' = alternate form of NP */
149 imm_ND_alternate, /* `|-' = alternate form of ND */
151 imm_max /* always keep this value here */
156 /* these arrays are visible for debugging purposes */
157 extern const char* t1_keywords[];
158 extern const char* t1_immediates[];
161 /*************************************************************************/
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. */
172 /* kind :: The token type. Describes the token to the loader. */
174 /* kind2 :: Detailed token type. */
176 /* start :: The index of the first character of token in the input */
179 /* len :: The length of the token in characters. */
181 typedef struct T1_Token_
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 */
191 typedef struct T1_TokenParser_
196 FT_Bool in_pfb; /* true if PFB file, PFA otherwise */
197 FT_Bool in_private; /* true if in private dictionary */
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 */
204 FT_Error error; /* last error */
205 T1_Token token; /* last token read */
210 /*************************************************************************/
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 */
221 typedef T1_TokenParser* T1_Tokenizer;
225 FT_Error New_Tokenizer( FT_Stream stream,
226 T1_Tokenizer* tokenizer );
229 FT_Error Done_Tokenizer( T1_Tokenizer tokenizer );
232 FT_Error Open_PrivateDict( T1_Tokenizer tokenizer );
235 FT_Error Read_Token( T1_Tokenizer tokenizer );
240 FT_Error Read_CharStrings( T1_Tokenizer tokenizer,
246 void t1_decrypt( FT_Byte* buffer,
255 #endif /* T1TOKENS_H */