1 | /***************************************************************************/
|
---|
2 | /* */
|
---|
3 | /* psaux.h */
|
---|
4 | /* */
|
---|
5 | /* Auxiliary functions and data structures related to PostScript fonts */
|
---|
6 | /* (specification). */
|
---|
7 | /* */
|
---|
8 | /* Copyright 1996-2001, 2002, 2003, 2004 by */
|
---|
9 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
---|
10 | /* */
|
---|
11 | /* This file is part of the FreeType project, and may only be used, */
|
---|
12 | /* modified, and distributed under the terms of the FreeType project */
|
---|
13 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
|
---|
14 | /* this file you indicate that you have read the license and */
|
---|
15 | /* understand and accept it fully. */
|
---|
16 | /* */
|
---|
17 | /***************************************************************************/
|
---|
18 |
|
---|
19 |
|
---|
20 | #ifndef __PSAUX_H__
|
---|
21 | #define __PSAUX_H__
|
---|
22 |
|
---|
23 |
|
---|
24 | #include <ft2build.h>
|
---|
25 | #include FT_INTERNAL_OBJECTS_H
|
---|
26 | #include FT_INTERNAL_TYPE1_TYPES_H
|
---|
27 | #include FT_SERVICE_POSTSCRIPT_CMAPS_H
|
---|
28 |
|
---|
29 |
|
---|
30 | FT_BEGIN_HEADER
|
---|
31 |
|
---|
32 |
|
---|
33 | /*************************************************************************/
|
---|
34 | /*************************************************************************/
|
---|
35 | /***** *****/
|
---|
36 | /***** T1_TABLE *****/
|
---|
37 | /***** *****/
|
---|
38 | /*************************************************************************/
|
---|
39 | /*************************************************************************/
|
---|
40 |
|
---|
41 |
|
---|
42 | typedef struct PS_TableRec_* PS_Table;
|
---|
43 | typedef const struct PS_Table_FuncsRec_* PS_Table_Funcs;
|
---|
44 |
|
---|
45 |
|
---|
46 | /*************************************************************************/
|
---|
47 | /* */
|
---|
48 | /* <Struct> */
|
---|
49 | /* PS_Table_FuncsRec */
|
---|
50 | /* */
|
---|
51 | /* <Description> */
|
---|
52 | /* A set of function pointers to manage PS_Table objects. */
|
---|
53 | /* */
|
---|
54 | /* <Fields> */
|
---|
55 | /* table_init :: Used to initialize a table. */
|
---|
56 | /* */
|
---|
57 | /* table_done :: Finalizes resp. destroy a given table. */
|
---|
58 | /* */
|
---|
59 | /* table_add :: Adds a new object to a table. */
|
---|
60 | /* */
|
---|
61 | /* table_release :: Releases table data, then finalizes it. */
|
---|
62 | /* */
|
---|
63 | typedef struct PS_Table_FuncsRec_
|
---|
64 | {
|
---|
65 | FT_Error
|
---|
66 | (*init)( PS_Table table,
|
---|
67 | FT_Int count,
|
---|
68 | FT_Memory memory );
|
---|
69 |
|
---|
70 | void
|
---|
71 | (*done)( PS_Table table );
|
---|
72 |
|
---|
73 | FT_Error
|
---|
74 | (*add)( PS_Table table,
|
---|
75 | FT_Int idx,
|
---|
76 | void* object,
|
---|
77 | FT_PtrDist length );
|
---|
78 |
|
---|
79 | void
|
---|
80 | (*release)( PS_Table table );
|
---|
81 |
|
---|
82 | } PS_Table_FuncsRec;
|
---|
83 |
|
---|
84 |
|
---|
85 | /*************************************************************************/
|
---|
86 | /* */
|
---|
87 | /* <Struct> */
|
---|
88 | /* PS_TableRec */
|
---|
89 | /* */
|
---|
90 | /* <Description> */
|
---|
91 | /* A PS_Table is a simple object used to store an array of objects in */
|
---|
92 | /* a single memory block. */
|
---|
93 | /* */
|
---|
94 | /* <Fields> */
|
---|
95 | /* block :: The address in memory of the growheap's block. This */
|
---|
96 | /* can change between two object adds, due to */
|
---|
97 | /* reallocation. */
|
---|
98 | /* */
|
---|
99 | /* cursor :: The current top of the grow heap within its block. */
|
---|
100 | /* */
|
---|
101 | /* capacity :: The current size of the heap block. Increments by */
|
---|
102 | /* 1kByte chunks. */
|
---|
103 | /* */
|
---|
104 | /* max_elems :: The maximum number of elements in table. */
|
---|
105 | /* */
|
---|
106 | /* num_elems :: The current number of elements in table. */
|
---|
107 | /* */
|
---|
108 | /* elements :: A table of element addresses within the block. */
|
---|
109 | /* */
|
---|
110 | /* lengths :: A table of element sizes within the block. */
|
---|
111 | /* */
|
---|
112 | /* memory :: The object used for memory operations */
|
---|
113 | /* (alloc/realloc). */
|
---|
114 | /* */
|
---|
115 | /* funcs :: A table of method pointers for this object. */
|
---|
116 | /* */
|
---|
117 | typedef struct PS_TableRec_
|
---|
118 | {
|
---|
119 | FT_Byte* block; /* current memory block */
|
---|
120 | FT_Offset cursor; /* current cursor in memory block */
|
---|
121 | FT_Offset capacity; /* current size of memory block */
|
---|
122 | FT_Long init;
|
---|
123 |
|
---|
124 | FT_Int max_elems;
|
---|
125 | FT_Int num_elems;
|
---|
126 | FT_Byte** elements; /* addresses of table elements */
|
---|
127 | FT_PtrDist* lengths; /* lengths of table elements */
|
---|
128 |
|
---|
129 | FT_Memory memory;
|
---|
130 | PS_Table_FuncsRec funcs;
|
---|
131 |
|
---|
132 | } PS_TableRec;
|
---|
133 |
|
---|
134 |
|
---|
135 | /*************************************************************************/
|
---|
136 | /*************************************************************************/
|
---|
137 | /***** *****/
|
---|
138 | /***** T1 FIELDS & TOKENS *****/
|
---|
139 | /***** *****/
|
---|
140 | /*************************************************************************/
|
---|
141 | /*************************************************************************/
|
---|
142 |
|
---|
143 | typedef struct PS_ParserRec_* PS_Parser;
|
---|
144 |
|
---|
145 | typedef struct T1_TokenRec_* T1_Token;
|
---|
146 |
|
---|
147 | typedef struct T1_FieldRec_* T1_Field;
|
---|
148 |
|
---|
149 |
|
---|
150 | /* simple enumeration type used to identify token types */
|
---|
151 | typedef enum T1_TokenType_
|
---|
152 | {
|
---|
153 | T1_TOKEN_TYPE_NONE = 0,
|
---|
154 | T1_TOKEN_TYPE_ANY,
|
---|
155 | T1_TOKEN_TYPE_STRING,
|
---|
156 | T1_TOKEN_TYPE_ARRAY,
|
---|
157 |
|
---|
158 | /* do not remove */
|
---|
159 | T1_TOKEN_TYPE_MAX
|
---|
160 |
|
---|
161 | } T1_TokenType;
|
---|
162 |
|
---|
163 |
|
---|
164 | /* a simple structure used to identify tokens */
|
---|
165 | typedef struct T1_TokenRec_
|
---|
166 | {
|
---|
167 | FT_Byte* start; /* first character of token in input stream */
|
---|
168 | FT_Byte* limit; /* first character after the token */
|
---|
169 | T1_TokenType type; /* type of token */
|
---|
170 |
|
---|
171 | } T1_TokenRec;
|
---|
172 |
|
---|
173 |
|
---|
174 | /* enumeration type used to identify object fields */
|
---|
175 | typedef enum T1_FieldType_
|
---|
176 | {
|
---|
177 | T1_FIELD_TYPE_NONE = 0,
|
---|
178 | T1_FIELD_TYPE_BOOL,
|
---|
179 | T1_FIELD_TYPE_INTEGER,
|
---|
180 | T1_FIELD_TYPE_FIXED,
|
---|
181 | T1_FIELD_TYPE_FIXED_1000,
|
---|
182 | T1_FIELD_TYPE_STRING,
|
---|
183 | T1_FIELD_TYPE_KEY,
|
---|
184 | T1_FIELD_TYPE_BBOX,
|
---|
185 | T1_FIELD_TYPE_INTEGER_ARRAY,
|
---|
186 | T1_FIELD_TYPE_FIXED_ARRAY,
|
---|
187 | T1_FIELD_TYPE_CALLBACK,
|
---|
188 |
|
---|
189 | /* do not remove */
|
---|
190 | T1_FIELD_TYPE_MAX
|
---|
191 |
|
---|
192 | } T1_FieldType;
|
---|
193 |
|
---|
194 |
|
---|
195 | typedef enum T1_FieldLocation_
|
---|
196 | {
|
---|
197 | T1_FIELD_LOCATION_CID_INFO,
|
---|
198 | T1_FIELD_LOCATION_FONT_DICT,
|
---|
199 | T1_FIELD_LOCATION_FONT_INFO,
|
---|
200 | T1_FIELD_LOCATION_PRIVATE,
|
---|
201 | T1_FIELD_LOCATION_BBOX,
|
---|
202 |
|
---|
203 | /* do not remove */
|
---|
204 | T1_FIELD_LOCATION_MAX
|
---|
205 |
|
---|
206 | } T1_FieldLocation;
|
---|
207 |
|
---|
208 |
|
---|
209 | typedef void
|
---|
210 | (*T1_Field_ParseFunc)( FT_Face face,
|
---|
211 | FT_Pointer parser );
|
---|
212 |
|
---|
213 |
|
---|
214 | /* structure type used to model object fields */
|
---|
215 | typedef struct T1_FieldRec_
|
---|
216 | {
|
---|
217 | const char* ident; /* field identifier */
|
---|
218 | T1_FieldLocation location;
|
---|
219 | T1_FieldType type; /* type of field */
|
---|
220 | T1_Field_ParseFunc reader;
|
---|
221 | FT_UInt offset; /* offset of field in object */
|
---|
222 | FT_Byte size; /* size of field in bytes */
|
---|
223 | FT_UInt array_max; /* maximal number of elements for */
|
---|
224 | /* array */
|
---|
225 | FT_UInt count_offset; /* offset of element count for */
|
---|
226 | /* arrays */
|
---|
227 | } T1_FieldRec;
|
---|
228 |
|
---|
229 |
|
---|
230 | #define T1_NEW_SIMPLE_FIELD( _ident, _type, _fname ) \
|
---|
231 | { \
|
---|
232 | _ident, T1CODE, _type, \
|
---|
233 | 0, \
|
---|
234 | FT_FIELD_OFFSET( _fname ), \
|
---|
235 | FT_FIELD_SIZE( _fname ), \
|
---|
236 | 0, 0 \
|
---|
237 | },
|
---|
238 |
|
---|
239 | #define T1_NEW_CALLBACK_FIELD( _ident, _reader ) \
|
---|
240 | { \
|
---|
241 | _ident, T1CODE, T1_FIELD_TYPE_CALLBACK, \
|
---|
242 | (T1_Field_ParseFunc)_reader, \
|
---|
243 | 0, 0, \
|
---|
244 | 0, 0 \
|
---|
245 | },
|
---|
246 |
|
---|
247 | #define T1_NEW_TABLE_FIELD( _ident, _type, _fname, _max ) \
|
---|
248 | { \
|
---|
249 | _ident, T1CODE, _type, \
|
---|
250 | 0, \
|
---|
251 | FT_FIELD_OFFSET( _fname ), \
|
---|
252 | FT_FIELD_SIZE_DELTA( _fname ), \
|
---|
253 | _max, \
|
---|
254 | FT_FIELD_OFFSET( num_ ## _fname ) \
|
---|
255 | },
|
---|
256 |
|
---|
257 | #define T1_NEW_TABLE_FIELD2( _ident, _type, _fname, _max ) \
|
---|
258 | { \
|
---|
259 | _ident, T1CODE, _type, \
|
---|
260 | 0, \
|
---|
261 | FT_FIELD_OFFSET( _fname ), \
|
---|
262 | FT_FIELD_SIZE_DELTA( _fname ), \
|
---|
263 | _max, 0 \
|
---|
264 | },
|
---|
265 |
|
---|
266 |
|
---|
267 | #define T1_FIELD_BOOL( _ident, _fname ) \
|
---|
268 | T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_BOOL, _fname )
|
---|
269 |
|
---|
270 | #define T1_FIELD_NUM( _ident, _fname ) \
|
---|
271 | T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_INTEGER, _fname )
|
---|
272 |
|
---|
273 | #define T1_FIELD_FIXED( _ident, _fname ) \
|
---|
274 | T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_FIXED, _fname )
|
---|
275 |
|
---|
276 | #define T1_FIELD_FIXED_1000( _ident, _fname ) \
|
---|
277 | T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_FIXED_1000, _fname )
|
---|
278 |
|
---|
279 | #define T1_FIELD_STRING( _ident, _fname ) \
|
---|
280 | T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_STRING, _fname )
|
---|
281 |
|
---|
282 | #define T1_FIELD_KEY( _ident, _fname ) \
|
---|
283 | T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_KEY, _fname )
|
---|
284 |
|
---|
285 | #define T1_FIELD_BBOX( _ident, _fname ) \
|
---|
286 | T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_BBOX, _fname )
|
---|
287 |
|
---|
288 |
|
---|
289 | #define T1_FIELD_NUM_TABLE( _ident, _fname, _fmax ) \
|
---|
290 | T1_NEW_TABLE_FIELD( _ident, T1_FIELD_TYPE_INTEGER_ARRAY, \
|
---|
291 | _fname, _fmax )
|
---|
292 |
|
---|
293 | #define T1_FIELD_FIXED_TABLE( _ident, _fname, _fmax ) \
|
---|
294 | T1_NEW_TABLE_FIELD( _ident, T1_FIELD_TYPE_FIXED_ARRAY, \
|
---|
295 | _fname, _fmax )
|
---|
296 |
|
---|
297 | #define T1_FIELD_NUM_TABLE2( _ident, _fname, _fmax ) \
|
---|
298 | T1_NEW_TABLE_FIELD2( _ident, T1_FIELD_TYPE_INTEGER_ARRAY, \
|
---|
299 | _fname, _fmax )
|
---|
300 |
|
---|
301 | #define T1_FIELD_FIXED_TABLE2( _ident, _fname, _fmax ) \
|
---|
302 | T1_NEW_TABLE_FIELD2( _ident, T1_FIELD_TYPE_FIXED_ARRAY, \
|
---|
303 | _fname, _fmax )
|
---|
304 |
|
---|
305 | #define T1_FIELD_CALLBACK( _ident, _name ) \
|
---|
306 | T1_NEW_CALLBACK_FIELD( _ident, _name )
|
---|
307 |
|
---|
308 |
|
---|
309 | /*************************************************************************/
|
---|
310 | /*************************************************************************/
|
---|
311 | /***** *****/
|
---|
312 | /***** T1 PARSER *****/
|
---|
313 | /***** *****/
|
---|
314 | /*************************************************************************/
|
---|
315 | /*************************************************************************/
|
---|
316 |
|
---|
317 | typedef const struct PS_Parser_FuncsRec_* PS_Parser_Funcs;
|
---|
318 |
|
---|
319 | typedef struct PS_Parser_FuncsRec_
|
---|
320 | {
|
---|
321 | void
|
---|
322 | (*init)( PS_Parser parser,
|
---|
323 | FT_Byte* base,
|
---|
324 | FT_Byte* limit,
|
---|
325 | FT_Memory memory );
|
---|
326 |
|
---|
327 | void
|
---|
328 | (*done)( PS_Parser parser );
|
---|
329 |
|
---|
330 | void
|
---|
331 | (*skip_spaces)( PS_Parser parser );
|
---|
332 | void
|
---|
333 | (*skip_PS_token)( PS_Parser parser );
|
---|
334 |
|
---|
335 | FT_Long
|
---|
336 | (*to_int)( PS_Parser parser );
|
---|
337 | FT_Fixed
|
---|
338 | (*to_fixed)( PS_Parser parser,
|
---|
339 | FT_Int power_ten );
|
---|
340 |
|
---|
341 | FT_Error
|
---|
342 | (*to_bytes)( PS_Parser parser,
|
---|
343 | FT_Byte* bytes,
|
---|
344 | FT_Long max_bytes,
|
---|
345 | FT_Long* pnum_bytes,
|
---|
346 | FT_Bool delimiters );
|
---|
347 |
|
---|
348 | FT_Int
|
---|
349 | (*to_coord_array)( PS_Parser parser,
|
---|
350 | FT_Int max_coords,
|
---|
351 | FT_Short* coords );
|
---|
352 | FT_Int
|
---|
353 | (*to_fixed_array)( PS_Parser parser,
|
---|
354 | FT_Int max_values,
|
---|
355 | FT_Fixed* values,
|
---|
356 | FT_Int power_ten );
|
---|
357 |
|
---|
358 | void
|
---|
359 | (*to_token)( PS_Parser parser,
|
---|
360 | T1_Token token );
|
---|
361 | void
|
---|
362 | (*to_token_array)( PS_Parser parser,
|
---|
363 | T1_Token tokens,
|
---|
364 | FT_UInt max_tokens,
|
---|
365 | FT_Int* pnum_tokens );
|
---|
366 |
|
---|
367 | FT_Error
|
---|
368 | (*load_field)( PS_Parser parser,
|
---|
369 | const T1_Field field,
|
---|
370 | void** objects,
|
---|
371 | FT_UInt max_objects,
|
---|
372 | FT_ULong* pflags );
|
---|
373 |
|
---|
374 | FT_Error
|
---|
375 | (*load_field_table)( PS_Parser parser,
|
---|
376 | const T1_Field field,
|
---|
377 | void** objects,
|
---|
378 | FT_UInt max_objects,
|
---|
379 | FT_ULong* pflags );
|
---|
380 |
|
---|
381 | } PS_Parser_FuncsRec;
|
---|
382 |
|
---|
383 |
|
---|
384 | /*************************************************************************/
|
---|
385 | /* */
|
---|
386 | /* <Struct> */
|
---|
387 | /* PS_ParserRec */
|
---|
388 | /* */
|
---|
389 | /* <Description> */
|
---|
390 | /* A PS_Parser is an object used to parse a Type 1 font very quickly. */
|
---|
391 | /* */
|
---|
392 | /* <Fields> */
|
---|
393 | /* cursor :: The current position in the text. */
|
---|
394 | /* */
|
---|
395 | /* base :: Start of the processed text. */
|
---|
396 | /* */
|
---|
397 | /* limit :: End of the processed text. */
|
---|
398 | /* */
|
---|
399 | /* error :: The last error returned. */
|
---|
400 | /* */
|
---|
401 | /* memory :: The object used for memory operations (alloc/realloc). */
|
---|
402 | /* */
|
---|
403 | /* funcs :: A table of functions for the parser. */
|
---|
404 | /* */
|
---|
405 | typedef struct PS_ParserRec_
|
---|
406 | {
|
---|
407 | FT_Byte* cursor;
|
---|
408 | FT_Byte* base;
|
---|
409 | FT_Byte* limit;
|
---|
410 | FT_Error error;
|
---|
411 | FT_Memory memory;
|
---|
412 |
|
---|
413 | PS_Parser_FuncsRec funcs;
|
---|
414 |
|
---|
415 | } PS_ParserRec;
|
---|
416 |
|
---|
417 |
|
---|
418 | /*************************************************************************/
|
---|
419 | /*************************************************************************/
|
---|
420 | /***** *****/
|
---|
421 | /***** T1 BUILDER *****/
|
---|
422 | /***** *****/
|
---|
423 | /*************************************************************************/
|
---|
424 | /*************************************************************************/
|
---|
425 |
|
---|
426 |
|
---|
427 | typedef struct T1_BuilderRec_* T1_Builder;
|
---|
428 |
|
---|
429 |
|
---|
430 | typedef FT_Error
|
---|
431 | (*T1_Builder_Check_Points_Func)( T1_Builder builder,
|
---|
432 | FT_Int count );
|
---|
433 |
|
---|
434 | typedef void
|
---|
435 | (*T1_Builder_Add_Point_Func)( T1_Builder builder,
|
---|
436 | FT_Pos x,
|
---|
437 | FT_Pos y,
|
---|
438 | FT_Byte flag );
|
---|
439 |
|
---|
440 | typedef FT_Error
|
---|
441 | (*T1_Builder_Add_Point1_Func)( T1_Builder builder,
|
---|
442 | FT_Pos x,
|
---|
443 | FT_Pos y );
|
---|
444 |
|
---|
445 | typedef FT_Error
|
---|
446 | (*T1_Builder_Add_Contour_Func)( T1_Builder builder );
|
---|
447 |
|
---|
448 | typedef FT_Error
|
---|
449 | (*T1_Builder_Start_Point_Func)( T1_Builder builder,
|
---|
450 | FT_Pos x,
|
---|
451 | FT_Pos y );
|
---|
452 |
|
---|
453 | typedef void
|
---|
454 | (*T1_Builder_Close_Contour_Func)( T1_Builder builder );
|
---|
455 |
|
---|
456 |
|
---|
457 | typedef const struct T1_Builder_FuncsRec_* T1_Builder_Funcs;
|
---|
458 |
|
---|
459 | typedef struct T1_Builder_FuncsRec_
|
---|
460 | {
|
---|
461 | void
|
---|
462 | (*init)( T1_Builder builder,
|
---|
463 | FT_Face face,
|
---|
464 | FT_Size size,
|
---|
465 | FT_GlyphSlot slot,
|
---|
466 | FT_Bool hinting );
|
---|
467 |
|
---|
468 | void
|
---|
469 | (*done)( T1_Builder builder );
|
---|
470 |
|
---|
471 | T1_Builder_Check_Points_Func check_points;
|
---|
472 | T1_Builder_Add_Point_Func add_point;
|
---|
473 | T1_Builder_Add_Point1_Func add_point1;
|
---|
474 | T1_Builder_Add_Contour_Func add_contour;
|
---|
475 | T1_Builder_Start_Point_Func start_point;
|
---|
476 | T1_Builder_Close_Contour_Func close_contour;
|
---|
477 |
|
---|
478 | } T1_Builder_FuncsRec;
|
---|
479 |
|
---|
480 |
|
---|
481 | /* an enumeration type to handle charstring parsing states */
|
---|
482 | typedef enum T1_ParseState_
|
---|
483 | {
|
---|
484 | T1_Parse_Start,
|
---|
485 | T1_Parse_Have_Width,
|
---|
486 | T1_Parse_Have_Moveto,
|
---|
487 | T1_Parse_Have_Path
|
---|
488 |
|
---|
489 | } T1_ParseState;
|
---|
490 |
|
---|
491 |
|
---|
492 | /*************************************************************************/
|
---|
493 | /* */
|
---|
494 | /* <Structure> */
|
---|
495 | /* T1_BuilderRec */
|
---|
496 | /* */
|
---|
497 | /* <Description> */
|
---|
498 | /* A structure used during glyph loading to store its outline. */
|
---|
499 | /* */
|
---|
500 | /* <Fields> */
|
---|
501 | /* memory :: The current memory object. */
|
---|
502 | /* */
|
---|
503 | /* face :: The current face object. */
|
---|
504 | /* */
|
---|
505 | /* glyph :: The current glyph slot. */
|
---|
506 | /* */
|
---|
507 | /* loader :: XXX */
|
---|
508 | /* */
|
---|
509 | /* base :: The base glyph outline. */
|
---|
510 | /* */
|
---|
511 | /* current :: The current glyph outline. */
|
---|
512 | /* */
|
---|
513 | /* max_points :: maximum points in builder outline */
|
---|
514 | /* */
|
---|
515 | /* max_contours :: Maximal number of contours in builder outline. */
|
---|
516 | /* */
|
---|
517 | /* last :: The last point position. */
|
---|
518 | /* */
|
---|
519 | /* scale_x :: The horizontal scale (FUnits to sub-pixels). */
|
---|
520 | /* */
|
---|
521 | /* scale_y :: The vertical scale (FUnits to sub-pixels). */
|
---|
522 | /* */
|
---|
523 | /* pos_x :: The horizontal translation (if composite glyph). */
|
---|
524 | /* */
|
---|
525 | /* pos_y :: The vertical translation (if composite glyph). */
|
---|
526 | /* */
|
---|
527 | /* left_bearing :: The left side bearing point. */
|
---|
528 | /* */
|
---|
529 | /* advance :: The horizontal advance vector. */
|
---|
530 | /* */
|
---|
531 | /* bbox :: Unused. */
|
---|
532 | /* */
|
---|
533 | /* parse_state :: An enumeration which controls the charstring */
|
---|
534 | /* parsing state. */
|
---|
535 | /* */
|
---|
536 | /* load_points :: If this flag is not set, no points are loaded. */
|
---|
537 | /* */
|
---|
538 | /* no_recurse :: Set but not used. */
|
---|
539 | /* */
|
---|
540 | /* metrics_only :: A boolean indicating that we only want to compute */
|
---|
541 | /* the metrics of a given glyph, not load all of its */
|
---|
542 | /* points. */
|
---|
543 | /* */
|
---|
544 | /* funcs :: An array of function pointers for the builder. */
|
---|
545 | /* */
|
---|
546 | typedef struct T1_BuilderRec_
|
---|
547 | {
|
---|
548 | FT_Memory memory;
|
---|
549 | FT_Face face;
|
---|
550 | FT_GlyphSlot glyph;
|
---|
551 | FT_GlyphLoader loader;
|
---|
552 | FT_Outline* base;
|
---|
553 | FT_Outline* current;
|
---|
554 |
|
---|
555 | FT_Vector last;
|
---|
556 |
|
---|
557 | FT_Fixed scale_x;
|
---|
558 | FT_Fixed scale_y;
|
---|
559 |
|
---|
560 | FT_Pos pos_x;
|
---|
561 | FT_Pos pos_y;
|
---|
562 |
|
---|
563 | FT_Vector left_bearing;
|
---|
564 | FT_Vector advance;
|
---|
565 |
|
---|
566 | FT_BBox bbox; /* bounding box */
|
---|
567 | T1_ParseState parse_state;
|
---|
568 | FT_Bool load_points;
|
---|
569 | FT_Bool no_recurse;
|
---|
570 | FT_Bool shift;
|
---|
571 |
|
---|
572 | FT_Bool metrics_only;
|
---|
573 |
|
---|
574 | void* hints_funcs; /* hinter-specific */
|
---|
575 | void* hints_globals; /* hinter-specific */
|
---|
576 |
|
---|
577 | T1_Builder_FuncsRec funcs;
|
---|
578 |
|
---|
579 | } T1_BuilderRec;
|
---|
580 |
|
---|
581 |
|
---|
582 | /*************************************************************************/
|
---|
583 | /*************************************************************************/
|
---|
584 | /***** *****/
|
---|
585 | /***** T1 DECODER *****/
|
---|
586 | /***** *****/
|
---|
587 | /*************************************************************************/
|
---|
588 | /*************************************************************************/
|
---|
589 |
|
---|
590 | #if 0
|
---|
591 |
|
---|
592 | /*************************************************************************/
|
---|
593 | /* */
|
---|
594 | /* T1_MAX_SUBRS_CALLS details the maximum number of nested sub-routine */
|
---|
595 | /* calls during glyph loading. */
|
---|
596 | /* */
|
---|
597 | #define T1_MAX_SUBRS_CALLS 8
|
---|
598 |
|
---|
599 |
|
---|
600 | /*************************************************************************/
|
---|
601 | /* */
|
---|
602 | /* T1_MAX_CHARSTRING_OPERANDS is the charstring stack's capacity. A */
|
---|
603 | /* minimum of 16 is required. */
|
---|
604 | /* */
|
---|
605 | #define T1_MAX_CHARSTRINGS_OPERANDS 32
|
---|
606 |
|
---|
607 | #endif /* 0 */
|
---|
608 |
|
---|
609 |
|
---|
610 | typedef struct T1_Decoder_ZoneRec_
|
---|
611 | {
|
---|
612 | FT_Byte* cursor;
|
---|
613 | FT_Byte* base;
|
---|
614 | FT_Byte* limit;
|
---|
615 |
|
---|
616 | } T1_Decoder_ZoneRec, *T1_Decoder_Zone;
|
---|
617 |
|
---|
618 |
|
---|
619 | typedef struct T1_DecoderRec_* T1_Decoder;
|
---|
620 | typedef const struct T1_Decoder_FuncsRec_* T1_Decoder_Funcs;
|
---|
621 |
|
---|
622 |
|
---|
623 | typedef FT_Error
|
---|
624 | (*T1_Decoder_Callback)( T1_Decoder decoder,
|
---|
625 | FT_UInt glyph_index );
|
---|
626 |
|
---|
627 |
|
---|
628 | typedef struct T1_Decoder_FuncsRec_
|
---|
629 | {
|
---|
630 | FT_Error
|
---|
631 | (*init)( T1_Decoder decoder,
|
---|
632 | FT_Face face,
|
---|
633 | FT_Size size,
|
---|
634 | FT_GlyphSlot slot,
|
---|
635 | FT_Byte** glyph_names,
|
---|
636 | PS_Blend blend,
|
---|
637 | FT_Bool hinting,
|
---|
638 | FT_Render_Mode hint_mode,
|
---|
639 | T1_Decoder_Callback callback );
|
---|
640 |
|
---|
641 | void
|
---|
642 | (*done)( T1_Decoder decoder );
|
---|
643 |
|
---|
644 | FT_Error
|
---|
645 | (*parse_charstrings)( T1_Decoder decoder,
|
---|
646 | FT_Byte* base,
|
---|
647 | FT_UInt len );
|
---|
648 |
|
---|
649 | } T1_Decoder_FuncsRec;
|
---|
650 |
|
---|
651 |
|
---|
652 | typedef struct T1_DecoderRec_
|
---|
653 | {
|
---|
654 | T1_BuilderRec builder;
|
---|
655 |
|
---|
656 | FT_Long stack[T1_MAX_CHARSTRINGS_OPERANDS];
|
---|
657 | FT_Long* top;
|
---|
658 |
|
---|
659 | T1_Decoder_ZoneRec zones[T1_MAX_SUBRS_CALLS + 1];
|
---|
660 | T1_Decoder_Zone zone;
|
---|
661 |
|
---|
662 | FT_Service_PsCMaps psnames; /* for seac */
|
---|
663 | FT_UInt num_glyphs;
|
---|
664 | FT_Byte** glyph_names;
|
---|
665 |
|
---|
666 | FT_Int lenIV; /* internal for sub routine calls */
|
---|
667 | FT_UInt num_subrs;
|
---|
668 | FT_Byte** subrs;
|
---|
669 | FT_PtrDist* subrs_len; /* array of subrs length (optional) */
|
---|
670 |
|
---|
671 | FT_Matrix font_matrix;
|
---|
672 | FT_Vector font_offset;
|
---|
673 |
|
---|
674 | FT_Int flex_state;
|
---|
675 | FT_Int num_flex_vectors;
|
---|
676 | FT_Vector flex_vectors[7];
|
---|
677 |
|
---|
678 | PS_Blend blend; /* for multiple master support */
|
---|
679 |
|
---|
680 | FT_Render_Mode hint_mode;
|
---|
681 |
|
---|
682 | T1_Decoder_Callback parse_callback;
|
---|
683 | T1_Decoder_FuncsRec funcs;
|
---|
684 |
|
---|
685 | } T1_DecoderRec;
|
---|
686 |
|
---|
687 |
|
---|
688 | /*************************************************************************/
|
---|
689 | /*************************************************************************/
|
---|
690 | /***** *****/
|
---|
691 | /***** TYPE1 CHARMAPS *****/
|
---|
692 | /***** *****/
|
---|
693 | /*************************************************************************/
|
---|
694 | /*************************************************************************/
|
---|
695 |
|
---|
696 | typedef const struct T1_CMap_ClassesRec_* T1_CMap_Classes;
|
---|
697 |
|
---|
698 | typedef struct T1_CMap_ClassesRec_
|
---|
699 | {
|
---|
700 | FT_CMap_Class standard;
|
---|
701 | FT_CMap_Class expert;
|
---|
702 | FT_CMap_Class custom;
|
---|
703 | FT_CMap_Class unicode;
|
---|
704 |
|
---|
705 | } T1_CMap_ClassesRec;
|
---|
706 |
|
---|
707 |
|
---|
708 | /*************************************************************************/
|
---|
709 | /*************************************************************************/
|
---|
710 | /***** *****/
|
---|
711 | /***** PSAux Module Interface *****/
|
---|
712 | /***** *****/
|
---|
713 | /*************************************************************************/
|
---|
714 | /*************************************************************************/
|
---|
715 |
|
---|
716 | typedef struct PSAux_ServiceRec_
|
---|
717 | {
|
---|
718 | /* don't use `PS_Table_Funcs' and friends to avoid compiler warnings */
|
---|
719 | const PS_Table_FuncsRec* ps_table_funcs;
|
---|
720 | const PS_Parser_FuncsRec* ps_parser_funcs;
|
---|
721 | const T1_Builder_FuncsRec* t1_builder_funcs;
|
---|
722 | const T1_Decoder_FuncsRec* t1_decoder_funcs;
|
---|
723 |
|
---|
724 | void
|
---|
725 | (*t1_decrypt)( FT_Byte* buffer,
|
---|
726 | FT_Offset length,
|
---|
727 | FT_UShort seed );
|
---|
728 |
|
---|
729 | T1_CMap_Classes t1_cmap_classes;
|
---|
730 |
|
---|
731 | } PSAux_ServiceRec, *PSAux_Service;
|
---|
732 |
|
---|
733 | /* backwards-compatible type definition */
|
---|
734 | typedef PSAux_ServiceRec PSAux_Interface;
|
---|
735 |
|
---|
736 | FT_END_HEADER
|
---|
737 |
|
---|
738 | #endif /* __PSAUX_H__ */
|
---|
739 |
|
---|
740 |
|
---|
741 | /* END */
|
---|