vrshoot
diff libs/ft2static/freetype/internal/psaux.h @ 0:b2f14e535253
initial commit
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 01 Feb 2014 19:58:19 +0200 |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/libs/ft2static/freetype/internal/psaux.h Sat Feb 01 19:58:19 2014 +0200 1.3 @@ -0,0 +1,873 @@ 1.4 +/***************************************************************************/ 1.5 +/* */ 1.6 +/* psaux.h */ 1.7 +/* */ 1.8 +/* Auxiliary functions and data structures related to PostScript fonts */ 1.9 +/* (specification). */ 1.10 +/* */ 1.11 +/* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2008, 2009 by */ 1.12 +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ 1.13 +/* */ 1.14 +/* This file is part of the FreeType project, and may only be used, */ 1.15 +/* modified, and distributed under the terms of the FreeType project */ 1.16 +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 1.17 +/* this file you indicate that you have read the license and */ 1.18 +/* understand and accept it fully. */ 1.19 +/* */ 1.20 +/***************************************************************************/ 1.21 + 1.22 + 1.23 +#ifndef __PSAUX_H__ 1.24 +#define __PSAUX_H__ 1.25 + 1.26 + 1.27 +#include <ft2build.h> 1.28 +#include FT_INTERNAL_OBJECTS_H 1.29 +#include FT_INTERNAL_TYPE1_TYPES_H 1.30 +#include FT_SERVICE_POSTSCRIPT_CMAPS_H 1.31 + 1.32 + 1.33 +FT_BEGIN_HEADER 1.34 + 1.35 + 1.36 + /*************************************************************************/ 1.37 + /*************************************************************************/ 1.38 + /***** *****/ 1.39 + /***** T1_TABLE *****/ 1.40 + /***** *****/ 1.41 + /*************************************************************************/ 1.42 + /*************************************************************************/ 1.43 + 1.44 + 1.45 + typedef struct PS_TableRec_* PS_Table; 1.46 + typedef const struct PS_Table_FuncsRec_* PS_Table_Funcs; 1.47 + 1.48 + 1.49 + /*************************************************************************/ 1.50 + /* */ 1.51 + /* <Struct> */ 1.52 + /* PS_Table_FuncsRec */ 1.53 + /* */ 1.54 + /* <Description> */ 1.55 + /* A set of function pointers to manage PS_Table objects. */ 1.56 + /* */ 1.57 + /* <Fields> */ 1.58 + /* table_init :: Used to initialize a table. */ 1.59 + /* */ 1.60 + /* table_done :: Finalizes resp. destroy a given table. */ 1.61 + /* */ 1.62 + /* table_add :: Adds a new object to a table. */ 1.63 + /* */ 1.64 + /* table_release :: Releases table data, then finalizes it. */ 1.65 + /* */ 1.66 + typedef struct PS_Table_FuncsRec_ 1.67 + { 1.68 + FT_Error 1.69 + (*init)( PS_Table table, 1.70 + FT_Int count, 1.71 + FT_Memory memory ); 1.72 + 1.73 + void 1.74 + (*done)( PS_Table table ); 1.75 + 1.76 + FT_Error 1.77 + (*add)( PS_Table table, 1.78 + FT_Int idx, 1.79 + void* object, 1.80 + FT_PtrDist length ); 1.81 + 1.82 + void 1.83 + (*release)( PS_Table table ); 1.84 + 1.85 + } PS_Table_FuncsRec; 1.86 + 1.87 + 1.88 + /*************************************************************************/ 1.89 + /* */ 1.90 + /* <Struct> */ 1.91 + /* PS_TableRec */ 1.92 + /* */ 1.93 + /* <Description> */ 1.94 + /* A PS_Table is a simple object used to store an array of objects in */ 1.95 + /* a single memory block. */ 1.96 + /* */ 1.97 + /* <Fields> */ 1.98 + /* block :: The address in memory of the growheap's block. This */ 1.99 + /* can change between two object adds, due to */ 1.100 + /* reallocation. */ 1.101 + /* */ 1.102 + /* cursor :: The current top of the grow heap within its block. */ 1.103 + /* */ 1.104 + /* capacity :: The current size of the heap block. Increments by */ 1.105 + /* 1kByte chunks. */ 1.106 + /* */ 1.107 + /* max_elems :: The maximum number of elements in table. */ 1.108 + /* */ 1.109 + /* num_elems :: The current number of elements in table. */ 1.110 + /* */ 1.111 + /* elements :: A table of element addresses within the block. */ 1.112 + /* */ 1.113 + /* lengths :: A table of element sizes within the block. */ 1.114 + /* */ 1.115 + /* memory :: The object used for memory operations */ 1.116 + /* (alloc/realloc). */ 1.117 + /* */ 1.118 + /* funcs :: A table of method pointers for this object. */ 1.119 + /* */ 1.120 + typedef struct PS_TableRec_ 1.121 + { 1.122 + FT_Byte* block; /* current memory block */ 1.123 + FT_Offset cursor; /* current cursor in memory block */ 1.124 + FT_Offset capacity; /* current size of memory block */ 1.125 + FT_Long init; 1.126 + 1.127 + FT_Int max_elems; 1.128 + FT_Int num_elems; 1.129 + FT_Byte** elements; /* addresses of table elements */ 1.130 + FT_PtrDist* lengths; /* lengths of table elements */ 1.131 + 1.132 + FT_Memory memory; 1.133 + PS_Table_FuncsRec funcs; 1.134 + 1.135 + } PS_TableRec; 1.136 + 1.137 + 1.138 + /*************************************************************************/ 1.139 + /*************************************************************************/ 1.140 + /***** *****/ 1.141 + /***** T1 FIELDS & TOKENS *****/ 1.142 + /***** *****/ 1.143 + /*************************************************************************/ 1.144 + /*************************************************************************/ 1.145 + 1.146 + typedef struct PS_ParserRec_* PS_Parser; 1.147 + 1.148 + typedef struct T1_TokenRec_* T1_Token; 1.149 + 1.150 + typedef struct T1_FieldRec_* T1_Field; 1.151 + 1.152 + 1.153 + /* simple enumeration type used to identify token types */ 1.154 + typedef enum T1_TokenType_ 1.155 + { 1.156 + T1_TOKEN_TYPE_NONE = 0, 1.157 + T1_TOKEN_TYPE_ANY, 1.158 + T1_TOKEN_TYPE_STRING, 1.159 + T1_TOKEN_TYPE_ARRAY, 1.160 + T1_TOKEN_TYPE_KEY, /* aka `name' */ 1.161 + 1.162 + /* do not remove */ 1.163 + T1_TOKEN_TYPE_MAX 1.164 + 1.165 + } T1_TokenType; 1.166 + 1.167 + 1.168 + /* a simple structure used to identify tokens */ 1.169 + typedef struct T1_TokenRec_ 1.170 + { 1.171 + FT_Byte* start; /* first character of token in input stream */ 1.172 + FT_Byte* limit; /* first character after the token */ 1.173 + T1_TokenType type; /* type of token */ 1.174 + 1.175 + } T1_TokenRec; 1.176 + 1.177 + 1.178 + /* enumeration type used to identify object fields */ 1.179 + typedef enum T1_FieldType_ 1.180 + { 1.181 + T1_FIELD_TYPE_NONE = 0, 1.182 + T1_FIELD_TYPE_BOOL, 1.183 + T1_FIELD_TYPE_INTEGER, 1.184 + T1_FIELD_TYPE_FIXED, 1.185 + T1_FIELD_TYPE_FIXED_1000, 1.186 + T1_FIELD_TYPE_STRING, 1.187 + T1_FIELD_TYPE_KEY, 1.188 + T1_FIELD_TYPE_BBOX, 1.189 + T1_FIELD_TYPE_INTEGER_ARRAY, 1.190 + T1_FIELD_TYPE_FIXED_ARRAY, 1.191 + T1_FIELD_TYPE_CALLBACK, 1.192 + 1.193 + /* do not remove */ 1.194 + T1_FIELD_TYPE_MAX 1.195 + 1.196 + } T1_FieldType; 1.197 + 1.198 + 1.199 + typedef enum T1_FieldLocation_ 1.200 + { 1.201 + T1_FIELD_LOCATION_CID_INFO, 1.202 + T1_FIELD_LOCATION_FONT_DICT, 1.203 + T1_FIELD_LOCATION_FONT_EXTRA, 1.204 + T1_FIELD_LOCATION_FONT_INFO, 1.205 + T1_FIELD_LOCATION_PRIVATE, 1.206 + T1_FIELD_LOCATION_BBOX, 1.207 + T1_FIELD_LOCATION_LOADER, 1.208 + T1_FIELD_LOCATION_FACE, 1.209 + T1_FIELD_LOCATION_BLEND, 1.210 + 1.211 + /* do not remove */ 1.212 + T1_FIELD_LOCATION_MAX 1.213 + 1.214 + } T1_FieldLocation; 1.215 + 1.216 + 1.217 + typedef void 1.218 + (*T1_Field_ParseFunc)( FT_Face face, 1.219 + FT_Pointer parser ); 1.220 + 1.221 + 1.222 + /* structure type used to model object fields */ 1.223 + typedef struct T1_FieldRec_ 1.224 + { 1.225 + const char* ident; /* field identifier */ 1.226 + T1_FieldLocation location; 1.227 + T1_FieldType type; /* type of field */ 1.228 + T1_Field_ParseFunc reader; 1.229 + FT_UInt offset; /* offset of field in object */ 1.230 + FT_Byte size; /* size of field in bytes */ 1.231 + FT_UInt array_max; /* maximal number of elements for */ 1.232 + /* array */ 1.233 + FT_UInt count_offset; /* offset of element count for */ 1.234 + /* arrays; must not be zero if in */ 1.235 + /* use -- in other words, a */ 1.236 + /* `num_FOO' element must not */ 1.237 + /* start the used structure if we */ 1.238 + /* parse a `FOO' array */ 1.239 + FT_UInt dict; /* where we expect it */ 1.240 + } T1_FieldRec; 1.241 + 1.242 +#define T1_FIELD_DICT_FONTDICT ( 1 << 0 ) /* also FontInfo and FDArray */ 1.243 +#define T1_FIELD_DICT_PRIVATE ( 1 << 1 ) 1.244 + 1.245 + 1.246 + 1.247 +#define T1_NEW_SIMPLE_FIELD( _ident, _type, _fname, _dict ) \ 1.248 + { \ 1.249 + _ident, T1CODE, _type, \ 1.250 + 0, \ 1.251 + FT_FIELD_OFFSET( _fname ), \ 1.252 + FT_FIELD_SIZE( _fname ), \ 1.253 + 0, 0, \ 1.254 + _dict \ 1.255 + }, 1.256 + 1.257 +#define T1_NEW_CALLBACK_FIELD( _ident, _reader, _dict ) \ 1.258 + { \ 1.259 + _ident, T1CODE, T1_FIELD_TYPE_CALLBACK, \ 1.260 + (T1_Field_ParseFunc)_reader, \ 1.261 + 0, 0, \ 1.262 + 0, 0, \ 1.263 + _dict \ 1.264 + }, 1.265 + 1.266 +#define T1_NEW_TABLE_FIELD( _ident, _type, _fname, _max, _dict ) \ 1.267 + { \ 1.268 + _ident, T1CODE, _type, \ 1.269 + 0, \ 1.270 + FT_FIELD_OFFSET( _fname ), \ 1.271 + FT_FIELD_SIZE_DELTA( _fname ), \ 1.272 + _max, \ 1.273 + FT_FIELD_OFFSET( num_ ## _fname ), \ 1.274 + _dict \ 1.275 + }, 1.276 + 1.277 +#define T1_NEW_TABLE_FIELD2( _ident, _type, _fname, _max, _dict ) \ 1.278 + { \ 1.279 + _ident, T1CODE, _type, \ 1.280 + 0, \ 1.281 + FT_FIELD_OFFSET( _fname ), \ 1.282 + FT_FIELD_SIZE_DELTA( _fname ), \ 1.283 + _max, 0, \ 1.284 + _dict \ 1.285 + }, 1.286 + 1.287 + 1.288 +#define T1_FIELD_BOOL( _ident, _fname, _dict ) \ 1.289 + T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_BOOL, _fname, _dict ) 1.290 + 1.291 +#define T1_FIELD_NUM( _ident, _fname, _dict ) \ 1.292 + T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_INTEGER, _fname, _dict ) 1.293 + 1.294 +#define T1_FIELD_FIXED( _ident, _fname, _dict ) \ 1.295 + T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_FIXED, _fname, _dict ) 1.296 + 1.297 +#define T1_FIELD_FIXED_1000( _ident, _fname, _dict ) \ 1.298 + T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_FIXED_1000, _fname, \ 1.299 + _dict ) 1.300 + 1.301 +#define T1_FIELD_STRING( _ident, _fname, _dict ) \ 1.302 + T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_STRING, _fname, _dict ) 1.303 + 1.304 +#define T1_FIELD_KEY( _ident, _fname, _dict ) \ 1.305 + T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_KEY, _fname, _dict ) 1.306 + 1.307 +#define T1_FIELD_BBOX( _ident, _fname, _dict ) \ 1.308 + T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_BBOX, _fname, _dict ) 1.309 + 1.310 + 1.311 +#define T1_FIELD_NUM_TABLE( _ident, _fname, _fmax, _dict ) \ 1.312 + T1_NEW_TABLE_FIELD( _ident, T1_FIELD_TYPE_INTEGER_ARRAY, \ 1.313 + _fname, _fmax, _dict ) 1.314 + 1.315 +#define T1_FIELD_FIXED_TABLE( _ident, _fname, _fmax, _dict ) \ 1.316 + T1_NEW_TABLE_FIELD( _ident, T1_FIELD_TYPE_FIXED_ARRAY, \ 1.317 + _fname, _fmax, _dict ) 1.318 + 1.319 +#define T1_FIELD_NUM_TABLE2( _ident, _fname, _fmax, _dict ) \ 1.320 + T1_NEW_TABLE_FIELD2( _ident, T1_FIELD_TYPE_INTEGER_ARRAY, \ 1.321 + _fname, _fmax, _dict ) 1.322 + 1.323 +#define T1_FIELD_FIXED_TABLE2( _ident, _fname, _fmax, _dict ) \ 1.324 + T1_NEW_TABLE_FIELD2( _ident, T1_FIELD_TYPE_FIXED_ARRAY, \ 1.325 + _fname, _fmax, _dict ) 1.326 + 1.327 +#define T1_FIELD_CALLBACK( _ident, _name, _dict ) \ 1.328 + T1_NEW_CALLBACK_FIELD( _ident, _name, _dict ) 1.329 + 1.330 + 1.331 + /*************************************************************************/ 1.332 + /*************************************************************************/ 1.333 + /***** *****/ 1.334 + /***** T1 PARSER *****/ 1.335 + /***** *****/ 1.336 + /*************************************************************************/ 1.337 + /*************************************************************************/ 1.338 + 1.339 + typedef const struct PS_Parser_FuncsRec_* PS_Parser_Funcs; 1.340 + 1.341 + typedef struct PS_Parser_FuncsRec_ 1.342 + { 1.343 + void 1.344 + (*init)( PS_Parser parser, 1.345 + FT_Byte* base, 1.346 + FT_Byte* limit, 1.347 + FT_Memory memory ); 1.348 + 1.349 + void 1.350 + (*done)( PS_Parser parser ); 1.351 + 1.352 + void 1.353 + (*skip_spaces)( PS_Parser parser ); 1.354 + void 1.355 + (*skip_PS_token)( PS_Parser parser ); 1.356 + 1.357 + FT_Long 1.358 + (*to_int)( PS_Parser parser ); 1.359 + FT_Fixed 1.360 + (*to_fixed)( PS_Parser parser, 1.361 + FT_Int power_ten ); 1.362 + 1.363 + FT_Error 1.364 + (*to_bytes)( PS_Parser parser, 1.365 + FT_Byte* bytes, 1.366 + FT_Offset max_bytes, 1.367 + FT_Long* pnum_bytes, 1.368 + FT_Bool delimiters ); 1.369 + 1.370 + FT_Int 1.371 + (*to_coord_array)( PS_Parser parser, 1.372 + FT_Int max_coords, 1.373 + FT_Short* coords ); 1.374 + FT_Int 1.375 + (*to_fixed_array)( PS_Parser parser, 1.376 + FT_Int max_values, 1.377 + FT_Fixed* values, 1.378 + FT_Int power_ten ); 1.379 + 1.380 + void 1.381 + (*to_token)( PS_Parser parser, 1.382 + T1_Token token ); 1.383 + void 1.384 + (*to_token_array)( PS_Parser parser, 1.385 + T1_Token tokens, 1.386 + FT_UInt max_tokens, 1.387 + FT_Int* pnum_tokens ); 1.388 + 1.389 + FT_Error 1.390 + (*load_field)( PS_Parser parser, 1.391 + const T1_Field field, 1.392 + void** objects, 1.393 + FT_UInt max_objects, 1.394 + FT_ULong* pflags ); 1.395 + 1.396 + FT_Error 1.397 + (*load_field_table)( PS_Parser parser, 1.398 + const T1_Field field, 1.399 + void** objects, 1.400 + FT_UInt max_objects, 1.401 + FT_ULong* pflags ); 1.402 + 1.403 + } PS_Parser_FuncsRec; 1.404 + 1.405 + 1.406 + /*************************************************************************/ 1.407 + /* */ 1.408 + /* <Struct> */ 1.409 + /* PS_ParserRec */ 1.410 + /* */ 1.411 + /* <Description> */ 1.412 + /* A PS_Parser is an object used to parse a Type 1 font very quickly. */ 1.413 + /* */ 1.414 + /* <Fields> */ 1.415 + /* cursor :: The current position in the text. */ 1.416 + /* */ 1.417 + /* base :: Start of the processed text. */ 1.418 + /* */ 1.419 + /* limit :: End of the processed text. */ 1.420 + /* */ 1.421 + /* error :: The last error returned. */ 1.422 + /* */ 1.423 + /* memory :: The object used for memory operations (alloc/realloc). */ 1.424 + /* */ 1.425 + /* funcs :: A table of functions for the parser. */ 1.426 + /* */ 1.427 + typedef struct PS_ParserRec_ 1.428 + { 1.429 + FT_Byte* cursor; 1.430 + FT_Byte* base; 1.431 + FT_Byte* limit; 1.432 + FT_Error error; 1.433 + FT_Memory memory; 1.434 + 1.435 + PS_Parser_FuncsRec funcs; 1.436 + 1.437 + } PS_ParserRec; 1.438 + 1.439 + 1.440 + /*************************************************************************/ 1.441 + /*************************************************************************/ 1.442 + /***** *****/ 1.443 + /***** T1 BUILDER *****/ 1.444 + /***** *****/ 1.445 + /*************************************************************************/ 1.446 + /*************************************************************************/ 1.447 + 1.448 + 1.449 + typedef struct T1_BuilderRec_* T1_Builder; 1.450 + 1.451 + 1.452 + typedef FT_Error 1.453 + (*T1_Builder_Check_Points_Func)( T1_Builder builder, 1.454 + FT_Int count ); 1.455 + 1.456 + typedef void 1.457 + (*T1_Builder_Add_Point_Func)( T1_Builder builder, 1.458 + FT_Pos x, 1.459 + FT_Pos y, 1.460 + FT_Byte flag ); 1.461 + 1.462 + typedef FT_Error 1.463 + (*T1_Builder_Add_Point1_Func)( T1_Builder builder, 1.464 + FT_Pos x, 1.465 + FT_Pos y ); 1.466 + 1.467 + typedef FT_Error 1.468 + (*T1_Builder_Add_Contour_Func)( T1_Builder builder ); 1.469 + 1.470 + typedef FT_Error 1.471 + (*T1_Builder_Start_Point_Func)( T1_Builder builder, 1.472 + FT_Pos x, 1.473 + FT_Pos y ); 1.474 + 1.475 + typedef void 1.476 + (*T1_Builder_Close_Contour_Func)( T1_Builder builder ); 1.477 + 1.478 + 1.479 + typedef const struct T1_Builder_FuncsRec_* T1_Builder_Funcs; 1.480 + 1.481 + typedef struct T1_Builder_FuncsRec_ 1.482 + { 1.483 + void 1.484 + (*init)( T1_Builder builder, 1.485 + FT_Face face, 1.486 + FT_Size size, 1.487 + FT_GlyphSlot slot, 1.488 + FT_Bool hinting ); 1.489 + 1.490 + void 1.491 + (*done)( T1_Builder builder ); 1.492 + 1.493 + T1_Builder_Check_Points_Func check_points; 1.494 + T1_Builder_Add_Point_Func add_point; 1.495 + T1_Builder_Add_Point1_Func add_point1; 1.496 + T1_Builder_Add_Contour_Func add_contour; 1.497 + T1_Builder_Start_Point_Func start_point; 1.498 + T1_Builder_Close_Contour_Func close_contour; 1.499 + 1.500 + } T1_Builder_FuncsRec; 1.501 + 1.502 + 1.503 + /* an enumeration type to handle charstring parsing states */ 1.504 + typedef enum T1_ParseState_ 1.505 + { 1.506 + T1_Parse_Start, 1.507 + T1_Parse_Have_Width, 1.508 + T1_Parse_Have_Moveto, 1.509 + T1_Parse_Have_Path 1.510 + 1.511 + } T1_ParseState; 1.512 + 1.513 + 1.514 + /*************************************************************************/ 1.515 + /* */ 1.516 + /* <Structure> */ 1.517 + /* T1_BuilderRec */ 1.518 + /* */ 1.519 + /* <Description> */ 1.520 + /* A structure used during glyph loading to store its outline. */ 1.521 + /* */ 1.522 + /* <Fields> */ 1.523 + /* memory :: The current memory object. */ 1.524 + /* */ 1.525 + /* face :: The current face object. */ 1.526 + /* */ 1.527 + /* glyph :: The current glyph slot. */ 1.528 + /* */ 1.529 + /* loader :: XXX */ 1.530 + /* */ 1.531 + /* base :: The base glyph outline. */ 1.532 + /* */ 1.533 + /* current :: The current glyph outline. */ 1.534 + /* */ 1.535 + /* max_points :: maximum points in builder outline */ 1.536 + /* */ 1.537 + /* max_contours :: Maximal number of contours in builder outline. */ 1.538 + /* */ 1.539 + /* pos_x :: The horizontal translation (if composite glyph). */ 1.540 + /* */ 1.541 + /* pos_y :: The vertical translation (if composite glyph). */ 1.542 + /* */ 1.543 + /* left_bearing :: The left side bearing point. */ 1.544 + /* */ 1.545 + /* advance :: The horizontal advance vector. */ 1.546 + /* */ 1.547 + /* bbox :: Unused. */ 1.548 + /* */ 1.549 + /* parse_state :: An enumeration which controls the charstring */ 1.550 + /* parsing state. */ 1.551 + /* */ 1.552 + /* load_points :: If this flag is not set, no points are loaded. */ 1.553 + /* */ 1.554 + /* no_recurse :: Set but not used. */ 1.555 + /* */ 1.556 + /* metrics_only :: A boolean indicating that we only want to compute */ 1.557 + /* the metrics of a given glyph, not load all of its */ 1.558 + /* points. */ 1.559 + /* */ 1.560 + /* funcs :: An array of function pointers for the builder. */ 1.561 + /* */ 1.562 + typedef struct T1_BuilderRec_ 1.563 + { 1.564 + FT_Memory memory; 1.565 + FT_Face face; 1.566 + FT_GlyphSlot glyph; 1.567 + FT_GlyphLoader loader; 1.568 + FT_Outline* base; 1.569 + FT_Outline* current; 1.570 + 1.571 + FT_Pos pos_x; 1.572 + FT_Pos pos_y; 1.573 + 1.574 + FT_Vector left_bearing; 1.575 + FT_Vector advance; 1.576 + 1.577 + FT_BBox bbox; /* bounding box */ 1.578 + T1_ParseState parse_state; 1.579 + FT_Bool load_points; 1.580 + FT_Bool no_recurse; 1.581 + 1.582 + FT_Bool metrics_only; 1.583 + 1.584 + void* hints_funcs; /* hinter-specific */ 1.585 + void* hints_globals; /* hinter-specific */ 1.586 + 1.587 + T1_Builder_FuncsRec funcs; 1.588 + 1.589 + } T1_BuilderRec; 1.590 + 1.591 + 1.592 + /*************************************************************************/ 1.593 + /*************************************************************************/ 1.594 + /***** *****/ 1.595 + /***** T1 DECODER *****/ 1.596 + /***** *****/ 1.597 + /*************************************************************************/ 1.598 + /*************************************************************************/ 1.599 + 1.600 +#if 0 1.601 + 1.602 + /*************************************************************************/ 1.603 + /* */ 1.604 + /* T1_MAX_SUBRS_CALLS details the maximum number of nested sub-routine */ 1.605 + /* calls during glyph loading. */ 1.606 + /* */ 1.607 +#define T1_MAX_SUBRS_CALLS 8 1.608 + 1.609 + 1.610 + /*************************************************************************/ 1.611 + /* */ 1.612 + /* T1_MAX_CHARSTRING_OPERANDS is the charstring stack's capacity. A */ 1.613 + /* minimum of 16 is required. */ 1.614 + /* */ 1.615 +#define T1_MAX_CHARSTRINGS_OPERANDS 32 1.616 + 1.617 +#endif /* 0 */ 1.618 + 1.619 + 1.620 + typedef struct T1_Decoder_ZoneRec_ 1.621 + { 1.622 + FT_Byte* cursor; 1.623 + FT_Byte* base; 1.624 + FT_Byte* limit; 1.625 + 1.626 + } T1_Decoder_ZoneRec, *T1_Decoder_Zone; 1.627 + 1.628 + 1.629 + typedef struct T1_DecoderRec_* T1_Decoder; 1.630 + typedef const struct T1_Decoder_FuncsRec_* T1_Decoder_Funcs; 1.631 + 1.632 + 1.633 + typedef FT_Error 1.634 + (*T1_Decoder_Callback)( T1_Decoder decoder, 1.635 + FT_UInt glyph_index ); 1.636 + 1.637 + 1.638 + typedef struct T1_Decoder_FuncsRec_ 1.639 + { 1.640 + FT_Error 1.641 + (*init)( T1_Decoder decoder, 1.642 + FT_Face face, 1.643 + FT_Size size, 1.644 + FT_GlyphSlot slot, 1.645 + FT_Byte** glyph_names, 1.646 + PS_Blend blend, 1.647 + FT_Bool hinting, 1.648 + FT_Render_Mode hint_mode, 1.649 + T1_Decoder_Callback callback ); 1.650 + 1.651 + void 1.652 + (*done)( T1_Decoder decoder ); 1.653 + 1.654 + FT_Error 1.655 + (*parse_charstrings)( T1_Decoder decoder, 1.656 + FT_Byte* base, 1.657 + FT_UInt len ); 1.658 + 1.659 + } T1_Decoder_FuncsRec; 1.660 + 1.661 + 1.662 + typedef struct T1_DecoderRec_ 1.663 + { 1.664 + T1_BuilderRec builder; 1.665 + 1.666 + FT_Long stack[T1_MAX_CHARSTRINGS_OPERANDS]; 1.667 + FT_Long* top; 1.668 + 1.669 + T1_Decoder_ZoneRec zones[T1_MAX_SUBRS_CALLS + 1]; 1.670 + T1_Decoder_Zone zone; 1.671 + 1.672 + FT_Service_PsCMaps psnames; /* for seac */ 1.673 + FT_UInt num_glyphs; 1.674 + FT_Byte** glyph_names; 1.675 + 1.676 + FT_Int lenIV; /* internal for sub routine calls */ 1.677 + FT_UInt num_subrs; 1.678 + FT_Byte** subrs; 1.679 + FT_PtrDist* subrs_len; /* array of subrs length (optional) */ 1.680 + 1.681 + FT_Matrix font_matrix; 1.682 + FT_Vector font_offset; 1.683 + 1.684 + FT_Int flex_state; 1.685 + FT_Int num_flex_vectors; 1.686 + FT_Vector flex_vectors[7]; 1.687 + 1.688 + PS_Blend blend; /* for multiple master support */ 1.689 + 1.690 + FT_Render_Mode hint_mode; 1.691 + 1.692 + T1_Decoder_Callback parse_callback; 1.693 + T1_Decoder_FuncsRec funcs; 1.694 + 1.695 + FT_Long* buildchar; 1.696 + FT_UInt len_buildchar; 1.697 + 1.698 + FT_Bool seac; 1.699 + 1.700 + } T1_DecoderRec; 1.701 + 1.702 + 1.703 + /*************************************************************************/ 1.704 + /*************************************************************************/ 1.705 + /***** *****/ 1.706 + /***** AFM PARSER *****/ 1.707 + /***** *****/ 1.708 + /*************************************************************************/ 1.709 + /*************************************************************************/ 1.710 + 1.711 + typedef struct AFM_ParserRec_* AFM_Parser; 1.712 + 1.713 + typedef struct AFM_Parser_FuncsRec_ 1.714 + { 1.715 + FT_Error 1.716 + (*init)( AFM_Parser parser, 1.717 + FT_Memory memory, 1.718 + FT_Byte* base, 1.719 + FT_Byte* limit ); 1.720 + 1.721 + void 1.722 + (*done)( AFM_Parser parser ); 1.723 + 1.724 + FT_Error 1.725 + (*parse)( AFM_Parser parser ); 1.726 + 1.727 + } AFM_Parser_FuncsRec; 1.728 + 1.729 + 1.730 + typedef struct AFM_StreamRec_* AFM_Stream; 1.731 + 1.732 + 1.733 + /*************************************************************************/ 1.734 + /* */ 1.735 + /* <Struct> */ 1.736 + /* AFM_ParserRec */ 1.737 + /* */ 1.738 + /* <Description> */ 1.739 + /* An AFM_Parser is a parser for the AFM files. */ 1.740 + /* */ 1.741 + /* <Fields> */ 1.742 + /* memory :: The object used for memory operations (alloc and */ 1.743 + /* realloc). */ 1.744 + /* */ 1.745 + /* stream :: This is an opaque object. */ 1.746 + /* */ 1.747 + /* FontInfo :: The result will be stored here. */ 1.748 + /* */ 1.749 + /* get_index :: A user provided function to get a glyph index by its */ 1.750 + /* name. */ 1.751 + /* */ 1.752 + typedef struct AFM_ParserRec_ 1.753 + { 1.754 + FT_Memory memory; 1.755 + AFM_Stream stream; 1.756 + 1.757 + AFM_FontInfo FontInfo; 1.758 + 1.759 + FT_Int 1.760 + (*get_index)( const char* name, 1.761 + FT_Offset len, 1.762 + void* user_data ); 1.763 + 1.764 + void* user_data; 1.765 + 1.766 + } AFM_ParserRec; 1.767 + 1.768 + 1.769 + /*************************************************************************/ 1.770 + /*************************************************************************/ 1.771 + /***** *****/ 1.772 + /***** TYPE1 CHARMAPS *****/ 1.773 + /***** *****/ 1.774 + /*************************************************************************/ 1.775 + /*************************************************************************/ 1.776 + 1.777 + typedef const struct T1_CMap_ClassesRec_* T1_CMap_Classes; 1.778 + 1.779 + typedef struct T1_CMap_ClassesRec_ 1.780 + { 1.781 + FT_CMap_Class standard; 1.782 + FT_CMap_Class expert; 1.783 + FT_CMap_Class custom; 1.784 + FT_CMap_Class unicode; 1.785 + 1.786 + } T1_CMap_ClassesRec; 1.787 + 1.788 + 1.789 + /*************************************************************************/ 1.790 + /*************************************************************************/ 1.791 + /***** *****/ 1.792 + /***** PSAux Module Interface *****/ 1.793 + /***** *****/ 1.794 + /*************************************************************************/ 1.795 + /*************************************************************************/ 1.796 + 1.797 + typedef struct PSAux_ServiceRec_ 1.798 + { 1.799 + /* don't use `PS_Table_Funcs' and friends to avoid compiler warnings */ 1.800 + const PS_Table_FuncsRec* ps_table_funcs; 1.801 + const PS_Parser_FuncsRec* ps_parser_funcs; 1.802 + const T1_Builder_FuncsRec* t1_builder_funcs; 1.803 + const T1_Decoder_FuncsRec* t1_decoder_funcs; 1.804 + 1.805 + void 1.806 + (*t1_decrypt)( FT_Byte* buffer, 1.807 + FT_Offset length, 1.808 + FT_UShort seed ); 1.809 + 1.810 + T1_CMap_Classes t1_cmap_classes; 1.811 + 1.812 + /* fields after this comment line were added after version 2.1.10 */ 1.813 + const AFM_Parser_FuncsRec* afm_parser_funcs; 1.814 + 1.815 + } PSAux_ServiceRec, *PSAux_Service; 1.816 + 1.817 + /* backwards-compatible type definition */ 1.818 + typedef PSAux_ServiceRec PSAux_Interface; 1.819 + 1.820 + 1.821 + /*************************************************************************/ 1.822 + /*************************************************************************/ 1.823 + /***** *****/ 1.824 + /***** Some convenience functions *****/ 1.825 + /***** *****/ 1.826 + /*************************************************************************/ 1.827 + /*************************************************************************/ 1.828 + 1.829 +#define IS_PS_NEWLINE( ch ) \ 1.830 + ( (ch) == '\r' || \ 1.831 + (ch) == '\n' ) 1.832 + 1.833 +#define IS_PS_SPACE( ch ) \ 1.834 + ( (ch) == ' ' || \ 1.835 + IS_PS_NEWLINE( ch ) || \ 1.836 + (ch) == '\t' || \ 1.837 + (ch) == '\f' || \ 1.838 + (ch) == '\0' ) 1.839 + 1.840 +#define IS_PS_SPECIAL( ch ) \ 1.841 + ( (ch) == '/' || \ 1.842 + (ch) == '(' || (ch) == ')' || \ 1.843 + (ch) == '<' || (ch) == '>' || \ 1.844 + (ch) == '[' || (ch) == ']' || \ 1.845 + (ch) == '{' || (ch) == '}' || \ 1.846 + (ch) == '%' ) 1.847 + 1.848 +#define IS_PS_DELIM( ch ) \ 1.849 + ( IS_PS_SPACE( ch ) || \ 1.850 + IS_PS_SPECIAL( ch ) ) 1.851 + 1.852 +#define IS_PS_DIGIT( ch ) \ 1.853 + ( (ch) >= '0' && (ch) <= '9' ) 1.854 + 1.855 +#define IS_PS_XDIGIT( ch ) \ 1.856 + ( IS_PS_DIGIT( ch ) || \ 1.857 + ( (ch) >= 'A' && (ch) <= 'F' ) || \ 1.858 + ( (ch) >= 'a' && (ch) <= 'f' ) ) 1.859 + 1.860 +#define IS_PS_BASE85( ch ) \ 1.861 + ( (ch) >= '!' && (ch) <= 'u' ) 1.862 + 1.863 +#define IS_PS_TOKEN( cur, limit, token ) \ 1.864 + ( (char)(cur)[0] == (token)[0] && \ 1.865 + ( (cur) + sizeof ( (token) ) == (limit) || \ 1.866 + ( (cur) + sizeof( (token) ) < (limit) && \ 1.867 + IS_PS_DELIM( (cur)[sizeof ( (token) ) - 1] ) ) ) && \ 1.868 + ft_strncmp( (char*)(cur), (token), sizeof ( (token) ) - 1 ) == 0 ) 1.869 + 1.870 + 1.871 +FT_END_HEADER 1.872 + 1.873 +#endif /* __PSAUX_H__ */ 1.874 + 1.875 + 1.876 +/* END */