diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h index fe53a2350..c7221e06a 100644 --- a/include/freetype/internal/ftobjs.h +++ b/include/freetype/internal/ftobjs.h @@ -137,18 +137,24 @@ FT_BEGIN_HEADER } FT_ValidatorRec; + FT_BASE( void ) + ft_validator_init( FT_Validator valid, + FT_Byte* base, + FT_Byte* limit, + FT_ValidationLevel level ); + /* sets the error field in a validator, then calls 'longjmp' to return */ /* to high-level caller. Using 'setjmp/longjmp' avoids many stupid */ /* error checks within the validation routines.. */ /* */ FT_BASE( void ) - ft_validate_error( FT_Valid valid, - FT_Error error ); + ft_validator_error( FT_Validator valid, + FT_Error error ); /* calls ft_validate_error. Assumes that the 'valid' local variable holds */ /* a pointer to the current validator object.. */ /* */ -#define FT_INVALID(_error) ft_validate_error( valid, _error ) +#define FT_INVALID(_error) ft_validator_error( valid, _error ) /* called when a broken table is detected */ #define FT_INVALID_TOO_SHORT FT_INVALID( FT_Err_Invalid_Format ) @@ -206,9 +212,6 @@ FT_BEGIN_HEADER typedef void (*FT_CMap_DoneFunc)( FT_CMap cmap ); - typedef FT_Error (*FT_CMap_ValidateFunc)( FT_Pointer cmap_data, - FT_Validator valid ); - typedef FT_UInt (*FT_CMap_CharIndexFunc)( FT_Pointer cmap_data, FT_ULong char_code ); @@ -220,13 +223,24 @@ FT_BEGIN_HEADER FT_UInt size; FT_CMap_InitFunc init; FT_CMap_DoneFunc done; - FT_CMap_ValidateFunc validate; FT_CMap_CharIndexFunc char_index; FT_CMap_CharNextFunc char_next; } FT_CMap_ClassRec; + /* create a new charmap and add it to charmap->face */ + FT_BASE( FT_Error ) + FT_CMap_New( FT_CMap_Class clazz, + FT_Pointer data, + FT_CharMap charmap, + FT_CMap *acmap ); + + /* destroy a charmap (don't remove it from face's list though) */ + FT_BASE( void ) + FT_CMap_Done( FT_CMap cmap ); + + /*************************************************************************/ /* */ /* */ diff --git a/include/freetype/internal/psaux.h b/include/freetype/internal/psaux.h index 57265b7f0..f3e727139 100644 --- a/include/freetype/internal/psaux.h +++ b/include/freetype/internal/psaux.h @@ -38,13 +38,14 @@ FT_BEGIN_HEADER /*************************************************************************/ - typedef struct PS_Table_ PS_Table; + typedef struct PS_TableRec_* PS_Table; + typedef const struct PS_Table_FuncsRec_* PS_Table_Funcs; /*************************************************************************/ /* */ /* */ - /* PS_Table_Funcs */ + /* PS_Table_FuncsRec */ /* */ /* */ /* A set of function pointers to manage PS_Table objects. */ @@ -58,32 +59,32 @@ FT_BEGIN_HEADER /* */ /* table_release :: Releases table data, then finalizes it. */ /* */ - typedef struct PS_Table_Funcs_ + typedef struct PS_Table_FuncsRec_ { FT_Error - (*init)( PS_Table* table, + (*init)( PS_Table table, FT_Int count, FT_Memory memory ); void - (*done)( PS_Table* table ); + (*done)( PS_Table table ); FT_Error - (*add)( PS_Table* table, + (*add)( PS_Table table, FT_Int index, void* object, FT_Int length ); void - (*release)( PS_Table* table ); + (*release)( PS_Table table ); - } PS_Table_Funcs; + } PS_Table_FuncsRec; /*************************************************************************/ /* */ /* */ - /* PS_Table */ + /* PS_TableRec */ /* */ /* */ /* A PS_Table is a simple object used to store an array of objects in */ @@ -112,7 +113,7 @@ FT_BEGIN_HEADER /* */ /* funcs :: A table of method pointers for this object. */ /* */ - struct PS_Table_ + typedef struct PS_TableRec_ { FT_Byte* block; /* current memory block */ FT_Offset cursor; /* current cursor in memory block */ @@ -124,10 +125,10 @@ FT_BEGIN_HEADER FT_Byte** elements; /* addresses of table elements */ FT_Int* lengths; /* lengths of table elements */ - FT_Memory memory; - PS_Table_Funcs funcs; + FT_Memory memory; + PS_Table_FuncsRec funcs; - }; + } PS_TableRec; /*************************************************************************/ @@ -138,46 +139,51 @@ FT_BEGIN_HEADER /*************************************************************************/ /*************************************************************************/ - typedef struct T1_Parser_ T1_Parser; + typedef struct PS_ParserRec_* PS_Parser; + typedef struct T1_TokenRec_* T1_Token; + + typedef struct T1_FieldRec_* T1_Field; + + /* simple enumeration type used to identify token types */ typedef enum T1_Token_Type_ { - t1_token_none = 0, - t1_token_any, - t1_token_string, - t1_token_array, + T1_TOKEN_TYPE_NONE = 0, + T1_TOKEN_TYPE_ANY, + T1_TOKEN_TYPE_STRING, + T1_TOKEN_TYPE_ARRAY, /* do not remove */ - t1_token_max + T1_TOKEN_TYPE_MAX } T1_Token_Type; /* a simple structure used to identify tokens */ - typedef struct T1_Token_ + typedef struct T1_TokenRec_ { FT_Byte* start; /* first character of token in input stream */ FT_Byte* limit; /* first character after the token */ T1_Token_Type type; /* type of token */ - } T1_Token; + } T1_TokenRec; /* enumeration type used to identify object fields */ typedef enum T1_Field_Type_ { - t1_field_none = 0, - t1_field_bool, - t1_field_integer, - t1_field_fixed, - t1_field_string, - t1_field_integer_array, - t1_field_fixed_array, - t1_field_callback, + T1_FIELD_TYPE_NONE = 0, + T1_FIELD_TYPE_BOOL, + T1_FIELD_TYPE_INTEGER, + T1_FIELD_TYPE_FIXED, + T1_FIELD_TYPE_STRING, + T1_FIELD_TYPE_INTEGER_ARRAY, + T1_FIELD_TYPE_FIXED_ARRAY, + T1_FIELD_TYPE_CALLBACK, /* do not remove */ - t1_field_max + T1_FIELD_TYPE_MAX } T1_Field_Type; @@ -200,7 +206,7 @@ FT_BEGIN_HEADER /* structure type used to model object fields */ - typedef struct T1_Field_ + typedef struct T1_FieldRec_ { const char* ident; /* field identifier */ T1_Field_Location location; @@ -212,7 +218,7 @@ FT_BEGIN_HEADER /* array */ FT_UInt count_offset; /* offset of element count for */ /* arrays */ - } T1_Field; + } T1_FieldRec; #define T1_NEW_SIMPLE_FIELD( _ident, _type, _fname ) \ @@ -226,7 +232,7 @@ FT_BEGIN_HEADER #define T1_NEW_CALLBACK_FIELD( _ident, _reader ) \ { \ - _ident, T1CODE, t1_field_callback, \ + _ident, T1CODE, T1_FIELD_TYPE_CALLBACK, \ (T1_Field_Parser)_reader, \ 0, 0, \ 0, 0 \ @@ -252,32 +258,32 @@ FT_BEGIN_HEADER }, -#define T1_FIELD_BOOL( _ident, _fname ) \ - T1_NEW_SIMPLE_FIELD( _ident, t1_field_bool, _fname ) +#define T1_FIELD_TYPE_BOOL( _ident, _fname ) \ + T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_BOOL, _fname ) #define T1_FIELD_NUM( _ident, _fname ) \ - T1_NEW_SIMPLE_FIELD( _ident, t1_field_integer, _fname ) + T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_INTEGER, _fname ) #define T1_FIELD_FIXED( _ident, _fname ) \ - T1_NEW_SIMPLE_FIELD( _ident, t1_field_fixed, _fname ) + T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_FIXED, _fname ) #define T1_FIELD_STRING( _ident, _fname ) \ - T1_NEW_SIMPLE_FIELD( _ident, t1_field_string, _fname ) + T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_STRING, _fname ) #define T1_FIELD_NUM_TABLE( _ident, _fname, _fmax ) \ - T1_NEW_TABLE_FIELD( _ident, t1_field_integer_array, \ + T1_NEW_TABLE_FIELD( _ident, T1_FIELD_TYPE_INTEGER_ARRAY, \ _fname, _fmax ) #define T1_FIELD_FIXED_TABLE( _ident, _fname, _fmax ) \ - T1_NEW_TABLE_FIELD( _ident, t1_field_fixed_array, \ + T1_NEW_TABLE_FIELD( _ident, T1_FIELD_TYPE_FIXED_ARRAY, \ _fname, _fmax ) #define T1_FIELD_NUM_TABLE2( _ident, _fname, _fmax ) \ - T1_NEW_TABLE_FIELD2( _ident, t1_field_integer_array, \ + T1_NEW_TABLE_FIELD2( _ident, T1_FIELD_TYPE_INTEGER_ARRAY, \ _fname, _fmax ) #define T1_FIELD_FIXED_TABLE2( _ident, _fname, _fmax ) \ - T1_NEW_TABLE_FIELD2( _ident, t1_field_fixed_array, \ + T1_NEW_TABLE_FIELD2( _ident, T1_FIELD_TYPE_FIXED_ARRAY, \ _fname, _fmax ) #define T1_FIELD_CALLBACK( _ident, _name ) \ @@ -294,70 +300,72 @@ FT_BEGIN_HEADER /*************************************************************************/ /*************************************************************************/ - typedef struct T1_Parser_Funcs_ + typedef const struct PS_Parser_FuncsRec_* PS_Parser_Funcs; + + typedef struct PS_Parser_FuncsRec_ { void - (*init)( T1_Parser* parser, + (*init)( PS_Parser parser, FT_Byte* base, FT_Byte* limit, FT_Memory memory ); void - (*done)( T1_Parser* parser ); + (*done)( PS_Parser parser ); void - (*skip_spaces)( T1_Parser* parser ); + (*skip_spaces)( PS_Parser parser ); void - (*skip_alpha)( T1_Parser* parser ); + (*skip_alpha)( PS_Parser parser ); FT_Long - (*to_int)( T1_Parser* parser ); + (*to_int)( PS_Parser parser ); FT_Fixed - (*to_fixed)( T1_Parser* parser, + (*to_fixed)( PS_Parser parser, FT_Int power_ten ); FT_Int - (*to_coord_array)( T1_Parser* parser, + (*to_coord_array)( PS_Parser parser, FT_Int max_coords, FT_Short* coords ); FT_Int - (*to_fixed_array)( T1_Parser* parser, + (*to_fixed_array)( PS_Parser parser, FT_Int max_values, FT_Fixed* values, FT_Int power_ten ); void - (*to_token)( T1_Parser* parser, - T1_Token* token ); + (*to_token)( PS_Parser parser, + T1_Token token ); void - (*to_token_array)( T1_Parser* parser, - T1_Token* tokens, + (*to_token_array)( PS_Parser parser, + T1_Token tokens, FT_UInt max_tokens, FT_Int* pnum_tokens ); FT_Error - (*load_field)( T1_Parser* parser, - const T1_Field* field, + (*load_field)( PS_Parser parser, + const T1_Field field, void** objects, FT_UInt max_objects, FT_ULong* pflags ); FT_Error - (*load_field_table)( T1_Parser* parser, - const T1_Field* field, + (*load_field_table)( PS_Parser parser, + const T1_Field field, void** objects, FT_UInt max_objects, FT_ULong* pflags ); - } T1_Parser_Funcs; + } PS_Parser_FuncsRec; /*************************************************************************/ /* */ /* */ - /* T1_Parser */ + /* PS_ParserRec */ /* */ /* */ - /* A T1_Parser is an object used to parse a Type 1 font very quickly. */ + /* A PS_Parser is an object used to parse a Type 1 font very quickly. */ /* */ /* */ /* cursor :: The current position in the text. */ @@ -372,16 +380,17 @@ FT_BEGIN_HEADER /* */ /* funcs :: A table of functions for the parser. */ /* */ - struct T1_Parser_ + typedef struct PS_ParserRec_ { - FT_Byte* cursor; - FT_Byte* base; - FT_Byte* limit; - FT_Error error; - FT_Memory memory; + FT_Byte* cursor; + FT_Byte* base; + FT_Byte* limit; + FT_Error error; + FT_Memory memory; - T1_Parser_Funcs funcs; - }; + PS_Parser_FuncsRec funcs; + + } PS_ParserRec; @@ -567,28 +576,28 @@ FT_BEGIN_HEADER #endif /* 0 */ - typedef struct T1_Decoder_Zone_ + typedef struct T1_Decoder_ZoneRec_ { FT_Byte* cursor; FT_Byte* base; FT_Byte* limit; - } T1_Decoder_Zone; + } T1_Decoder_ZoneRec, *T1_Decoder_Zone; - typedef struct T1_Decoder_ T1_Decoder; - typedef struct T1_Decoder_Funcs_ T1_Decoder_Funcs; + typedef struct T1_DecoderRec_* T1_Decoder; + typedef const struct T1_Decoder_FuncsRec_* T1_Decoder_Funcs; typedef FT_Error - (*T1_Decoder_Callback)( T1_Decoder* decoder, - FT_UInt glyph_index ); + (*T1_Decoder_Callback)( T1_Decoder decoder, + FT_UInt glyph_index ); - struct T1_Decoder_Funcs_ + typedef struct T1_Decoder_FuncsRec_ { FT_Error - (*init) ( T1_Decoder* decoder, + (*init) ( T1_Decoder decoder, FT_Face face, FT_Size size, FT_GlyphSlot slot, @@ -598,26 +607,27 @@ FT_BEGIN_HEADER T1_Decoder_Callback callback ); void - (*done) ( T1_Decoder* decoder ); + (*done) ( T1_Decoder decoder ); FT_Error - (*parse_charstrings)( T1_Decoder* decoder, + (*parse_charstrings)( T1_Decoder decoder, FT_Byte* base, FT_UInt len ); - }; + + } T1_Decoder_FuncsRec; - struct T1_Decoder_ + typedef struct T1_DecoderRec_ { T1_Builder builder; FT_Long stack[T1_MAX_CHARSTRINGS_OPERANDS]; FT_Long* top; - T1_Decoder_Zone zones[T1_MAX_SUBRS_CALLS + 1]; - T1_Decoder_Zone* zone; + T1_Decoder_ZoneRec zones[T1_MAX_SUBRS_CALLS + 1]; + T1_Decoder_Zone zone; - PSNames_Interface* psnames; /* for seac */ + PSNames_Service psnames; /* for seac */ FT_UInt num_glyphs; FT_Byte** glyph_names; @@ -636,8 +646,9 @@ FT_BEGIN_HEADER T1_Blend* blend; /* for multiple master support */ T1_Decoder_Callback parse_callback; - T1_Decoder_Funcs funcs; - }; + T1_Decoder_FuncsRec funcs; + + } T1_DecoderRec; /*************************************************************************/ @@ -650,10 +661,10 @@ FT_BEGIN_HEADER typedef struct PSAux_Interface_ { - const PS_Table_Funcs* ps_table_funcs; - const T1_Parser_Funcs* t1_parser_funcs; + const PS_Table_Funcs ps_table_funcs; + const PS_Parser_Funcs ps_parser_funcs; const T1_Builder_Funcs* t1_builder_funcs; - const T1_Decoder_Funcs* t1_decoder_funcs; + const T1_Decoder_Funcs t1_decoder_funcs; void (*t1_decrypt)( FT_Byte* buffer, @@ -662,6 +673,7 @@ FT_BEGIN_HEADER } PSAux_Interface; + typedef PSAux_Interface* PSAux_Service; FT_END_HEADER diff --git a/include/freetype/internal/pshints.h b/include/freetype/internal/pshints.h index 87a4d806d..edec32d53 100644 --- a/include/freetype/internal/pshints.h +++ b/include/freetype/internal/pshints.h @@ -607,8 +607,9 @@ FT_BEGIN_HEADER T1_Hints_Funcs (*get_t1_funcs) ( FT_Module module ); T2_Hints_Funcs (*get_t2_funcs) ( FT_Module module ); - } PSHinter_Interface, *PSHinter_InterfacePtr; + } PSHinter_Interface; + typedef PSHinter_Interface* PSHinter_Service; FT_END_HEADER diff --git a/include/freetype/internal/psnames.h b/include/freetype/internal/psnames.h index a70b7a906..d3875bbd6 100644 --- a/include/freetype/internal/psnames.h +++ b/include/freetype/internal/psnames.h @@ -226,9 +226,12 @@ FT_BEGIN_HEADER const unsigned short* adobe_expert_encoding; PS_Next_Unicode_Func next_unicode; + } PSNames_Interface; + typedef PSNames_Interface* PSNames_Service; + FT_END_HEADER #endif /* __PSNAMES_H__ */ diff --git a/include/freetype/internal/sfnt.h b/include/freetype/internal/sfnt.h index bfcce5d55..b637c2d85 100644 --- a/include/freetype/internal/sfnt.h +++ b/include/freetype/internal/sfnt.h @@ -522,6 +522,9 @@ FT_BEGIN_HEADER } SFNT_Interface; + /* transitional */ + typedef SFNT_Interface* SFNT_Service; + FT_END_HEADER #endif /* __SFNT_H__ */ diff --git a/include/freetype/internal/tttypes.h b/include/freetype/internal/tttypes.h index 0b1efa894..f5f9802c8 100644 --- a/include/freetype/internal/tttypes.h +++ b/include/freetype/internal/tttypes.h @@ -1101,6 +1101,20 @@ FT_BEGIN_HEADER } TT_CharMapRec; + + typedef const struct TT_CMap_ClassRec_* TT_CMap_Class; + + typedef FT_Error (*TT_CMap_ValidateFunc)( FT_Byte* data, + FT_Validator valid ); + + typedef struct TT_CMap_ClassRec_ + { + FT_CMap_ClassRec clazz; + TT_CMap_ValidateFunc validate; + + } TT_CMap_ClassRec; + + /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index 5d56b2e59..27a523385 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -1374,6 +1374,76 @@ } + FT_BASE_DEF( void ) + FT_CMap_Done( FT_CMap cmap ) + { + if ( cmap ) + { + FT_CMap_Class clazz = cmap->clazz; + FT_Face face = cmap->charmap.face; + FT_Memory memory = FT_FACE_MEMORY(face); + + if ( clazz->done ) + clazz->done( cmap->data ); + + FREE( cmap ); + } + } + + + FT_BASE_DEF( FT_Error ) + FT_CMap_New( FT_CMap_Class clazz, + FT_Pointer data, + FT_CharMap charmap, + FT_CMap *acmap ) + { + FT_Error error = 0; + FT_Face face; + FT_Memory memory; + FT_CMap cmap; + + if ( clazz == NULL || charmap == NULL || charmap->face == NULL ) + return FT_Err_Invalid_Argument; + + face = charmap->face; + memory = FT_FACE_MEMORY(face); + + if ( !ALLOC( cmap, clazz->size ) ) + { + cmap->charmap = *charmap; + cmap->clazz = clazz; + cmap->data = data; + + if ( clazz->init ) + { + error = clazz->init( cmap, data ); + if (error) + goto Fail; + } + + /* add it to our list of charmaps */ + if ( REALLOC_ARRAY( face->charmaps, + face->num_charmaps, + face->num_charmaps+1, + FT_CharMap* ) ) + goto Fail; + + face->charmaps[ face->num_charmaps++ ] = (FT_CharMap) cmap; + } + + Exit: + if ( acmap ) + *acmap = cmap; + + return error; + + Fail: + FT_CMap_Done( cmap ); + cmap = NULL; + goto Exit; + } + + /* documentation is in freetype.h */ FT_EXPORT_DEF( FT_UInt ) diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c index 24e4200b5..84d295ac8 100644 --- a/src/cff/cffdrivr.c +++ b/src/cff/cffdrivr.c @@ -22,6 +22,7 @@ #include FT_INTERNAL_STREAM_H #include FT_INTERNAL_SFNT_H #include FT_TRUETYPE_IDS_H +#include FT_INTERNAL_POSTSCRIPT_NAMES_H #include "cffdrivr.h" #include "cffgload.h" @@ -231,10 +232,10 @@ FT_Memory memory = FT_FACE_MEMORY( face ); FT_String* gname; FT_UShort sid; - PSNames_Interface* psnames; + PSNames_Service psnames; FT_Error error; - psnames = (PSNames_Interface*)FT_Get_Module_Interface( + psnames = (PSNames_Service)FT_Get_Module_Interface( face->root.driver->root.library, "psnames" ); if ( !psnames ) @@ -303,7 +304,7 @@ /* Load table if needed */ if ( !cmap->loaded ) { - SFNT_Interface* sfnt = (SFNT_Interface*)face->sfnt; + SFNT_Service sfnt = (SFNT_Service)face->sfnt; error = sfnt->load_charmap( face, cmap, face->root.stream ); @@ -347,7 +348,7 @@ /* Load table if needed */ if ( !cmap->loaded ) { - SFNT_Interface* sfnt = (SFNT_Interface*)face->sfnt; + SFNT_Service sfnt = (SFNT_Service)face->sfnt; error = sfnt->load_charmap( face, cmap, face->root.stream ); @@ -382,20 +383,20 @@ cff_get_name_index( CFF_Face face, FT_String* glyph_name ) { - CFF_Font* cff; - CFF_Charset* charset; - PSNames_Interface* psnames; - FT_Memory memory = FT_FACE_MEMORY( face ); - FT_String* name; - FT_UShort sid; - FT_UInt i; - FT_Int result; + CFF_Font* cff; + CFF_Charset* charset; + PSNames_Service psnames; + FT_Memory memory = FT_FACE_MEMORY( face ); + FT_String* name; + FT_UShort sid; + FT_UInt i; + FT_Int result; cff = face->extra.data; charset = &cff->charset; - psnames = (PSNames_Interface*)FT_Get_Module_Interface( + psnames = (PSNames_Service)FT_Get_Module_Interface( face->root.driver->root.library, "psnames" ); for ( i = 0; i < cff->num_glyphs; i++ ) @@ -405,7 +406,7 @@ if ( sid > 390 ) name = CFF_Get_Name( &cff->string_index, sid - 391 ); else - name = (FT_String *)psnames->adobe_std_strings( sid ); + name = (FT_String *) psnames->adobe_std_strings( sid ); result = strcmp( glyph_name, name ); diff --git a/src/cff/cffload.c b/src/cff/cffload.c index 155bba4a9..f002071d7 100644 --- a/src/cff/cffload.c +++ b/src/cff/cffload.c @@ -1313,7 +1313,7 @@ FT_LOCAL_DEF FT_String* CFF_Get_String( CFF_Index* index, FT_UInt sid, - PSNames_Interface* interface ) + PSNames_Service interface ) { /* if it is not a standard string, return it */ if ( sid > 390 ) diff --git a/src/cff/cffload.h b/src/cff/cffload.h index eedabc33b..329c709c8 100644 --- a/src/cff/cffload.h +++ b/src/cff/cffload.h @@ -38,7 +38,7 @@ FT_BEGIN_HEADER FT_LOCAL FT_String* CFF_Get_String( CFF_Index* index, FT_UInt sid, - PSNames_Interface* interface ); + PSNames_Service interface ); FT_LOCAL FT_Error diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c index a8698397d..e4a468e1d 100644 --- a/src/cff/cffobjs.c +++ b/src/cff/cffobjs.c @@ -59,10 +59,10 @@ static PSH_Globals_Funcs CFF_Size_Get_Globals_Funcs( CFF_Size size ) { - CFF_Face face = (CFF_Face)size->face; - CFF_Font* font = face->extra.data; - PSHinter_Interface* pshinter = font->pshinter; - FT_Module module; + CFF_Face face = (CFF_Face)size->face; + CFF_Font* font = face->extra.data; + PSHinter_Service pshinter = font->pshinter; + FT_Module module; module = FT_Get_Module( size->face->driver->root.library, @@ -197,7 +197,7 @@ { CFF_Face face = (CFF_Face)slot->root.face; CFF_Font* font = face->extra.data; - PSHinter_Interface* pshinter = font->pshinter; + PSHinter_Service pshinter = font->pshinter; if ( pshinter ) @@ -255,7 +255,7 @@ static FT_Error CFF_Build_Unicode_Charmap( CFF_Face face, FT_ULong base_offset, - PSNames_Interface* psnames ) + PSNames_Service psnames ) { CFF_Font* font = (CFF_Font*)face->extra.data; FT_Memory memory = FT_FACE_MEMORY(face); @@ -449,22 +449,22 @@ FT_Parameter* params ) { FT_Error error; - SFNT_Interface* sfnt; - PSNames_Interface* psnames; - PSHinter_Interface* pshinter; + SFNT_Service sfnt; + PSNames_Service psnames; + PSHinter_Service pshinter; FT_Bool pure_cff = 1; FT_Bool sfnt_format = 0; - sfnt = (SFNT_Interface*)FT_Get_Module_Interface( + sfnt = (SFNT_Service)FT_Get_Module_Interface( face->root.driver->root.library, "sfnt" ); if ( !sfnt ) goto Bad_Format; - psnames = (PSNames_Interface*)FT_Get_Module_Interface( + psnames = (PSNames_Service)FT_Get_Module_Interface( face->root.driver->root.library, "psnames" ); - pshinter = (PSHinter_Interface*)FT_Get_Module_Interface( + pshinter = (PSHinter_Service)FT_Get_Module_Interface( face->root.driver->root.library, "pshinter" ); /* create input stream from resource */ @@ -704,7 +704,7 @@ CFF_Face_Done( CFF_Face face ) { FT_Memory memory = face->root.memory; - SFNT_Interface* sfnt = (SFNT_Interface*)face->sfnt; + SFNT_Service sfnt = (SFNT_Service)face->sfnt; if ( sfnt ) diff --git a/src/cid/cidgload.c b/src/cid/cidgload.c index e7a70e8a4..f2011620d 100644 --- a/src/cid/cidgload.c +++ b/src/cid/cidgload.c @@ -37,8 +37,8 @@ FT_CALLBACK_DEF( FT_Error ) - cid_load_glyph( T1_Decoder* decoder, - FT_UInt glyph_index ) + cid_load_glyph( T1_Decoder decoder, + FT_UInt glyph_index ) { CID_Face face = (CID_Face)decoder->builder.face; CID_Info* cid = &face->cid; @@ -143,10 +143,10 @@ FT_Int* max_advance ) { FT_Error error; - T1_Decoder decoder; + T1_DecoderRec decoder; FT_Int glyph_index; - PSAux_Interface* psaux = (PSAux_Interface*)face->psaux; + PSAux_Service psaux = (PSAux_Service)face->psaux; *max_advance = 0; @@ -208,13 +208,13 @@ FT_Int load_flags ) { FT_Error error; - T1_Decoder decoder; + T1_DecoderRec decoder; CID_Face face = (CID_Face)glyph->root.face; FT_Bool hinting; - PSAux_Interface* psaux = (PSAux_Interface*)face->psaux; - FT_Matrix font_matrix; - FT_Vector font_offset; + PSAux_Service psaux = (PSAux_Service)face->psaux; + FT_Matrix font_matrix; + FT_Vector font_offset; if ( load_flags & FT_LOAD_NO_RECURSE ) diff --git a/src/cid/cidload.c b/src/cid/cidload.c index 561129198..1aea67e13 100644 --- a/src/cid/cidload.c +++ b/src/cid/cidload.c @@ -90,7 +90,7 @@ static FT_Error cid_load_keyword( CID_Face face, CID_Loader* loader, - const T1_Field* keyword ) + const T1_Field keyword ) { FT_Error error; CID_Parser* parser = &loader->parser; @@ -100,7 +100,7 @@ /* if the keyword has a dedicated callback, call it */ - if ( keyword->type == t1_field_callback ) + if ( keyword->type == T1_FIELD_TYPE_CALLBACK ) { keyword->reader( (FT_Face)face, parser ); error = parser->root.error; @@ -147,8 +147,8 @@ dummy_object = object; /* now, load the keyword data in the object's field(s) */ - if ( keyword->type == t1_field_integer_array || - keyword->type == t1_field_fixed_array ) + if ( keyword->type == T1_FIELD_TYPE_INTEGER_ARRAY || + keyword->type == T1_FIELD_TYPE_FIXED_ARRAY ) error = CID_Load_Field_Table( &loader->parser, keyword, &dummy_object ); else @@ -270,7 +270,7 @@ static - const T1_Field cid_field_records[] = + const T1_FieldRec cid_field_records[] = { #include "cidtoken.h" @@ -278,7 +278,7 @@ T1_FIELD_CALLBACK( "FontBBox", parse_font_bbox ) T1_FIELD_CALLBACK( "FDArray", parse_fd_array ) T1_FIELD_CALLBACK( "FontMatrix", parse_font_matrix ) - { 0, t1_field_cid_info, t1_field_none, 0, 0, 0, 0, 0 } + { 0, t1_field_cid_info, T1_FIELD_TYPE_NONE, 0, 0, 0, 0, 0 } }; @@ -339,7 +339,7 @@ if ( len > 0 && len < 22 ) { /* now compare the immediate name to the keyword table */ - const T1_Field* keyword = cid_field_records; + T1_Field keyword = (T1_Field) cid_field_records; for (;;) @@ -527,7 +527,7 @@ parser = &loader.parser; error = CID_New_Parser( parser, face->root.stream, face->root.memory, - (PSAux_Interface*)face->psaux ); + (PSAux_Service)face->psaux ); if ( error ) goto Exit; diff --git a/src/cid/cidobjs.c b/src/cid/cidobjs.c index c42d0e881..dee607a38 100644 --- a/src/cid/cidobjs.c +++ b/src/cid/cidobjs.c @@ -55,7 +55,7 @@ CID_GlyphSlot_Init( CID_GlyphSlot slot ) { CID_Face face; - PSHinter_Interface* pshinter; + PSHinter_Service pshinter; face = (CID_Face) slot->root.face; @@ -93,7 +93,7 @@ CID_Size_Get_Globals_Funcs( CID_Size size ) { CID_Face face = (CID_Face)size->root.face; - PSHinter_Interface* pshinter = face->pshinter; + PSHinter_Service pshinter = face->pshinter; FT_Module module; @@ -270,9 +270,9 @@ FT_Parameter* params ) { FT_Error error; - PSNames_Interface* psnames; - PSAux_Interface* psaux; - PSHinter_Interface* pshinter; + PSNames_Service psnames; + PSAux_Service psaux; + PSHinter_Service pshinter; FT_UNUSED( num_params ); FT_UNUSED( params ); @@ -282,28 +282,28 @@ face->root.num_faces = 1; - psnames = (PSNames_Interface*)face->psnames; + psnames = (PSNames_Service)face->psnames; if ( !psnames ) { - psnames = (PSNames_Interface*)FT_Get_Module_Interface( + psnames = (PSNames_Service)FT_Get_Module_Interface( FT_FACE_LIBRARY( face ), "psnames" ); face->psnames = psnames; } - psaux = (PSAux_Interface*)face->psaux; + psaux = (PSAux_Service)face->psaux; if ( !psaux ) { - psaux = (PSAux_Interface*)FT_Get_Module_Interface( + psaux = (PSAux_Service)FT_Get_Module_Interface( FT_FACE_LIBRARY( face ), "psaux" ); face->psaux = psaux; } - pshinter = (PSHinter_Interface*)face->pshinter; + pshinter = (PSHinter_Service)face->pshinter; if ( !pshinter ) { - pshinter = (PSHinter_Interface*)FT_Get_Module_Interface( + pshinter = (PSHinter_Service)FT_Get_Module_Interface( FT_FACE_LIBRARY( face ), "pshinter" ); face->pshinter = pshinter; @@ -436,7 +436,7 @@ /* module */ if ( face->psnames ) { - PSNames_Interface* psnames = (PSNames_Interface*)face->psnames; + PSNames_Service psnames = (PSNames_Service)face->psnames; if ( psnames->unicode_value ) diff --git a/src/cid/cidparse.c b/src/cid/cidparse.c index f87e09d31..2f4b08caa 100644 --- a/src/cid/cidparse.c +++ b/src/cid/cidparse.c @@ -54,7 +54,7 @@ CID_New_Parser( CID_Parser* parser, FT_Stream stream, FT_Memory memory, - PSAux_Interface* psaux ) + PSAux_Service psaux ) { FT_Error error; FT_ULong base_offset, offset, ps_len; @@ -63,7 +63,7 @@ MEM_Set( parser, 0, sizeof ( *parser ) ); - psaux->t1_parser_funcs->init( &parser->root, 0, 0, memory ); + psaux->ps_parser_funcs->init( &parser->root, 0, 0, memory ); parser->stream = stream; diff --git a/src/cid/cidparse.h b/src/cid/cidparse.h index a2bd1fa44..813af00c2 100644 --- a/src/cid/cidparse.h +++ b/src/cid/cidparse.h @@ -39,7 +39,7 @@ FT_BEGIN_HEADER /* quickly. */ /* */ /* */ - /* root :: the root T1_Parser fields */ + /* root :: the root PS_ParserRec fields */ /* */ /* stream :: The current input stream. */ /* */ @@ -57,16 +57,16 @@ FT_BEGIN_HEADER /* */ typedef struct CID_Parser_ { - T1_Parser root; - FT_Stream stream; + PS_ParserRec root; + FT_Stream stream; - FT_Byte* postscript; - FT_Int postscript_len; + FT_Byte* postscript; + FT_Int postscript_len; - FT_ULong data_offset; + FT_ULong data_offset; - CID_Info* cid; - FT_Int num_dict; + CID_Info* cid; + FT_Int num_dict; } CID_Parser; @@ -75,7 +75,7 @@ FT_BEGIN_HEADER CID_New_Parser( CID_Parser* parser, FT_Stream stream, FT_Memory memory, - PSAux_Interface* psaux ); + PSAux_Service psaux ); FT_LOCAL void CID_Done_Parser( CID_Parser* parser ); diff --git a/src/cid/cidriver.c b/src/cid/cidriver.c index 21f0594b1..8f726549a 100644 --- a/src/cid/cidriver.c +++ b/src/cid/cidriver.c @@ -107,11 +107,11 @@ { T1_Face face; FT_UInt result = 0; - PSNames_Interface* psnames; + PSNames_Service psnames; face = (T1_Face)charmap->face; - psnames = (PSNames_Interface*)face->psnames; + psnames = (PSNames_Service)face->psnames; if ( psnames ) switch ( charmap->encoding ) { @@ -206,11 +206,11 @@ FT_Long charcode ) { T1_Face face; - PSNames_Interface* psnames; + PSNames_Service psnames; face = (T1_Face)charmap->face; - psnames = (PSNames_Interface*)face->psnames; + psnames = (PSNames_Service)face->psnames; if ( psnames ) switch ( charmap->encoding ) diff --git a/src/cid/cidtoken.h b/src/cid/cidtoken.h index 487355d9d..50b5c56b5 100644 --- a/src/cid/cidtoken.h +++ b/src/cid/cidtoken.h @@ -45,7 +45,7 @@ T1_FIELD_STRING( "FamilyName", family_name ) T1_FIELD_STRING( "Weight", weight ) T1_FIELD_FIXED ( "ItalicAngle", italic_angle ) - T1_FIELD_BOOL ( "isFixedPitch", is_fixed_pitch ) + T1_FIELD_TYPE_BOOL ( "isFixedPitch", is_fixed_pitch ) T1_FIELD_NUM ( "UnderlinePosition", underline_position ) T1_FIELD_NUM ( "UnderlineThickness", underline_thickness ) diff --git a/src/psaux/psauxmod.c b/src/psaux/psauxmod.c index 559f9d036..72a9b8251 100644 --- a/src/psaux/psauxmod.c +++ b/src/psaux/psauxmod.c @@ -23,7 +23,7 @@ FT_CALLBACK_TABLE_DEF - const PS_Table_Funcs ps_table_funcs = + const PS_Table_FuncsRec ps_table_funcs = { PS_Table_New, PS_Table_Done, @@ -33,20 +33,20 @@ FT_CALLBACK_TABLE_DEF - const T1_Parser_Funcs t1_parser_funcs = + const PS_Parser_FuncsRec ps_parser_funcs = { - T1_Init_Parser, - T1_Done_Parser, - T1_Skip_Spaces, - T1_Skip_Alpha, - T1_ToInt, - T1_ToFixed, - T1_ToCoordArray, - T1_ToFixedArray, - T1_ToToken, - T1_ToTokenArray, - T1_Load_Field, - T1_Load_Field_Table + PS_Parser_Init, + PS_Parser_Done, + PS_Parser_SkipSpaces, + PS_Parser_SkipAlpha, + PS_Parser_ToInt, + PS_Parser_ToFixed, + PS_Parser_ToCoordArray, + PS_Parser_ToFixedArray, + PS_Parser_ToToken, + PS_Parser_ToTokenArray, + PS_Parser_LoadField, + PS_Parser_LoadFieldTable }; @@ -65,7 +65,7 @@ FT_CALLBACK_TABLE_DEF - const T1_Decoder_Funcs t1_decoder_funcs = + const T1_Decoder_FuncsRec t1_decoder_funcs = { T1_Decoder_Init, T1_Decoder_Done, @@ -77,7 +77,7 @@ const PSAux_Interface psaux_interface = { &ps_table_funcs, - &t1_parser_funcs, + &ps_parser_funcs, &t1_builder_funcs, &t1_decoder_funcs, diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c index 4856b217d..68cd4eef0 100644 --- a/src/psaux/psobjs.c +++ b/src/psaux/psobjs.c @@ -54,7 +54,7 @@ /* FreeType error code. 0 means success. */ /* */ FT_LOCAL_DEF FT_Error - PS_Table_New( PS_Table* table, + PS_Table_New( PS_Table table, FT_Int count, FT_Memory memory ) { @@ -72,7 +72,8 @@ table->block = 0; table->capacity = 0; table->cursor = 0; - table->funcs = ps_table_funcs; + + *(PS_Table_FuncsRec*)&table->funcs = ps_table_funcs; Exit: if ( error ) @@ -83,7 +84,7 @@ static void - shift_elements( PS_Table* table, + shift_elements( PS_Table table, FT_Byte* old_base ) { FT_Long delta = (FT_Long)( table->block - old_base ); @@ -100,7 +101,7 @@ static FT_Error - reallocate_t1_table( PS_Table* table, + reallocate_t1_table( PS_Table table, FT_Int new_size ) { FT_Memory memory = table->memory; @@ -132,7 +133,7 @@ /* PS_Table_Add */ /* */ /* */ - /* Adds an object to a PS_Table, possibly growing its memory block. */ + /* Adds an object to a PS_TableRec, possibly growing its memory block. */ /* */ /* */ /* table :: The target table. */ @@ -149,7 +150,7 @@ /* reallocation fails. */ /* */ FT_LOCAL_DEF FT_Error - PS_Table_Add( PS_Table* table, + PS_Table_Add( PS_Table table, FT_Int index, void* object, FT_Int length ) @@ -199,7 +200,7 @@ /* PS_Table_Done */ /* */ /* */ - /* Finalizes a PS_Table (i.e., reallocate it to its current cursor). */ + /* Finalizes a PS_TableRec (i.e., reallocate it to its current cursor). */ /* */ /* */ /* table :: The target table. */ @@ -209,7 +210,7 @@ /* to the caller to clean it, or reference it in its own structures. */ /* */ FT_LOCAL_DEF void - PS_Table_Done( PS_Table* table ) + PS_Table_Done( PS_Table table ) { FT_Memory memory = table->memory; FT_Error error; @@ -233,7 +234,7 @@ FT_LOCAL_DEF void - PS_Table_Release( PS_Table* table ) + PS_Table_Release( PS_Table table ) { FT_Memory memory = table->memory; @@ -264,7 +265,7 @@ FT_LOCAL_DEF void - T1_Skip_Spaces( T1_Parser* parser ) + PS_Parser_SkipSpaces( PS_Parser parser ) { FT_Byte* cur = parser->cursor; FT_Byte* limit = parser->limit; @@ -284,7 +285,7 @@ FT_LOCAL_DEF void - T1_Skip_Alpha( T1_Parser* parser ) + PS_Parser_SkipAlpha( PS_Parser parser ) { FT_Byte* cur = parser->cursor; FT_Byte* limit = parser->limit; @@ -304,8 +305,8 @@ FT_LOCAL_DEF void - T1_ToToken( T1_Parser* parser, - T1_Token* token ) + PS_Parser_ToToken( PS_Parser parser, + T1_Token token ) { FT_Byte* cur; FT_Byte* limit; @@ -313,12 +314,12 @@ FT_Int embed; - token->type = t1_token_none; + token->type = T1_TOKEN_TYPE_NONE; token->start = 0; token->limit = 0; /* first of all, skip space */ - T1_Skip_Spaces( parser ); + PS_Parser_SkipSpaces( parser ); cur = parser->cursor; limit = parser->limit; @@ -329,19 +330,19 @@ { /************* check for strings ***********************/ case '(': - token->type = t1_token_string; + token->type = T1_TOKEN_TYPE_STRING; ender = ')'; goto Lookup_Ender; /************* check for programs/array ****************/ case '{': - token->type = t1_token_array; + token->type = T1_TOKEN_TYPE_ARRAY; ender = '}'; goto Lookup_Ender; /************* check for table/array ******************/ case '[': - token->type = t1_token_array; + token->type = T1_TOKEN_TYPE_ARRAY; ender = ']'; Lookup_Ender: @@ -368,7 +369,7 @@ /* **************** otherwise, it's any token **********/ default: token->start = cur++; - token->type = t1_token_any; + token->type = T1_TOKEN_TYPE_ANY; while ( cur < limit && !IS_T1_SPACE( *cur ) ) cur++; @@ -378,7 +379,7 @@ if ( !token->limit ) { token->start = 0; - token->type = t1_token_none; + token->type = T1_TOKEN_TYPE_NONE; } parser->cursor = cur; @@ -387,23 +388,23 @@ FT_LOCAL_DEF void - T1_ToTokenArray( T1_Parser* parser, - T1_Token* tokens, + PS_Parser_ToTokenArray( PS_Parser parser, + T1_Token tokens, FT_UInt max_tokens, FT_Int* pnum_tokens ) { - T1_Token master; + T1_TokenRec master; *pnum_tokens = -1; - T1_ToToken( parser, &master ); - if ( master.type == t1_token_array ) + PS_Parser_ToToken( parser, &master ); + if ( master.type == T1_TOKEN_TYPE_ARRAY ) { FT_Byte* old_cursor = parser->cursor; FT_Byte* old_limit = parser->limit; - T1_Token* cur = tokens; - T1_Token* limit = cur + max_tokens; + T1_Token cur = tokens; + T1_Token limit = cur + max_tokens; parser->cursor = master.start; @@ -411,10 +412,10 @@ while ( parser->cursor < parser->limit ) { - T1_Token token; + T1_TokenRec token; - T1_ToToken( parser, &token ); + PS_Parser_ToToken( parser, &token ); if ( !token.type ) break; @@ -783,13 +784,13 @@ /* Load a simple field (i.e. non-table) into the current list of objects */ FT_LOCAL_DEF FT_Error - T1_Load_Field( T1_Parser* parser, - const T1_Field* field, + PS_Parser_LoadField( PS_Parser parser, + const T1_Field field, void** objects, FT_UInt max_objects, FT_ULong* pflags ) { - T1_Token token; + T1_TokenRec token; FT_Byte* cur; FT_Byte* limit; FT_UInt count; @@ -797,7 +798,7 @@ FT_Error error; - T1_ToToken( parser, &token ); + PS_Parser_ToToken( parser, &token ); if ( !token.type ) goto Fail; @@ -806,7 +807,7 @@ cur = token.start; limit = token.limit; - if ( token.type == t1_token_array ) + if ( token.type == T1_TOKEN_TYPE_ARRAY ) { /* if this is an array, and we have no blend, an error occurs */ if ( max_objects == 0 ) @@ -825,15 +826,15 @@ switch ( field->type ) { - case t1_field_bool: + case T1_FIELD_TYPE_BOOL: val = t1_tobool( &cur, limit ); goto Store_Integer; - case t1_field_fixed: + case T1_FIELD_TYPE_FIXED: val = t1_tofixed( &cur, limit, 3 ); goto Store_Integer; - case t1_field_integer: + case T1_FIELD_TYPE_INTEGER: val = t1_toint( &cur, limit ); Store_Integer: @@ -856,7 +857,7 @@ } break; - case t1_field_string: + case T1_FIELD_TYPE_STRING: { FT_Memory memory = parser->memory; FT_UInt len = (FT_UInt)( limit - cur ); @@ -904,27 +905,27 @@ FT_LOCAL_DEF FT_Error - T1_Load_Field_Table( T1_Parser* parser, - const T1_Field* field, + PS_Parser_LoadFieldTable( PS_Parser parser, + const T1_Field field, void** objects, FT_UInt max_objects, FT_ULong* pflags ) { - T1_Token elements[T1_MAX_TABLE_ELEMENTS]; - T1_Token* token; + T1_TokenRec elements[T1_MAX_TABLE_ELEMENTS]; + T1_Token token; FT_Int num_elements; FT_Error error = 0; FT_Byte* old_cursor; FT_Byte* old_limit; - T1_Field fieldrec = *(T1_Field*)field; + T1_FieldRec fieldrec = *(T1_Field)field; #if 1 - fieldrec.type = t1_field_integer; - if ( field->type == t1_field_fixed_array ) - fieldrec.type = t1_field_fixed; + fieldrec.type = T1_FIELD_TYPE_INTEGER; + if ( field->type == T1_FIELD_TYPE_FIXED_ARRAY ) + fieldrec.type = T1_FIELD_TYPE_FIXED; #endif - T1_ToTokenArray( parser, elements, 32, &num_elements ); + PS_Parser_ToTokenArray( parser, elements, 32, &num_elements ); if ( num_elements < 0 ) goto Fail; @@ -944,7 +945,7 @@ { parser->cursor = token->start; parser->limit = token->limit; - T1_Load_Field( parser, &fieldrec, objects, max_objects, 0 ); + PS_Parser_LoadField( parser, &fieldrec, objects, max_objects, 0 ); fieldrec.offset += fieldrec.size; } @@ -968,14 +969,14 @@ FT_LOCAL_DEF FT_Long - T1_ToInt( T1_Parser* parser ) + PS_Parser_ToInt( PS_Parser parser ) { return t1_toint( &parser->cursor, parser->limit ); } FT_LOCAL_DEF FT_Fixed - T1_ToFixed( T1_Parser* parser, + PS_Parser_ToFixed( PS_Parser parser, FT_Int power_ten ) { return t1_tofixed( &parser->cursor, parser->limit, power_ten ); @@ -983,7 +984,7 @@ FT_LOCAL_DEF FT_Int - T1_ToCoordArray( T1_Parser* parser, + PS_Parser_ToCoordArray( PS_Parser parser, FT_Int max_coords, FT_Short* coords ) { @@ -993,7 +994,7 @@ FT_LOCAL_DEF FT_Int - T1_ToFixedArray( T1_Parser* parser, + PS_Parser_ToFixedArray( PS_Parser parser, FT_Int max_values, FT_Fixed* values, FT_Int power_ten ) @@ -1006,14 +1007,14 @@ #if 0 FT_LOCAL_DEF FT_String* - T1_ToString( T1_Parser* parser ) + T1_ToString( PS_Parser parser ) { return t1_tostring( &parser->cursor, parser->limit, parser->memory ); } FT_LOCAL_DEF FT_Bool - T1_ToBool( T1_Parser* parser ) + T1_ToBool( PS_Parser parser ) { return t1_tobool( &parser->cursor, parser->limit ); } @@ -1022,7 +1023,7 @@ FT_LOCAL_DEF void - T1_Init_Parser( T1_Parser* parser, + PS_Parser_Init( PS_Parser parser, FT_Byte* base, FT_Byte* limit, FT_Memory memory ) @@ -1032,12 +1033,12 @@ parser->limit = limit; parser->cursor = base; parser->memory = memory; - parser->funcs = t1_parser_funcs; + parser->funcs = ps_parser_funcs; } FT_LOCAL_DEF void - T1_Done_Parser( T1_Parser* parser ) + PS_Parser_Done( PS_Parser parser ) { FT_UNUSED( parser ); } diff --git a/src/psaux/psobjs.h b/src/psaux/psobjs.h index 16dfe5c89..84cd0b90e 100644 --- a/src/psaux/psobjs.h +++ b/src/psaux/psobjs.h @@ -37,32 +37,32 @@ FT_BEGIN_HEADER FT_CALLBACK_TABLE - const PS_Table_Funcs ps_table_funcs; + const PS_Table_FuncsRec ps_table_funcs; FT_CALLBACK_TABLE - const T1_Parser_Funcs t1_parser_funcs; + const PS_Parser_FuncsRec ps_parser_funcs; FT_CALLBACK_TABLE - const T1_Builder_Funcs t1_builder_funcs; + const T1_Builder_Funcs t1_builder_funcs; FT_LOCAL FT_Error - PS_Table_New( PS_Table* table, + PS_Table_New( PS_Table table, FT_Int count, FT_Memory memory ); FT_LOCAL FT_Error - PS_Table_Add( PS_Table* table, + PS_Table_Add( PS_Table table, FT_Int index, void* object, FT_Int length ); FT_LOCAL void - PS_Table_Done( PS_Table* table ); + PS_Table_Done( PS_Table table ); FT_LOCAL void - PS_Table_Release( PS_Table* table ); + PS_Table_Release( PS_Table table ); /*************************************************************************/ @@ -75,64 +75,64 @@ FT_BEGIN_HEADER FT_LOCAL void - T1_Skip_Spaces( T1_Parser* parser ); + PS_Parser_SkipSpaces( PS_Parser parser ); FT_LOCAL void - T1_Skip_Alpha( T1_Parser* parser ); + PS_Parser_SkipAlpha( PS_Parser parser ); FT_LOCAL void - T1_ToToken( T1_Parser* parser, - T1_Token* token ); + PS_Parser_ToToken( PS_Parser parser, + T1_Token token ); FT_LOCAL void - T1_ToTokenArray( T1_Parser* parser, - T1_Token* tokens, + PS_Parser_ToTokenArray( PS_Parser parser, + T1_Token tokens, FT_UInt max_tokens, FT_Int* pnum_tokens ); FT_LOCAL FT_Error - T1_Load_Field( T1_Parser* parser, - const T1_Field* field, + PS_Parser_LoadField( PS_Parser parser, + const T1_Field field, void** objects, FT_UInt max_objects, FT_ULong* pflags ); FT_LOCAL FT_Error - T1_Load_Field_Table( T1_Parser* parser, - const T1_Field* field, + PS_Parser_LoadFieldTable( PS_Parser parser, + const T1_Field field, void** objects, FT_UInt max_objects, FT_ULong* pflags ); FT_LOCAL FT_Long - T1_ToInt( T1_Parser* parser ); + PS_Parser_ToInt( PS_Parser parser ); FT_LOCAL FT_Fixed - T1_ToFixed( T1_Parser* parser, + PS_Parser_ToFixed( PS_Parser parser, FT_Int power_ten ); FT_LOCAL FT_Int - T1_ToCoordArray( T1_Parser* parser, + PS_Parser_ToCoordArray( PS_Parser parser, FT_Int max_coords, FT_Short* coords ); FT_LOCAL FT_Int - T1_ToFixedArray( T1_Parser* parser, + PS_Parser_ToFixedArray( PS_Parser parser, FT_Int max_values, FT_Fixed* values, FT_Int power_ten ); FT_LOCAL void - T1_Init_Parser( T1_Parser* parser, + PS_Parser_Init( PS_Parser parser, FT_Byte* base, FT_Byte* limit, FT_Memory memory ); FT_LOCAL void - T1_Done_Parser( T1_Parser* parser ); + PS_Parser_Done( PS_Parser parser ); /*************************************************************************/ diff --git a/src/psaux/t1decode.c b/src/psaux/t1decode.c index fcd5cc93e..32a9b5d58 100644 --- a/src/psaux/t1decode.c +++ b/src/psaux/t1decode.c @@ -121,12 +121,12 @@ /* glyph wasn't found. */ /* */ static FT_Int - t1_lookup_glyph_by_stdcharcode( T1_Decoder* decoder, + t1_lookup_glyph_by_stdcharcode( T1_Decoder decoder, FT_Int charcode ) { FT_UInt n; const FT_String* glyph_name; - PSNames_Interface* psnames = decoder->psnames; + PSNames_Service psnames = decoder->psnames; /* check range of standard char code */ @@ -175,7 +175,7 @@ /* FreeType error code. 0 means success. */ /* */ static FT_Error - t1operator_seac( T1_Decoder* decoder, + t1operator_seac( T1_Decoder decoder, FT_Pos asb, FT_Pos adx, FT_Pos ady, @@ -331,12 +331,12 @@ /* FreeType error code. 0 means success. */ /* */ FT_LOCAL_DEF FT_Error - T1_Decoder_Parse_Charstrings( T1_Decoder* decoder, + T1_Decoder_Parse_Charstrings( T1_Decoder decoder, FT_Byte* charstring_base, FT_UInt charstring_len ) { FT_Error error; - T1_Decoder_Zone* zone; + T1_Decoder_Zone zone; FT_Byte* ip; FT_Byte* limit; T1_Builder* builder = &decoder->builder; @@ -1098,7 +1098,7 @@ /* parse a single Type 1 glyph */ FT_LOCAL_DEF FT_Error - T1_Decoder_Parse_Glyph( T1_Decoder* decoder, + T1_Decoder_Parse_Glyph( T1_Decoder decoder, FT_UInt glyph ) { return decoder->parse_callback( decoder, glyph ); @@ -1107,7 +1107,7 @@ /* initialise T1 decoder */ FT_LOCAL_DEF FT_Error - T1_Decoder_Init( T1_Decoder* decoder, + T1_Decoder_Init( T1_Decoder decoder, FT_Face face, FT_Size size, FT_GlyphSlot slot, @@ -1120,10 +1120,10 @@ /* retrieve PSNames interface from list of current modules */ { - PSNames_Interface* psnames = 0; + PSNames_Service psnames = 0; - psnames = (PSNames_Interface*)FT_Get_Module_Interface( + psnames = (PSNames_Service)FT_Get_Module_Interface( FT_FACE_LIBRARY(face), "psnames" ); if ( !psnames ) { @@ -1149,7 +1149,7 @@ /* finalize T1 decoder */ FT_LOCAL_DEF void - T1_Decoder_Done( T1_Decoder* decoder ) + T1_Decoder_Done( T1_Decoder decoder ) { T1_Builder_Done( &decoder->builder ); } diff --git a/src/psaux/t1decode.h b/src/psaux/t1decode.h index fd5887060..500291f6f 100644 --- a/src/psaux/t1decode.h +++ b/src/psaux/t1decode.h @@ -30,20 +30,20 @@ FT_BEGIN_HEADER FT_CALLBACK_TABLE - const T1_Decoder_Funcs t1_decoder_funcs; + const T1_Decoder_FuncsRec t1_decoder_funcs; FT_LOCAL FT_Error - T1_Decoder_Parse_Glyph( T1_Decoder* decoder, + T1_Decoder_Parse_Glyph( T1_Decoder decoder, FT_UInt glyph_index ); FT_LOCAL FT_Error - T1_Decoder_Parse_Charstrings( T1_Decoder* decoder, + T1_Decoder_Parse_Charstrings( T1_Decoder decoder, FT_Byte* base, FT_UInt len ); FT_LOCAL FT_Error - T1_Decoder_Init( T1_Decoder* decoder, + T1_Decoder_Init( T1_Decoder decoder, FT_Face face, FT_Size size, FT_GlyphSlot slot, @@ -53,7 +53,7 @@ FT_BEGIN_HEADER T1_Decoder_Callback parse_glyph ); FT_LOCAL void - T1_Decoder_Done( T1_Decoder* decoder ); + T1_Decoder_Done( T1_Decoder decoder ); FT_END_HEADER diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c index d0432a29f..c4e8d9874 100644 --- a/src/sfnt/sfobjs.c +++ b/src/sfnt/sfobjs.c @@ -186,19 +186,19 @@ FT_Int num_params, FT_Parameter* params ) { - FT_Error error; - FT_Library library = face->root.driver->root.library; - SFNT_Interface* sfnt; - SFNT_Header sfnt_header; + FT_Error error; + FT_Library library = face->root.driver->root.library; + SFNT_Service sfnt; + SFNT_Header sfnt_header; /* for now, parameters are unused */ FT_UNUSED( num_params ); FT_UNUSED( params ); - sfnt = (SFNT_Interface*)face->sfnt; + sfnt = (SFNT_Service)face->sfnt; if ( !sfnt ) { - sfnt = (SFNT_Interface*)FT_Get_Module_Interface( library, "sfnt" ); + sfnt = (SFNT_Service)FT_Get_Module_Interface( library, "sfnt" ); if ( !sfnt ) { error = SFNT_Err_Invalid_File_Format; @@ -211,7 +211,7 @@ if ( !face->psnames ) { - face->psnames = (PSNames_Interface*) + face->psnames = (PSNames_Service) FT_Get_Module_Interface( library, "psnames" ); } @@ -253,7 +253,7 @@ FT_Bool has_outline; FT_Bool is_apple_sbit; - SFNT_Interface* sfnt = (SFNT_Interface*)face->sfnt; + SFNT_Service sfnt = (SFNT_Service)face->sfnt; FT_UNUSED( face_index ); FT_UNUSED( num_params ); @@ -596,7 +596,7 @@ SFNT_Done_Face( TT_Face face ) { FT_Memory memory = face->root.memory; - SFNT_Interface* sfnt = (SFNT_Interface*)face->sfnt; + SFNT_Service sfnt = (SFNT_Service)face->sfnt; if ( sfnt ) diff --git a/src/sfnt/ttcmap0.c b/src/sfnt/ttcmap0.c index d416b1b3a..2ac62c4e5 100644 --- a/src/sfnt/ttcmap0.c +++ b/src/sfnt/ttcmap0.c @@ -44,6 +44,35 @@ #define TT_NEXT_Long FT_NEXT_LONG_BE #define TT_NEXT_ULong FT_NEXT_ULONG_BE + + typedef struct TT_CMap_InfoRec_ + { + FT_ByteP base; + FT_ByteP limit; + FT_ValidationLevel level; + + } TT_CMap_InfoRec, *TT_CMap_Info; + + + FT_CALLBACK_DEF FT_Error + tt_cmap_init( FT_CMap cmap, + TT_CMap_Info info ) + { + FT_Error error; + TT_CMap_Class clazz = (TT_CMap_Class) FT_CMAP_CLASS(cmap); + FT_ValidatorRec valid; + + cmap->data = info->base; + + ft_validator_init( &valid, info->base, info->limit, info->level ); + + if ( setjmp( valid->jump_buffer, 0 ) == 0 ) + clazz->validate( info->base, &valid ); + + return valid.error; + } + + /************************************************************************/ /************************************************************************/ /***** *****/ @@ -68,7 +97,7 @@ #ifdef TT_CONFIG_CMAP_FORMAT_0 - static void + FT_CALLBACK_DEF void tt_cmap0_validate( FT_Byte* table, FT_Validator valid ) { @@ -94,7 +123,7 @@ } - static FT_UInt + FT_CALLBACK_DEF FT_UInt tt_cmap0_char_index( FT_Byte* table, FT_ULong char_code ) { @@ -102,7 +131,7 @@ } - static FT_ULong + FT_CALLBACK_DEF FT_ULong tt_cmap0_char_next( FT_Byte* table, FT_ULong char_code, FT_UInt *agindex ) @@ -127,13 +156,22 @@ return result; } - static const TT_Cmap_ClassRec tt_cmap0_class_rec = + + FT_CALLBACK_TABLE const TT_Cmap_ClassRec tt_cmap0_class_rec = { - (TT_CMap_ValidateFunc) tt_cmap0_validate, - (TT_CMap_CharIndexFunc) tt_cmap0_char_index, - (TT_CMap_CharNextFunc) tt_cmap0_char_next + { + sizeof( FT_CMapRec ), + + (FT_CMap_InitFunc) tt_cmap_init, + (FT_CMap_DoneFunc) NULL, + (FT_CMap_CharIndexFunc) tt_cmap0_char_index, + (FT_CMap_CharNextFunc) tt_cmap0_char_next + }, + (TT_CMap_ValidateFunc) tt_cmap0_validate }; + FT_LOCAL_DEF TT_CMap_Class tt_cmap0_class = &tt_cmap0_class_rec; + #endif /* TT_CONFIG_CMAP_FORMAT_0 */ @@ -224,7 +262,7 @@ #ifdef TT_CONFIG_CMAP_FORMAT_2 - static void + FT_CALLBACK_DEF void tt_cmap2_validate( FT_Byte* table, FT_Validator valid ) { @@ -362,7 +400,7 @@ } - static FT_UInt + FT_CALLBACK_DEF FT_UInt tt_cmap2_char_index( FT_Byte* table, FT_ULong char_code ) { @@ -398,7 +436,7 @@ - static FT_UInt + FT_CALLBACK_DEF FT_UInt tt_cmap2_char_next( FT_Byte* table, FT_ULong char_code, FT_UInt *agindex ) @@ -464,13 +502,21 @@ return result; } - static const TT_Cmap_ClassRec tt_cmap2_class_rec = + FT_CALLBACK_TABLE const TT_Cmap_ClassRec tt_cmap2_class_rec = { - (TT_CMap_ValidateFunc) tt_cmap2_validate, - (TT_CMap_CharIndexFunc) tt_cmap2_char_index, - (TT_CMap_CharNextFunc) tt_cmap2_char_next + { + sizeof( FT_CMapRec ), + + (FT_CMap_InitFunc) tt_cmap_init, + (FT_CMap_DoneFunc) NULL, + (FT_CMap_CharIndexFunc) tt_cmap2_char_index, + (FT_CMap_CharNextFunc) tt_cmap2_char_next + }, + (TT_CMap_ValidateFunc) tt_cmap2_validate }; + FT_LOCAL_DEF TT_CMap_Class tt_cmap2_class = &tt_cmap2_class_rec; + #endif /* TT_CONFIG_CMAP_FORMAT_2 */ @@ -536,7 +582,7 @@ #ifdef TT_CONFIG_CMAP_FORMAT_4 - static void + FT_CALLBACK_DEF void tt_cmap4_validate( FT_Byte* table, FT_Validator valid ) { @@ -653,7 +699,7 @@ - static FT_UInt + FT_CALLBACK_DEF FT_UInt tt_cmap4_char_index( FT_Byte* table, FT_ULong char_code ) { @@ -703,7 +749,7 @@ - static FT_ULong + FT_CALLBACK_DEF FT_ULong tt_cmap4_char_next( FT_Byte* table, FT_ULong char_code, FT_UInt *agindex ) @@ -784,13 +830,21 @@ return result; } - static const TT_Cmap_ClassRec tt_cmap4_class_rec = + FT_CALLBACK_TABLE const TT_Cmap_ClassRec tt_cmap4_class_rec = { - (TT_CMap_ValidateFunc) tt_cmap4_validate, - (TT_CMap_CharIndexFunc) tt_cmap4_char_index, - (TT_CMap_CharNextFunc) tt_cmap4_char_next + { + sizeof( FT_CMapRec ), + + (FT_CMap_InitFunc) tt_cmap_init, + (FT_CMap_DoneFunc) NULL, + (FT_CMap_CharIndexFunc) tt_cmap4_char_index, + (FT_CMap_CharNextFunc) tt_cmap4_char_next + }, + (TT_CMap_ValidateFunc) tt_cmap4_validate }; + FT_LOCAL_DEF TT_CMap_Class tt_cmap4_class = &tt_cmap4_class_rec; + #endif /* TT_CONFIG_CMAP_FORMAT_4 */ /************************************************************************/ @@ -822,7 +876,7 @@ #ifdef TT_CONFIG_CMAP_FORMAT_6 - static void + FT_CALLBACK_DEF void tt_cmap6_validate( FT_Byte* table, FT_Validator valid ) { @@ -857,7 +911,7 @@ } - static FT_UInt + FT_CALLBACK_DEF FT_UInt tt_cmap6_char_index( FT_Byte* table, FT_ULong char_code ) { @@ -876,7 +930,7 @@ } - static FT_ULong + FT_CALLBACK_DEF FT_ULong tt_cmap6_char_next( FT_Byte* table, FT_ULong char_code, FT_UInt *agindex ) @@ -916,13 +970,22 @@ return result; } - static const TT_Cmap_ClassRec tt_cmap6_class_rec = + + FT_CALLBACK_TABLE const TT_Cmap_ClassRec tt_cmap6_class_rec = { - (TT_CMap_ValidateFunc) tt_cmap6_validate, - (TT_CMap_CharIndexFunc) tt_cmap6_char_index, - (TT_CMap_CharNextFunc) tt_cmap6_char_next + { + sizeof( FT_CMapRec ), + + (FT_CMap_InitFunc) tt_cmap_init, + (FT_CMap_DoneFunc) NULL, + (FT_CMap_CharIndexFunc) tt_cmap6_char_index, + (FT_CMap_CharNextFunc) tt_cmap6_char_next + }, + (TT_CMap_ValidateFunc) tt_cmap6_validate }; + FT_LOCAL_DEF TT_CMap_Class tt_cmap6_class = &tt_cmap6_class_rec; + #endif /* TT_CONFIG_CMAP_FORMAT_6 */ @@ -985,7 +1048,7 @@ #ifdef TT_CONFIG_CMAP_FORMAT_8 - static void + FT_CALLBACK_DEF void tt_cmap8_validate( FT_Byte* table, FT_Validator valid ) { @@ -1075,7 +1138,7 @@ } - static FT_UInt + FT_CALLBACK_DEF FT_UInt tt_cmap8_char_index( FT_Byte* table, FT_ULong char_code ) { @@ -1103,7 +1166,7 @@ } - static FT_ULong + FT_CALLBACK_DEF FT_ULong tt_cmap8_char_next( FT_Byte* table, FT_ULong char_code, FT_UInt *agindex ) @@ -1145,13 +1208,21 @@ } - static const TT_Cmap_ClassRec tt_cmap8_class_rec = + FT_CALLBACK_TABLE const TT_Cmap_ClassRec tt_cmap8_class_rec = { - (TT_CMap_ValidateFunc) tt_cmap8_validate, - (TT_CMap_CharIndexFunc) tt_cmap8_char_index, - (TT_CMap_CharNextFunc) tt_cmap8_char_next + { + sizeof( FT_CMapRec ), + + (FT_CMap_InitFunc) tt_cmap_init, + (FT_CMap_DoneFunc) NULL, + (FT_CMap_CharIndexFunc) tt_cmap8_char_index, + (FT_CMap_CharNextFunc) tt_cmap8_char_next + }, + (TT_CMap_ValidateFunc) tt_cmap8_validate }; + FT_LOCAL_DEF TT_CMap_Class tt_cmap8_class = &tt_cmap8_class_rec; + #endif /* TT_CONFIG_CMAP_FORMAT_8 */ /************************************************************************/ @@ -1181,7 +1252,7 @@ #ifdef TT_CONFIG_CMAP_FORMAT_10 - static void + FT_CALLBACK_DEF void tt_cmap10_validate( FT_Byte* table, FT_Validator valid ) { @@ -1214,7 +1285,7 @@ } - static FT_UInt + FT_CALLBACK_DEF FT_UInt tt_cmap10_char_index( FT_Byte* table, FT_ULong char_code ) { @@ -1233,7 +1304,7 @@ } - static FT_ULong + FT_CALLBACK_DEF FT_ULong tt_cmap10_char_next( FT_Byte* table, FT_ULong char_code, FT_UInt *agindex ) @@ -1270,13 +1341,22 @@ return result; } - static const TT_Cmap_ClassRec tt_cmap10_class_rec = + + FT_CALLBACK_TABLE const TT_Cmap_ClassRec tt_cmap10_class_rec = { - (TT_CMap_ValidateFunc) tt_cmap10_validate, - (TT_CMap_CharIndexFunc) tt_cmap10_char_index, - (TT_CMap_CharNextFunc) tt_cmap10_char_next + { + sizeof( FT_CMapRec ), + + (FT_CMap_InitFunc) tt_cmap_init, + (FT_CMap_DoneFunc) NULL, + (FT_CMap_CharIndexFunc) tt_cmap10_char_index, + (FT_CMap_CharNextFunc) tt_cmap10_char_next + }, + (TT_CMap_ValidateFunc) tt_cmap10_validate }; + FT_LOCAL_DEF TT_CMap_Class tt_cmap10_class = &tt_cmap10_class_rec; + #endif /* TT_CONFIG_CMAP_FORMAT_10 */ @@ -1312,7 +1392,7 @@ #ifdef TT_CONFIG_CMAP_FORMAT_12 - static void + FT_CALLBACK_DEF void tt_cmap12_validate( FT_Byte* table, FT_Validator valid ) { @@ -1364,7 +1444,7 @@ - static FT_UInt + FT_CALLBACK_DEF FT_UInt tt_cmap12_char_index( FT_Byte* table, FT_ULong char_code ) { @@ -1392,7 +1472,7 @@ } - static FT_ULong + FT_CALLBACK_DEF FT_ULong tt_cmap12_char_next( FT_Byte* table, FT_ULong char_code, FT_UInt *agindex ) @@ -1434,13 +1514,21 @@ } - static const TT_Cmap_ClassRec tt_cmap12_class_rec = + FT_CALLBACK_TABLE const TT_Cmap_ClassRec tt_cmap12_class_rec = { - (TT_CMap_ValidateFunc) tt_cmap12_validate, - (TT_CMap_CharIndexFunc) tt_cmap12_char_index, - (TT_CMap_CharNextFunc) tt_cmap12_char_next + { + sizeof( FT_CMapRec ), + + (FT_CMap_InitFunc) tt_cmap_init, + (FT_CMap_DoneFunc) NULL, + (FT_CMap_CharIndexFunc) tt_cmap12_char_index, + (FT_CMap_CharNextFunc) tt_cmap12_char_next + }, + (TT_CMap_ValidateFunc) tt_cmap12_validate }; + FT_LOCAL_DEF TT_CMap_Class tt_cmap12_class = &tt_cmap12_class_rec; + #endif /* TT_CONFIG_CMAP_FORMAT_12 */ /* END */ diff --git a/src/sfnt/ttpost.c b/src/sfnt/ttpost.c index c22870692..6942ff4a1 100644 --- a/src/sfnt/ttpost.c +++ b/src/sfnt/ttpost.c @@ -450,7 +450,7 @@ TT_Post_Names* names; #ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES - PSNames_Interface* psnames; + PSNames_Service psnames; #endif @@ -461,7 +461,7 @@ return SFNT_Err_Invalid_Glyph_Index; #ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES - psnames = (PSNames_Interface*)face->psnames; + psnames = (PSNames_Service)face->psnames; if ( !psnames ) return SFNT_Err_Unimplemented_Feature; #endif diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c index 5df3e3180..dba942e09 100644 --- a/src/truetype/ttdriver.c +++ b/src/truetype/ttdriver.c @@ -376,7 +376,7 @@ /* Load table if needed */ if ( !cmap->loaded ) { - SFNT_Interface* sfnt = (SFNT_Interface*)face->sfnt; + SFNT_Service sfnt = (SFNT_Service)face->sfnt; error = sfnt->load_charmap( face, cmap, face->root.stream ); @@ -423,7 +423,7 @@ /* Load table if needed */ if ( !cmap->loaded ) { - SFNT_Interface* sfnt = (SFNT_Interface*)face->sfnt; + SFNT_Service sfnt = (SFNT_Service)face->sfnt; error = sfnt->load_charmap( face, cmap, face->root.stream ); @@ -459,13 +459,13 @@ { FT_Module sfntd = FT_Get_Module( driver->root.root.library, "sfnt" ); - SFNT_Interface* sfnt; + SFNT_Service sfnt; /* only return the default interface from the SFNT module */ if ( sfntd ) { - sfnt = (SFNT_Interface*)( sfntd->clazz->module_interface ); + sfnt = (SFNT_Service)( sfntd->clazz->module_interface ); if ( sfnt ) return sfnt->get_interface( FT_MODULE( driver ), interface ); } diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index 7053caa5f..32c5a3514 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -1422,7 +1422,7 @@ FT_UShort glyph_index, FT_UInt load_flags ) { - SFNT_Interface* sfnt; + SFNT_Service sfnt; TT_Face face; FT_Stream stream; FT_Error error; @@ -1430,7 +1430,7 @@ face = (TT_Face)glyph->face; - sfnt = (SFNT_Interface*)face->sfnt; + sfnt = (SFNT_Service)face->sfnt; stream = face->root.stream; error = 0; diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c index 7fee693e8..6e0663d3b 100644 --- a/src/truetype/ttobjs.c +++ b/src/truetype/ttobjs.c @@ -162,11 +162,11 @@ { FT_Error error; FT_Library library; - SFNT_Interface* sfnt; + SFNT_Service sfnt; library = face->root.driver->root.library; - sfnt = (SFNT_Interface*)FT_Get_Module_Interface( library, "sfnt" ); + sfnt = (SFNT_Service)FT_Get_Module_Interface( library, "sfnt" ); if ( !sfnt ) goto Bad_Format; @@ -230,7 +230,7 @@ FT_Memory memory = face->root.memory; FT_Stream stream = face->root.stream; - SFNT_Interface* sfnt = (SFNT_Interface*)face->sfnt; + SFNT_Service sfnt = (SFNT_Service)face->sfnt; /* for `extended TrueType formats' (i.e. compressed versions) */ @@ -679,7 +679,7 @@ FT_ULong strike_index; FT_Size_Metrics* metrics; FT_Size_Metrics* sbit_metrics; - SFNT_Interface* sfnt; + SFNT_Service sfnt; metrics = &size->root.metrics; @@ -688,7 +688,7 @@ return TT_Err_Ok; face = (TT_Face)size->root.face; - sfnt = (SFNT_Interface*)face->sfnt; + sfnt = (SFNT_Service)face->sfnt; sbit_metrics = &size->strike_metrics; diff --git a/src/type1/t1cmap.c b/src/type1/t1cmap.c index cd956f46b..e511575bb 100644 --- a/src/type1/t1cmap.c +++ b/src/type1/t1cmap.c @@ -13,7 +13,7 @@ FT_Int is_expert ) { T1_Face face = (T1_Face) FT_CMAP_FACE(cmap); - PSNames_Interface* psnames = face->psnames; + PSNames_Service psnames = face->psnames; cmap->num_glyphs = face->type1.num_glyphs; cmap->glyph_names = face->type1.glyph_names; diff --git a/src/type1/t1driver.c b/src/type1/t1driver.c index 0e9c3b82d..b3760c67f 100644 --- a/src/type1/t1driver.c +++ b/src/type1/t1driver.c @@ -250,11 +250,11 @@ { T1_Face face; FT_UInt result = 0; - PSNames_Interface* psnames; + PSNames_Service psnames; face = (T1_Face)charmap->face; - psnames = (PSNames_Interface*)face->psnames; + psnames = (PSNames_Service)face->psnames; if ( psnames ) switch ( charmap->encoding ) { @@ -365,11 +365,11 @@ FT_Long charcode ) { T1_Face face; - PSNames_Interface* psnames; + PSNames_Service psnames; face = (T1_Face)charmap->face; - psnames = (PSNames_Interface*)face->psnames; + psnames = (PSNames_Service)face->psnames; if ( psnames ) switch ( charmap->encoding ) diff --git a/src/type1/t1gload.c b/src/type1/t1gload.c index 78fa41ff8..b47e4944d 100644 --- a/src/type1/t1gload.c +++ b/src/type1/t1gload.c @@ -56,7 +56,7 @@ FT_CALLBACK_DEF( FT_Error ) - T1_Parse_Glyph( T1_Decoder* decoder, + T1_Parse_Glyph( T1_Decoder decoder, FT_UInt glyph_index ) { T1_Face face = (T1_Face)decoder->builder.face; @@ -78,10 +78,10 @@ FT_Int* max_advance ) { FT_Error error; - T1_Decoder decoder; + T1_DecoderRec decoder; FT_Int glyph_index; T1_Font* type1 = &face->type1; - PSAux_Interface* psaux = (PSAux_Interface*)face->psaux; + PSAux_Service psaux = (PSAux_Service)face->psaux; *max_advance = 0; @@ -143,12 +143,12 @@ FT_Int load_flags ) { FT_Error error; - T1_Decoder decoder; + T1_DecoderRec decoder; T1_Face face = (T1_Face)glyph->root.face; FT_Bool hinting; T1_Font* type1 = &face->type1; - PSAux_Interface* psaux = (PSAux_Interface*)face->psaux; - const T1_Decoder_Funcs* decoder_funcs = psaux->t1_decoder_funcs; + PSAux_Service psaux = (PSAux_Service)face->psaux; + const T1_Decoder_Funcs decoder_funcs = psaux->t1_decoder_funcs; FT_Matrix font_matrix; FT_Vector font_offset; diff --git a/src/type1/t1load.c b/src/type1/t1load.c index 8b512a51a..44fda3bb2 100644 --- a/src/type1/t1load.c +++ b/src/type1/t1load.c @@ -384,11 +384,11 @@ parse_blend_axis_types( T1_Face face, T1_Loader* loader ) { - T1_Token axis_tokens[ T1_MAX_MM_AXIS ]; - FT_Int n, num_axis; - FT_Error error = 0; - T1_Blend* blend; - FT_Memory memory; + T1_TokenRec axis_tokens[ T1_MAX_MM_AXIS ]; + FT_Int n, num_axis; + FT_Error error = 0; + T1_Blend* blend; + FT_Memory memory; /* take an array of objects */ @@ -413,7 +413,7 @@ /* each token is an immediate containing the name of the axis */ for ( n = 0; n < num_axis; n++ ) { - T1_Token* token = axis_tokens + n; + T1_Token token = axis_tokens + n; FT_Byte* name; FT_Int len; @@ -445,10 +445,10 @@ parse_blend_design_positions( T1_Face face, T1_Loader* loader ) { - T1_Token design_tokens[ T1_MAX_MM_DESIGNS ]; + T1_TokenRec design_tokens[ T1_MAX_MM_DESIGNS ]; FT_Int num_designs; FT_Int num_axis; - T1_ParserRec* parser = &loader->parser; + T1_Parser parser = &loader->parser; FT_Error error = 0; T1_Blend* blend; @@ -476,8 +476,8 @@ for ( n = 0; n < (FT_UInt)num_designs; n++ ) { - T1_Token axis_tokens[ T1_MAX_MM_DESIGNS ]; - T1_Token* token; + T1_TokenRec axis_tokens[ T1_MAX_MM_DESIGNS ]; + T1_Token token; FT_Int axis, n_axis; @@ -505,7 +505,7 @@ /* now, read each axis token into the design position */ for ( axis = 0; axis < n_axis; axis++ ) { - T1_Token* token2 = axis_tokens + axis; + T1_Token token2 = axis_tokens + axis; parser->root.cursor = token2->start; @@ -528,9 +528,9 @@ T1_Loader* loader ) { FT_Error error = 0; - T1_ParserRec* parser = &loader->parser; + T1_Parser parser = &loader->parser; T1_Blend* blend; - T1_Token axis_tokens[ T1_MAX_MM_AXIS ]; + T1_TokenRec axis_tokens[ T1_MAX_MM_AXIS ]; FT_Int n, num_axis; FT_Byte* old_cursor; FT_Byte* old_limit; @@ -557,7 +557,7 @@ for ( n = 0; n < num_axis; n++ ) { T1_DesignMap* map = blend->design_map + n; - T1_Token* token; + T1_Token token; FT_Int p, num_points; @@ -609,9 +609,9 @@ T1_Loader* loader ) { FT_Error error = 0; - T1_ParserRec* parser = &loader->parser; + T1_Parser parser = &loader->parser; T1_Blend* blend = face->blend; - T1_Token master; + T1_TokenRec master; FT_UInt n; FT_Byte* old_cursor; FT_Byte* old_limit; @@ -625,7 +625,7 @@ } T1_ToToken( parser, &master ); - if ( master.type != t1_token_array ) + if ( master.type != T1_TOKEN_TYPE_ARRAY ) { FT_ERROR(( "parse_weight_vector: incorrect format!\n" )); error = T1_Err_Invalid_File_Format; @@ -660,7 +660,7 @@ parse_shared_dict( T1_Face face, T1_Loader* loader ) { - T1_ParserRec* parser = &loader->parser; + T1_Parser parser = &loader->parser; FT_UNUSED( face ); @@ -684,7 +684,7 @@ /*************************************************************************/ /* */ /* First of all, define the token field static variables. This is a set */ - /* of T1_Field variables used later. */ + /* of T1_FieldRec variables used later. */ /* */ /*************************************************************************/ @@ -692,7 +692,7 @@ static FT_Error t1_load_keyword( T1_Face face, T1_Loader* loader, - T1_Field* field ) + T1_Field field ) { FT_Error error; void* dummy_object; @@ -702,7 +702,7 @@ /* if the keyword has a dedicated callback, call it */ - if ( field->type == t1_field_callback ) + if ( field->type == T1_FIELD_TYPE_CALLBACK ) { field->reader( (FT_Face)face, loader ); error = loader->parser.root.error; @@ -743,8 +743,8 @@ max_objects = 0; } - if ( field->type == t1_field_integer_array || - field->type == t1_field_fixed_array ) + if ( field->type == T1_FIELD_TYPE_INTEGER_ARRAY || + field->type == T1_FIELD_TYPE_FIXED_ARRAY ) error = T1_Load_Field_Table( &loader->parser, field, objects, max_objects, 0 ); else @@ -774,7 +774,7 @@ static int - read_binary_data( T1_ParserRec* parser, + read_binary_data( T1_Parser parser, FT_Int* size, FT_Byte** base ) { @@ -819,7 +819,7 @@ parse_font_name( T1_Face face, T1_Loader* loader ) { - T1_ParserRec* parser = &loader->parser; + T1_Parser parser = &loader->parser; FT_Error error; FT_Memory memory = parser->root.memory; FT_Int len; @@ -865,7 +865,7 @@ parse_font_bbox( T1_Face face, T1_Loader* loader ) { - T1_ParserRec* parser = &loader->parser; + T1_Parser parser = &loader->parser; FT_Fixed temp[4]; FT_BBox* bbox = &face->type1.font_bbox; @@ -882,7 +882,7 @@ parse_font_matrix( T1_Face face, T1_Loader* loader ) { - T1_ParserRec* parser = &loader->parser; + T1_Parser parser = &loader->parser; FT_Matrix* matrix = &face->type1.font_matrix; FT_Vector* offset = &face->type1.font_offset; FT_Face root = (FT_Face)&face->root; @@ -931,11 +931,11 @@ parse_encoding( T1_Face face, T1_Loader* loader ) { - T1_ParserRec* parser = &loader->parser; + T1_Parser parser = &loader->parser; FT_Byte* cur = parser->root.cursor; FT_Byte* limit = parser->root.limit; - PSAux_Interface* psaux = (PSAux_Interface*)face->psaux; + PSAux_Service psaux = (PSAux_Service)face->psaux; /* skip whitespace */ @@ -956,7 +956,7 @@ { T1_Encoding* encode = &face->type1.encoding; FT_Int count, n; - PS_Table* char_table = &loader->encoding_table; + PS_Table char_table = &loader->encoding_table; FT_Memory memory = parser->root.memory; FT_Error error; @@ -1099,13 +1099,13 @@ parse_subrs( T1_Face face, T1_Loader* loader ) { - T1_ParserRec* parser = &loader->parser; - PS_Table* table = &loader->subrs; + T1_Parser parser = &loader->parser; + PS_Table table = &loader->subrs; FT_Memory memory = parser->root.memory; FT_Error error; FT_Int n; - PSAux_Interface* psaux = (PSAux_Interface*)face->psaux; + PSAux_Service psaux = (PSAux_Service)face->psaux; if ( loader->num_subrs ) @@ -1197,14 +1197,14 @@ parse_charstrings( T1_Face face, T1_Loader* loader ) { - T1_ParserRec* parser = &loader->parser; - PS_Table* code_table = &loader->charstrings; - PS_Table* name_table = &loader->glyph_names; - PS_Table* swap_table = &loader->swap_table; + T1_Parser parser = &loader->parser; + PS_Table code_table = &loader->charstrings; + PS_Table name_table = &loader->glyph_names; + PS_Table swap_table = &loader->swap_table; FT_Memory memory = parser->root.memory; FT_Error error; - PSAux_Interface* psaux = (PSAux_Interface*)face->psaux; + PSAux_Service psaux = (PSAux_Service)face->psaux; FT_Byte* cur; FT_Byte* limit = parser->root.limit; @@ -1457,7 +1457,7 @@ static - const T1_Field t1_keywords[] = + const T1_FieldRec t1_keywords[] = { #include "t1tokens.h" @@ -1478,7 +1478,7 @@ T1_FIELD_CALLBACK( "shareddict", parse_shared_dict ) #endif - { 0, t1_field_cid_info, t1_field_none, 0, 0, 0, 0, 0 } + { 0, t1_field_cid_info, T1_FIELD_TYPE_NONE, 0, 0, 0, 0, 0 } }; @@ -1488,7 +1488,7 @@ FT_Byte* base, FT_Long size ) { - T1_ParserRec* parser = &loader->parser; + T1_Parser parser = &loader->parser; parser->root.cursor = base; @@ -1520,7 +1520,7 @@ if ( cur < limit ) { - T1_Token token; + T1_TokenRec token; /* skip the `known' keyword and the token following it */ @@ -1529,7 +1529,7 @@ T1_ToToken( &loader->parser, &token ); /* if the last token was an array, skip it! */ - if ( token.type == t1_token_array ) + if ( token.type == T1_TOKEN_TYPE_ARRAY ) cur2 = parser->root.cursor; } cur = cur2; @@ -1551,7 +1551,7 @@ { { /* now, compare the immediate name to the keyword table */ - T1_Field* keyword = (T1_Field*)t1_keywords; + T1_Field keyword = (T1_Field)t1_keywords; for (;;) @@ -1622,7 +1622,7 @@ static void t1_done_loader( T1_Loader* loader ) { - T1_ParserRec* parser = &loader->parser; + T1_Parser parser = &loader->parser; /* finalize tables */ @@ -1640,12 +1640,12 @@ FT_LOCAL_DEF FT_Error T1_Open_Face( T1_Face face ) { - T1_Loader loader; - T1_ParserRec* parser; - T1_Font* type1 = &face->type1; - FT_Error error; + T1_Loader loader; + T1_Parser parser; + T1_Font* type1 = &face->type1; + FT_Error error; - PSAux_Interface* psaux = (PSAux_Interface*)face->psaux; + PSAux_Service psaux = (PSAux_Service)face->psaux; t1_init_loader( &loader, face ); diff --git a/src/type1/t1load.h b/src/type1/t1load.h index 23082bc5d..815f63477 100644 --- a/src/type1/t1load.h +++ b/src/type1/t1load.h @@ -36,16 +36,16 @@ FT_BEGIN_HEADER T1_ParserRec parser; /* parser used to read the stream */ FT_Int num_chars; /* number of characters in encoding */ - PS_Table encoding_table; /* PS_Table used to store the */ + PS_TableRec encoding_table; /* PS_Table used to store the */ /* encoding character names */ FT_Int num_glyphs; - PS_Table glyph_names; - PS_Table charstrings; - PS_Table swap_table; /* For moving .notdef glyph to index 0. */ + PS_TableRec glyph_names; + PS_TableRec charstrings; + PS_TableRec swap_table; /* For moving .notdef glyph to index 0. */ FT_Int num_subrs; - PS_Table subrs; + PS_TableRec subrs; FT_Bool fontdata; } T1_Loader; diff --git a/src/type1/t1objs.c b/src/type1/t1objs.c index 172ee51e4..67caad13a 100644 --- a/src/type1/t1objs.c +++ b/src/type1/t1objs.c @@ -59,7 +59,7 @@ T1_Size_Get_Globals_Funcs( T1_Size size ) { T1_Face face = (T1_Face) size->root.face; - PSHinter_Interface* pshinter = face->pshinter; + PSHinter_Service pshinter = face->pshinter; FT_Module module; @@ -144,7 +144,7 @@ T1_GlyphSlot_Init( T1_GlyphSlot slot ) { T1_Face face; - PSHinter_Interface* pshinter; + PSHinter_Service pshinter; face = (T1_Face) slot->root.face; pshinter = face->pshinter; @@ -275,9 +275,9 @@ FT_Parameter* params ) { FT_Error error; - PSNames_Interface* psnames; - PSAux_Interface* psaux; - PSHinter_Interface* pshinter; + PSNames_Service psnames; + PSAux_Service psaux; + PSHinter_Service pshinter; FT_UNUSED( num_params ); FT_UNUSED( params ); @@ -287,28 +287,28 @@ face->root.num_faces = 1; - psnames = (PSNames_Interface*)face->psnames; + psnames = (PSNames_Service)face->psnames; if ( !psnames ) { - psnames = (PSNames_Interface*) + psnames = (PSNames_Service) FT_Get_Module_Interface( FT_FACE_LIBRARY( face ), "psnames" ); face->psnames = psnames; } - psaux = (PSAux_Interface*)face->psaux; + psaux = (PSAux_Service)face->psaux; if ( !psaux ) { - psaux = (PSAux_Interface*) + psaux = (PSAux_Service) FT_Get_Module_Interface( FT_FACE_LIBRARY( face ), "psaux" ); face->psaux = psaux; } - pshinter = (PSHinter_Interface*)face->pshinter; + pshinter = (PSHinter_Service)face->pshinter; if ( !pshinter ) { - pshinter = (PSHinter_Interface*) + pshinter = (PSHinter_Service) FT_Get_Module_Interface( FT_FACE_LIBRARY( face ), "pshinter" ); face->pshinter = pshinter; diff --git a/src/type1/t1parse.c b/src/type1/t1parse.c index 7faab53e6..e3ae4762a 100644 --- a/src/type1/t1parse.c +++ b/src/type1/t1parse.c @@ -119,17 +119,17 @@ FT_LOCAL_DEF FT_Error - T1_New_Parser( T1_ParserRec* parser, - FT_Stream stream, - FT_Memory memory, - PSAux_Interface* psaux ) + T1_New_Parser( T1_Parser parser, + FT_Stream stream, + FT_Memory memory, + PSAux_Service psaux ) { FT_Error error; FT_UShort tag; FT_Long size; - psaux->t1_parser_funcs->init( &parser->root,0, 0, memory ); + psaux->ps_parser_funcs->init( &parser->root,0, 0, memory ); parser->stream = stream; parser->base_len = 0; @@ -228,7 +228,7 @@ FT_LOCAL_DEF void - T1_Finalize_Parser( T1_ParserRec* parser ) + T1_Finalize_Parser( T1_Parser parser ) { FT_Memory memory = parser->root.memory; @@ -268,8 +268,8 @@ FT_LOCAL_DEF FT_Error - T1_Get_Private_Dict( T1_ParserRec* parser, - PSAux_Interface* psaux ) + T1_Get_Private_Dict( T1_Parser parser, + PSAux_Service psaux ) { FT_Stream stream = parser->stream; FT_Memory memory = parser->root.memory; @@ -449,7 +449,7 @@ /* we now decrypt the encoded binary private dictionary */ psaux->t1_decrypt( parser->private_dict, parser->private_len, 55665U ); - parser->root.base = parser->private_dict; + parser->root.base = parser->private_dict; parser->root.cursor = parser->private_dict; parser->root.limit = parser->root.cursor + parser->private_len; diff --git a/src/type1/t1parse.h b/src/type1/t1parse.h index 51be1b63d..4f6c81e01 100644 --- a/src/type1/t1parse.h +++ b/src/type1/t1parse.h @@ -34,7 +34,7 @@ FT_BEGIN_HEADER /* T1_ParserRec */ /* */ /* */ - /* A T1_ParserRec is an object used to parse a Type 1 fonts very */ + /* A PS_ParserRec is an object used to parse a Type 1 fonts very */ /* quickly. */ /* */ /* */ @@ -60,20 +60,20 @@ FT_BEGIN_HEADER /* */ typedef struct T1_ParserRec_ { - T1_Parser root; - FT_Stream stream; + PS_ParserRec root; + FT_Stream stream; - FT_Byte* base_dict; - FT_Int base_len; + FT_Byte* base_dict; + FT_Int base_len; - FT_Byte* private_dict; - FT_Int private_len; + FT_Byte* private_dict; + FT_Int private_len; - FT_Byte in_pfb; - FT_Byte in_memory; - FT_Byte single_block; + FT_Byte in_pfb; + FT_Byte in_memory; + FT_Byte single_block; - } T1_ParserRec; + } T1_ParserRec, *T1_Parser; #define T1_Add_Table( p, i, o, l ) (p)->funcs.add( (p), i, o, l ) @@ -108,22 +108,23 @@ FT_BEGIN_HEADER #define T1_Load_Field( p, f, o, m, pf ) \ (p)->root.funcs.load_field( &(p)->root, f, o, m, pf ) + #define T1_Load_Field_Table( p, f, o, m, pf ) \ (p)->root.funcs.load_field_table( &(p)->root, f, o, m, pf ) FT_LOCAL FT_Error - T1_New_Parser( T1_ParserRec* parser, - FT_Stream stream, - FT_Memory memory, - PSAux_Interface* psaux ); + T1_New_Parser( T1_Parser parser, + FT_Stream stream, + FT_Memory memory, + PSAux_Service psaux ); FT_LOCAL FT_Error - T1_Get_Private_Dict( T1_ParserRec* parser, - PSAux_Interface* psaux ); + T1_Get_Private_Dict( T1_Parser parser, + PSAux_Service psaux ); FT_LOCAL void - T1_Finalize_Parser( T1_ParserRec* parser ); + T1_Finalize_Parser( T1_Parser parser ); FT_END_HEADER diff --git a/src/type1/t1tokens.h b/src/type1/t1tokens.h index f0a0c5dc9..0fd638b81 100644 --- a/src/type1/t1tokens.h +++ b/src/type1/t1tokens.h @@ -28,7 +28,7 @@ T1_FIELD_STRING( "Weight", weight ) T1_FIELD_NUM ( "ItalicAngle", italic_angle ) - T1_FIELD_BOOL ( "isFixedPitch", is_fixed_pitch ) + T1_FIELD_TYPE_BOOL ( "isFixedPitch", is_fixed_pitch ) T1_FIELD_NUM ( "UnderlinePosition", underline_position ) T1_FIELD_NUM ( "UnderlineThickness", underline_thickness )