|
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, 2006 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, FTL.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 scaling value (FUnits to */ |
|
520 /* sub-pixels). */ |
|
521 /* */ |
|
522 /* scale_y :: The vertical scaling value (FUnits to sub-pixels). */ |
|
523 /* */ |
|
524 /* pos_x :: The horizontal translation (if composite glyph). */ |
|
525 /* */ |
|
526 /* pos_y :: The vertical translation (if composite glyph). */ |
|
527 /* */ |
|
528 /* left_bearing :: The left side bearing point. */ |
|
529 /* */ |
|
530 /* advance :: The horizontal advance vector. */ |
|
531 /* */ |
|
532 /* bbox :: Unused. */ |
|
533 /* */ |
|
534 /* parse_state :: An enumeration which controls the charstring */ |
|
535 /* parsing state. */ |
|
536 /* */ |
|
537 /* load_points :: If this flag is not set, no points are loaded. */ |
|
538 /* */ |
|
539 /* no_recurse :: Set but not used. */ |
|
540 /* */ |
|
541 /* metrics_only :: A boolean indicating that we only want to compute */ |
|
542 /* the metrics of a given glyph, not load all of its */ |
|
543 /* points. */ |
|
544 /* */ |
|
545 /* funcs :: An array of function pointers for the builder. */ |
|
546 /* */ |
|
547 typedef struct T1_BuilderRec_ |
|
548 { |
|
549 FT_Memory memory; |
|
550 FT_Face face; |
|
551 FT_GlyphSlot glyph; |
|
552 FT_GlyphLoader loader; |
|
553 FT_Outline* base; |
|
554 FT_Outline* current; |
|
555 |
|
556 FT_Vector last; |
|
557 |
|
558 FT_Fixed scale_x; |
|
559 FT_Fixed scale_y; |
|
560 |
|
561 FT_Pos pos_x; |
|
562 FT_Pos pos_y; |
|
563 |
|
564 FT_Vector left_bearing; |
|
565 FT_Vector advance; |
|
566 |
|
567 FT_BBox bbox; /* bounding box */ |
|
568 T1_ParseState parse_state; |
|
569 FT_Bool load_points; |
|
570 FT_Bool no_recurse; |
|
571 FT_Bool shift; |
|
572 |
|
573 FT_Bool metrics_only; |
|
574 |
|
575 void* hints_funcs; /* hinter-specific */ |
|
576 void* hints_globals; /* hinter-specific */ |
|
577 |
|
578 T1_Builder_FuncsRec funcs; |
|
579 |
|
580 } T1_BuilderRec; |
|
581 |
|
582 |
|
583 /*************************************************************************/ |
|
584 /*************************************************************************/ |
|
585 /***** *****/ |
|
586 /***** T1 DECODER *****/ |
|
587 /***** *****/ |
|
588 /*************************************************************************/ |
|
589 /*************************************************************************/ |
|
590 |
|
591 #if 0 |
|
592 |
|
593 /*************************************************************************/ |
|
594 /* */ |
|
595 /* T1_MAX_SUBRS_CALLS details the maximum number of nested sub-routine */ |
|
596 /* calls during glyph loading. */ |
|
597 /* */ |
|
598 #define T1_MAX_SUBRS_CALLS 8 |
|
599 |
|
600 |
|
601 /*************************************************************************/ |
|
602 /* */ |
|
603 /* T1_MAX_CHARSTRING_OPERANDS is the charstring stack's capacity. A */ |
|
604 /* minimum of 16 is required. */ |
|
605 /* */ |
|
606 #define T1_MAX_CHARSTRINGS_OPERANDS 32 |
|
607 |
|
608 #endif /* 0 */ |
|
609 |
|
610 |
|
611 typedef struct T1_Decoder_ZoneRec_ |
|
612 { |
|
613 FT_Byte* cursor; |
|
614 FT_Byte* base; |
|
615 FT_Byte* limit; |
|
616 |
|
617 } T1_Decoder_ZoneRec, *T1_Decoder_Zone; |
|
618 |
|
619 |
|
620 typedef struct T1_DecoderRec_* T1_Decoder; |
|
621 typedef const struct T1_Decoder_FuncsRec_* T1_Decoder_Funcs; |
|
622 |
|
623 |
|
624 typedef FT_Error |
|
625 (*T1_Decoder_Callback)( T1_Decoder decoder, |
|
626 FT_UInt glyph_index ); |
|
627 |
|
628 |
|
629 typedef struct T1_Decoder_FuncsRec_ |
|
630 { |
|
631 FT_Error |
|
632 (*init)( T1_Decoder decoder, |
|
633 FT_Face face, |
|
634 FT_Size size, |
|
635 FT_GlyphSlot slot, |
|
636 FT_Byte** glyph_names, |
|
637 PS_Blend blend, |
|
638 FT_Bool hinting, |
|
639 FT_Render_Mode hint_mode, |
|
640 T1_Decoder_Callback callback ); |
|
641 |
|
642 void |
|
643 (*done)( T1_Decoder decoder ); |
|
644 |
|
645 FT_Error |
|
646 (*parse_charstrings)( T1_Decoder decoder, |
|
647 FT_Byte* base, |
|
648 FT_UInt len ); |
|
649 |
|
650 } T1_Decoder_FuncsRec; |
|
651 |
|
652 |
|
653 typedef struct T1_DecoderRec_ |
|
654 { |
|
655 T1_BuilderRec builder; |
|
656 |
|
657 FT_Long stack[T1_MAX_CHARSTRINGS_OPERANDS]; |
|
658 FT_Long* top; |
|
659 |
|
660 T1_Decoder_ZoneRec zones[T1_MAX_SUBRS_CALLS + 1]; |
|
661 T1_Decoder_Zone zone; |
|
662 |
|
663 FT_Service_PsCMaps psnames; /* for seac */ |
|
664 FT_UInt num_glyphs; |
|
665 FT_Byte** glyph_names; |
|
666 |
|
667 FT_Int lenIV; /* internal for sub routine calls */ |
|
668 FT_UInt num_subrs; |
|
669 FT_Byte** subrs; |
|
670 FT_PtrDist* subrs_len; /* array of subrs length (optional) */ |
|
671 |
|
672 FT_Matrix font_matrix; |
|
673 FT_Vector font_offset; |
|
674 |
|
675 FT_Int flex_state; |
|
676 FT_Int num_flex_vectors; |
|
677 FT_Vector flex_vectors[7]; |
|
678 |
|
679 PS_Blend blend; /* for multiple master support */ |
|
680 |
|
681 FT_Render_Mode hint_mode; |
|
682 |
|
683 T1_Decoder_Callback parse_callback; |
|
684 T1_Decoder_FuncsRec funcs; |
|
685 |
|
686 } T1_DecoderRec; |
|
687 |
|
688 |
|
689 /*************************************************************************/ |
|
690 /*************************************************************************/ |
|
691 /***** *****/ |
|
692 /***** AFM PARSER *****/ |
|
693 /***** *****/ |
|
694 /*************************************************************************/ |
|
695 /*************************************************************************/ |
|
696 |
|
697 typedef struct AFM_ParserRec_* AFM_Parser; |
|
698 |
|
699 typedef struct AFM_Parser_FuncsRec_ |
|
700 { |
|
701 FT_Error |
|
702 (*init)( AFM_Parser parser, |
|
703 FT_Memory memory, |
|
704 FT_Byte* base, |
|
705 FT_Byte* limit ); |
|
706 |
|
707 void |
|
708 (*done)( AFM_Parser parser ); |
|
709 |
|
710 FT_Error |
|
711 (*parse)( AFM_Parser parser ); |
|
712 |
|
713 } AFM_Parser_FuncsRec; |
|
714 |
|
715 typedef struct AFM_StreamRec_* AFM_Stream; |
|
716 |
|
717 /*************************************************************************/ |
|
718 /* */ |
|
719 /* <Struct> */ |
|
720 /* AFM_ParserRec */ |
|
721 /* */ |
|
722 /* <Description> */ |
|
723 /* An AFM_Parser is a parser for the AFM files. */ |
|
724 /* */ |
|
725 /* <Fields> */ |
|
726 /* memory :: The object used for memory operations (alloc and */ |
|
727 /* realloc). */ |
|
728 /* */ |
|
729 /* stream :: This is an opaque object. */ |
|
730 /* */ |
|
731 /* FontInfo :: The result will be stored here. */ |
|
732 /* */ |
|
733 /* get_index :: A user provided function to get a glyph index by its */ |
|
734 /* name. */ |
|
735 /* */ |
|
736 typedef struct AFM_ParserRec_ |
|
737 { |
|
738 FT_Memory memory; |
|
739 AFM_Stream stream; |
|
740 |
|
741 AFM_FontInfo FontInfo; |
|
742 |
|
743 FT_Int |
|
744 (*get_index)( const char* name, |
|
745 FT_UInt len, |
|
746 void* user_data ); |
|
747 |
|
748 void* user_data; |
|
749 |
|
750 } AFM_ParserRec; |
|
751 |
|
752 |
|
753 /*************************************************************************/ |
|
754 /*************************************************************************/ |
|
755 /***** *****/ |
|
756 /***** TYPE1 CHARMAPS *****/ |
|
757 /***** *****/ |
|
758 /*************************************************************************/ |
|
759 /*************************************************************************/ |
|
760 |
|
761 typedef const struct T1_CMap_ClassesRec_* T1_CMap_Classes; |
|
762 |
|
763 typedef struct T1_CMap_ClassesRec_ |
|
764 { |
|
765 FT_CMap_Class standard; |
|
766 FT_CMap_Class expert; |
|
767 FT_CMap_Class custom; |
|
768 FT_CMap_Class unicode; |
|
769 |
|
770 } T1_CMap_ClassesRec; |
|
771 |
|
772 |
|
773 /*************************************************************************/ |
|
774 /*************************************************************************/ |
|
775 /***** *****/ |
|
776 /***** PSAux Module Interface *****/ |
|
777 /***** *****/ |
|
778 /*************************************************************************/ |
|
779 /*************************************************************************/ |
|
780 |
|
781 typedef struct PSAux_ServiceRec_ |
|
782 { |
|
783 /* don't use `PS_Table_Funcs' and friends to avoid compiler warnings */ |
|
784 const PS_Table_FuncsRec* ps_table_funcs; |
|
785 const PS_Parser_FuncsRec* ps_parser_funcs; |
|
786 const T1_Builder_FuncsRec* t1_builder_funcs; |
|
787 const T1_Decoder_FuncsRec* t1_decoder_funcs; |
|
788 |
|
789 void |
|
790 (*t1_decrypt)( FT_Byte* buffer, |
|
791 FT_Offset length, |
|
792 FT_UShort seed ); |
|
793 |
|
794 T1_CMap_Classes t1_cmap_classes; |
|
795 |
|
796 /* fields after this comment line were added after version 2.1.10 */ |
|
797 const AFM_Parser_FuncsRec* afm_parser_funcs; |
|
798 |
|
799 } PSAux_ServiceRec, *PSAux_Service; |
|
800 |
|
801 /* backwards-compatible type definition */ |
|
802 typedef PSAux_ServiceRec PSAux_Interface; |
|
803 |
|
804 FT_END_HEADER |
|
805 |
|
806 #endif /* __PSAUX_H__ */ |
|
807 |
|
808 |
|
809 /* END */ |