49 FT_UInt hinting_engine;
50 FT_Bool no_stem_darkening;
51 FT_Int darken_params[8];
54 } PS_DriverRec, *PS_Driver;
94 (*init)( PS_Table table,
99 (*done)( PS_Table table );
102 (*add)( PS_Table table,
108 (*release)( PS_Table table );
163 PS_Table_FuncsRec funcs;
184 typedef enum T1_TokenType_
186 T1_TOKEN_TYPE_NONE = 0,
188 T1_TOKEN_TYPE_STRING,
209 typedef enum T1_FieldType_
211 T1_FIELD_TYPE_NONE = 0,
213 T1_FIELD_TYPE_INTEGER,
215 T1_FIELD_TYPE_FIXED_1000,
216 T1_FIELD_TYPE_STRING,
219 T1_FIELD_TYPE_MM_BBOX,
220 T1_FIELD_TYPE_INTEGER_ARRAY,
221 T1_FIELD_TYPE_FIXED_ARRAY,
222 T1_FIELD_TYPE_CALLBACK,
230 typedef enum T1_FieldLocation_
232 T1_FIELD_LOCATION_NONE = 0,
233 T1_FIELD_LOCATION_CID_INFO,
234 T1_FIELD_LOCATION_FONT_DICT,
235 T1_FIELD_LOCATION_FONT_EXTRA,
236 T1_FIELD_LOCATION_FONT_INFO,
237 T1_FIELD_LOCATION_PRIVATE,
238 T1_FIELD_LOCATION_BBOX,
239 T1_FIELD_LOCATION_LOADER,
240 T1_FIELD_LOCATION_FACE,
241 T1_FIELD_LOCATION_BLEND,
244 T1_FIELD_LOCATION_MAX
250 (*T1_Field_ParseFunc)( FT_Face face,
259 T1_FieldLocation location;
261 T1_Field_ParseFunc reader;
266 FT_UInt count_offset;
275#define T1_FIELD_DICT_FONTDICT ( 1 << 0 )
276#define T1_FIELD_DICT_PRIVATE ( 1 << 1 )
280#define T1_NEW_SIMPLE_FIELD( _ident, _type, _fname, _dict ) \
282 sizeof ( _ident ) - 1, \
283 _ident, T1CODE, _type, \
285 FT_FIELD_OFFSET( _fname ), \
286 FT_FIELD_SIZE( _fname ), \
291#define T1_NEW_CALLBACK_FIELD( _ident, _reader, _dict ) \
293 sizeof ( _ident ) - 1, \
294 _ident, T1CODE, T1_FIELD_TYPE_CALLBACK, \
295 (T1_Field_ParseFunc)_reader, \
301#define T1_NEW_TABLE_FIELD( _ident, _type, _fname, _max, _dict ) \
303 sizeof ( _ident ) - 1, \
304 _ident, T1CODE, _type, \
306 FT_FIELD_OFFSET( _fname ), \
307 FT_FIELD_SIZE_DELTA( _fname ), \
309 FT_FIELD_OFFSET( num_ ## _fname ), \
313#define T1_NEW_TABLE_FIELD2( _ident, _type, _fname, _max, _dict ) \
315 sizeof ( _ident ) - 1, \
316 _ident, T1CODE, _type, \
318 FT_FIELD_OFFSET( _fname ), \
319 FT_FIELD_SIZE_DELTA( _fname ), \
325#define T1_FIELD_BOOL( _ident, _fname, _dict ) \
326 T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_BOOL, _fname, _dict )
328#define T1_FIELD_NUM( _ident, _fname, _dict ) \
329 T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_INTEGER, _fname, _dict )
331#define T1_FIELD_FIXED( _ident, _fname, _dict ) \
332 T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_FIXED, _fname, _dict )
334#define T1_FIELD_FIXED_1000( _ident, _fname, _dict ) \
335 T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_FIXED_1000, _fname, \
338#define T1_FIELD_STRING( _ident, _fname, _dict ) \
339 T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_STRING, _fname, _dict )
341#define T1_FIELD_KEY( _ident, _fname, _dict ) \
342 T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_KEY, _fname, _dict )
344#define T1_FIELD_BBOX( _ident, _fname, _dict ) \
345 T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_BBOX, _fname, _dict )
348#define T1_FIELD_NUM_TABLE( _ident, _fname, _fmax, _dict ) \
349 T1_NEW_TABLE_FIELD( _ident, T1_FIELD_TYPE_INTEGER_ARRAY, \
350 _fname, _fmax, _dict )
352#define T1_FIELD_FIXED_TABLE( _ident, _fname, _fmax, _dict ) \
353 T1_NEW_TABLE_FIELD( _ident, T1_FIELD_TYPE_FIXED_ARRAY, \
354 _fname, _fmax, _dict )
356#define T1_FIELD_NUM_TABLE2( _ident, _fname, _fmax, _dict ) \
357 T1_NEW_TABLE_FIELD2( _ident, T1_FIELD_TYPE_INTEGER_ARRAY, \
358 _fname, _fmax, _dict )
360#define T1_FIELD_FIXED_TABLE2( _ident, _fname, _fmax, _dict ) \
361 T1_NEW_TABLE_FIELD2( _ident, T1_FIELD_TYPE_FIXED_ARRAY, \
362 _fname, _fmax, _dict )
364#define T1_FIELD_CALLBACK( _ident, _name, _dict ) \
365 T1_NEW_CALLBACK_FIELD( _ident, _name, _dict )
367#define T1_FIELD_ZERO \
370 NULL, T1_FIELD_LOCATION_NONE, T1_FIELD_TYPE_NONE, \
371 NULL, 0, 0, 0, 0, 0 \
388 (*init)( PS_Parser parser,
394 (*done)( PS_Parser parser );
397 (*skip_spaces)( PS_Parser parser );
399 (*skip_PS_token)( PS_Parser parser );
402 (*to_int)( PS_Parser parser );
404 (*to_fixed)( PS_Parser parser,
408 (*to_bytes)( PS_Parser parser,
411 FT_ULong* pnum_bytes,
412 FT_Bool delimiters );
415 (*to_coord_array)( PS_Parser parser,
419 (*to_fixed_array)( PS_Parser parser,
425 (*to_token)( PS_Parser parser,
428 (*to_token_array)( PS_Parser parser,
431 FT_Int* pnum_tokens );
434 (*load_field)( PS_Parser parser,
435 const T1_Field field,
441 (*load_field_table)( PS_Parser parser,
442 const T1_Field field,
447 } PS_Parser_FuncsRec;
485 PS_Parser_FuncsRec funcs;
505 (*init)( PS_Builder* ps_builder,
510 (*done)( PS_Builder* builder );
512 } PS_Builder_FuncsRec;
581 FT_GlyphLoader loader;
588 FT_Vector* left_bearing;
596 FT_Bool metrics_only;
599 PS_Builder_FuncsRec funcs;
612#define PS_MAX_OPERANDS 48
613#define PS_MAX_SUBRS_CALLS 16
632 (*CFF_Decoder_Get_Glyph_Callback)( TT_Face face,
638 (*CFF_Decoder_Free_Glyph_Callback)( TT_Face face,
647 FT_Fixed stack[PS_MAX_OPERANDS + 1];
650 PS_Decoder_Zone zones[PS_MAX_SUBRS_CALLS + 1];
651 PS_Decoder_Zone* zone;
654 FT_Int num_flex_vectors;
655 FT_Vector flex_vectors[7];
658 CFF_SubFont current_subfont;
659 FT_Generic* cf2_instance;
674 FT_Byte** glyph_names;
677 FT_Render_Mode hint_mode;
681 CFF_Decoder_Get_Glyph_Callback get_glyph_callback;
682 CFF_Decoder_Free_Glyph_Callback free_glyph_callback;
685 FT_Service_PsCMaps psnames;
691 FT_Matrix font_matrix;
692 FT_Vector font_offset;
697 FT_UInt len_buildchar;
715 (*T1_Builder_Check_Points_Func)( T1_Builder builder,
719 (*T1_Builder_Add_Point_Func)( T1_Builder builder,
725 (*T1_Builder_Add_Point1_Func)( T1_Builder builder,
730 (*T1_Builder_Add_Contour_Func)( T1_Builder builder );
733 (*T1_Builder_Start_Point_Func)( T1_Builder builder,
738 (*T1_Builder_Close_Contour_Func)( T1_Builder builder );
746 (*init)( T1_Builder builder,
753 (*done)( T1_Builder builder );
755 T1_Builder_Check_Points_Func check_points;
756 T1_Builder_Add_Point_Func add_point;
757 T1_Builder_Add_Point1_Func add_point1;
758 T1_Builder_Add_Contour_Func add_contour;
759 T1_Builder_Start_Point_Func start_point;
760 T1_Builder_Close_Contour_Func close_contour;
762 } T1_Builder_FuncsRec;
766 typedef enum T1_ParseState_
770 T1_Parse_Have_Moveto,
845 FT_GlyphLoader loader;
852 FT_Vector left_bearing;
856 T1_ParseState parse_state;
860 FT_Bool metrics_only;
865 T1_Builder_FuncsRec funcs;
885#define T1_MAX_SUBRS_CALLS 8
893#define T1_MAX_CHARSTRINGS_OPERANDS 32
904 } T1_Decoder_ZoneRec, *T1_Decoder_Zone;
912 (*T1_Decoder_Callback)( T1_Decoder decoder,
913 FT_UInt glyph_index );
919 (*init)( T1_Decoder decoder,
923 FT_Byte** glyph_names,
926 FT_Render_Mode hint_mode,
927 T1_Decoder_Callback callback );
930 (*done)( T1_Decoder decoder );
932#ifdef T1_CONFIG_OPTION_OLD_ENGINE
934 (*parse_charstrings_old)( T1_Decoder decoder,
939 (*parse_metrics)( T1_Decoder decoder,
945 (*parse_charstrings)( PS_Decoder* decoder,
946 FT_Byte* charstring_base,
947 FT_ULong charstring_len );
950 } T1_Decoder_FuncsRec;
955 T1_BuilderRec builder;
957 FT_Long stack[T1_MAX_CHARSTRINGS_OPERANDS];
960 T1_Decoder_ZoneRec zones[T1_MAX_SUBRS_CALLS + 1];
961 T1_Decoder_Zone zone;
963 FT_Service_PsCMaps psnames;
965 FT_Byte** glyph_names;
973 FT_Matrix font_matrix;
974 FT_Vector font_offset;
977 FT_Int num_flex_vectors;
978 FT_Vector flex_vectors[7];
982 FT_Render_Mode hint_mode;
984 T1_Decoder_Callback parse_callback;
985 T1_Decoder_FuncsRec funcs;
988 FT_UInt len_buildchar;
992 FT_Generic cf2_instance;
1010 (*CFF_Builder_Check_Points_Func)( CFF_Builder* builder,
1014 (*CFF_Builder_Add_Point_Func)( CFF_Builder* builder,
1019 (*CFF_Builder_Add_Point1_Func)( CFF_Builder* builder,
1023 (*CFF_Builder_Start_Point_Func)( CFF_Builder* builder,
1027 (*CFF_Builder_Close_Contour_Func)( CFF_Builder* builder );
1030 (*CFF_Builder_Add_Contour_Func)( CFF_Builder* builder );
1037 (*init)( CFF_Builder* builder,
1040 CFF_GlyphSlot glyph,
1044 (*done)( CFF_Builder* builder );
1046 CFF_Builder_Check_Points_Func check_points;
1047 CFF_Builder_Add_Point_Func add_point;
1048 CFF_Builder_Add_Point1_Func add_point1;
1049 CFF_Builder_Add_Contour_Func add_contour;
1050 CFF_Builder_Start_Point_Func start_point;
1051 CFF_Builder_Close_Contour_Func close_contour;
1053 } CFF_Builder_FuncsRec;
1124 CFF_GlyphSlot glyph;
1125 FT_GlyphLoader loader;
1127 FT_Outline* current;
1132 FT_Vector left_bearing;
1138 FT_Bool load_points;
1141 FT_Bool metrics_only;
1144 void* hints_globals;
1146 CFF_Builder_FuncsRec funcs;
1159#define CFF_MAX_OPERANDS 48
1160#define CFF_MAX_SUBRS_CALLS 16
1166#define CFF_MAX_TRANS_ELEMENTS 32
1181 CFF_Builder builder;
1184 FT_Fixed stack[CFF_MAX_OPERANDS + 1];
1187 CFF_Decoder_Zone zones[CFF_MAX_SUBRS_CALLS + 1];
1188 CFF_Decoder_Zone* zone;
1191 FT_Int num_flex_vectors;
1192 FT_Vector flex_vectors[7];
1195 FT_Pos nominal_width;
1200 FT_Fixed buildchar[CFF_MAX_TRANS_ELEMENTS];
1203 FT_UInt num_globals;
1206 FT_Int globals_bias;
1211 FT_Byte** glyph_names;
1214 FT_Render_Mode hint_mode;
1218 CFF_SubFont current_subfont;
1220 CFF_Decoder_Get_Glyph_Callback get_glyph_callback;
1221 CFF_Decoder_Free_Glyph_Callback free_glyph_callback;
1231 (*init)( CFF_Decoder* decoder,
1236 FT_Render_Mode hint_mode,
1237 CFF_Decoder_Get_Glyph_Callback get_callback,
1238 CFF_Decoder_Free_Glyph_Callback free_callback );
1241 (*prepare)( CFF_Decoder* decoder,
1243 FT_UInt glyph_index );
1245#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
1247 (*parse_charstrings_old)( CFF_Decoder* decoder,
1248 FT_Byte* charstring_base,
1249 FT_ULong charstring_len,
1254 (*parse_charstrings)( PS_Decoder* decoder,
1255 FT_Byte* charstring_base,
1256 FT_ULong charstring_len );
1258 } CFF_Decoder_FuncsRec;
1274 (*init)( AFM_Parser parser,
1280 (*done)( AFM_Parser parser );
1283 (*parse)( AFM_Parser parser );
1285 } AFM_Parser_FuncsRec;
1317 AFM_FontInfo FontInfo;
1320 (*get_index)(
const char* name,
1341 FT_CMap_Class standard;
1342 FT_CMap_Class expert;
1343 FT_CMap_Class custom;
1344 FT_CMap_Class unicode;
1346 } T1_CMap_ClassesRec;
1360 const PS_Table_FuncsRec* ps_table_funcs;
1361 const PS_Parser_FuncsRec* ps_parser_funcs;
1362 const T1_Builder_FuncsRec* t1_builder_funcs;
1363 const T1_Decoder_FuncsRec* t1_decoder_funcs;
1366 (*t1_decrypt)( FT_Byte* buffer,
1371 (*cff_random)( FT_UInt32 r );
1374 (*ps_decoder_init)( PS_Decoder* ps_decoder,
1379 (*t1_make_subfont)( FT_Face face,
1381 CFF_SubFont subfont );
1383 T1_CMap_Classes t1_cmap_classes;
1386 const AFM_Parser_FuncsRec* afm_parser_funcs;
1388 const CFF_Decoder_FuncsRec* cff_decoder_funcs;
1390 } PSAux_ServiceRec, *PSAux_Service;
1393 typedef PSAux_ServiceRec PSAux_Interface;
1404#define IS_PS_NEWLINE( ch ) \
1408#define IS_PS_SPACE( ch ) \
1410 IS_PS_NEWLINE( ch ) || \
1415#define IS_PS_SPECIAL( ch ) \
1417 (ch) == '(' || (ch) == ')' || \
1418 (ch) == '<' || (ch) == '>' || \
1419 (ch) == '[' || (ch) == ']' || \
1420 (ch) == '{' || (ch) == '}' || \
1423#define IS_PS_DELIM( ch ) \
1424 ( IS_PS_SPACE( ch ) || \
1425 IS_PS_SPECIAL( ch ) )
1427#define IS_PS_DIGIT( ch ) \
1428 ( (ch) >= '0' && (ch) <= '9' )
1430#define IS_PS_XDIGIT( ch ) \
1431 ( IS_PS_DIGIT( ch ) || \
1432 ( (ch) >= 'A' && (ch) <= 'F' ) || \
1433 ( (ch) >= 'a' && (ch) <= 'f' ) )
1435#define IS_PS_BASE85( ch ) \
1436 ( (ch) >= '!' && (ch) <= 'u' )
1438#define IS_PS_TOKEN( cur, limit, token ) \
1439 ( (char)(cur)[0] == (token)[0] && \
1440 ( (cur) + sizeof ( (token) ) == (limit) || \
1441 ( (cur) + sizeof( (token) ) < (limit) && \
1442 IS_PS_DELIM( (cur)[sizeof ( (token) ) - 1] ) ) ) && \
1443 ft_strncmp( (char*)(cur), (token), sizeof ( (token) ) - 1 ) == 0 )