diff --git a/ChangeLog b/ChangeLog index 417865c9a..c8d05ee41 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,24 +1,28 @@ 2002-02-28 David Turner + * include/freetype/ftconfig.h: changed FT_LOCAL xxxx to FT_LOCAL( xxxx ) + everywhere in the source. Sames goes for FT_LOCAL_DEF xxxx translated + into FT_LOCAL_DEF( xxxxx ) + * include/freetype/freetype.h: changing version to 2.1.0 to indicate an unstable branch. Added the declarations of FT_Get_First_Char and FT_Get_Next_Char - + * src/base/ftobjs.c: implemented FT_Get_First_Char and FT_Get_Next_Char * include/freetype/t1tables.h: re-naming structure types. This done basically: - + typedef T1_Struct_ { } T1_Struct; - + becomes: - + typedef PS_StructRec_ { } PS_StructRec, *PS_Struct; - + typedef PS_StructRec T1_Struct; /* backwards-compatibility */ diff --git a/include/freetype/config/ftconfig.h b/include/freetype/config/ftconfig.h index 9d6d8fb39..633bf5761 100644 --- a/include/freetype/config/ftconfig.h +++ b/include/freetype/config/ftconfig.h @@ -205,17 +205,17 @@ FT_BEGIN_HEADER #ifdef FT_MAKE_OPTION_SINGLE_OBJECT -#define FT_LOCAL static -#define FT_LOCAL_DEF static +#define FT_LOCAL(x) static x +#define FT_LOCAL_DEF(x) static x #else #ifdef __cplusplus -#define FT_LOCAL extern "C" -#define FT_LOCAL_DEF extern "C" +#define FT_LOCAL(x) extern "C" x +#define FT_LOCAL_DEF(x) extern "C" x #else -#define FT_LOCAL extern -#define FT_LOCAL_DEF extern +#define FT_LOCAL(x) extern x +#define FT_LOCAL_DEF(x) extern x #endif #endif /* FT_MAKE_OPTION_SINGLE_OBJECT */ diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h index 345c299e6..3c1368090 100644 --- a/include/freetype/config/ftoption.h +++ b/include/freetype/config/ftoption.h @@ -76,6 +76,15 @@ FT_BEGIN_HEADER /*************************************************************************/ +#undef FT_CONFIG_OPTION_USE_CMAPS +#define TT_CONFIG_CMAP_FORMAT_0 +#define TT_CONFIG_CMAP_FORMAT_2 +#define TT_CONFIG_CMAP_FORMAT_4 +#define TT_CONFIG_CMAP_FORMAT_6 +#define TT_CONFIG_CMAP_FORMAT_8 +#define TT_CONFIG_CMAP_FORMAT_10 +#define TT_CONFIG_CMAP_FORMAT_12 + /*************************************************************************/ /* */ /* Convenience functions support */ diff --git a/include/freetype/internal/ftmemory.h b/include/freetype/internal/ftmemory.h index a08a955a3..f2da6feca 100644 --- a/include/freetype/internal/ftmemory.h +++ b/include/freetype/internal/ftmemory.h @@ -218,16 +218,22 @@ FT_BEGIN_HEADER #define MEM_Free( _pointer_ ) \ FT_Free_Debug( memory, (void**)&(_pointer_), __FILE__, __LINE__ ) - + #else /* !FT_DEBUG_MEMORY */ #define MEM_Alloc( _pointer_, _size_ ) \ FT_Alloc( memory, _size_, (void**)&(_pointer_) ) +#define MEM_New( _pointer_ ) MEM_Alloc( _pointer_, sizeof(*(_pointer_)) ) + + #define MEM_Alloc_Array( _pointer_, _count_, _type_ ) \ FT_Alloc( memory, (_count_)*sizeof ( _type_ ), \ (void**)&(_pointer_) ) +#define MEM_New_Array( _pointer_, _count_ ) \ + MEM_Alloc_Array( _pointer_, _count_, sizeof(*(_pointer_)) ) + #define MEM_Realloc( _pointer_, _current_, _size_ ) \ FT_Realloc( memory, _current_, _size_, (void**)&(_pointer_) ) @@ -235,6 +241,9 @@ FT_BEGIN_HEADER FT_Realloc( memory, (_current_)*sizeof ( _type_ ), \ (_new_)*sizeof ( _type_ ), (void**)&(_pointer_) ) +#define MEM_Renew_Array( _pointer_, _current_, _new_ ) \ + MEM_Realloc_Array( _pointer_, _current_, _new_, *(_pointer_) ) + #define MEM_Free( _pointer_ ) \ FT_Free( memory, (void**)&(_pointer_) ) @@ -244,6 +253,9 @@ FT_BEGIN_HEADER #define ALLOC( _pointer_, _size_ ) \ FT_SET_ERROR( MEM_Alloc( _pointer_, _size_ ) ) +#define NEW( _pointer_ ) \ + FT_SET_ERROR( MEM_New( _pointer_ ) ) + #define REALLOC( _pointer_, _current_, _size_ ) \ FT_SET_ERROR( MEM_Realloc( _pointer_, _current_, _size_ ) ) @@ -251,11 +263,17 @@ FT_BEGIN_HEADER FT_SET_ERROR( MEM_Alloc( _pointer_, \ (_count_)*sizeof ( _type_ ) ) ) +#define NEW_ARRAY( _pointer_, _count_ ) \ + FT_SET_ERROR( MEM_New_Array( _pointer_, _count_ ) ) + #define REALLOC_ARRAY( _pointer_, _current_, _count_, _type_ ) \ FT_SET_ERROR( MEM_Realloc( _pointer_, \ (_current_)*sizeof ( _type_ ), \ (_count_)*sizeof ( _type_ ) ) ) +#define RENEW_ARRAY( _pointer_, _current_, _new_ ) \ + FT_SET_ERROR( MEM_Renew_Array( _pointer_, _current_, _new_ ) ) + #define FREE( _pointer_ ) \ MEM_Free( _pointer_ ) diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h index c7221e06a..9d9f0be94 100644 --- a/include/freetype/internal/ftobjs.h +++ b/include/freetype/internal/ftobjs.h @@ -102,7 +102,7 @@ FT_BEGIN_HEADER * FT_VALIDATE_TIGHT :: * a table that passes this validation level can be used reliably and * doesn't contain invalid data. For example, a charmap table that - * returns invalid glyph indices will not pass, even though it can + * returns invalid glyph indices will not pass, even though it can * be used with FreeType in default mode (the library will simply * return an error later when trying to load the glyph) * @@ -120,7 +120,7 @@ FT_BEGIN_HEADER FT_VALIDATE_DEFAULT = 0, FT_VALIDATE_TIGHT, FT_VALIDATE_PARANOID - + } FT_ValidationLevel; @@ -131,9 +131,9 @@ FT_BEGIN_HEADER FT_Byte* limit; /* 'base' + sizeof(table) in memory */ FT_ValidationLevel level; /* validation level */ FT_Error error; /* error returned. 0 means success */ - + jmp_buf jump_buffer; /* used for exception handling */ - + } FT_ValidatorRec; @@ -183,7 +183,7 @@ FT_BEGIN_HEADER /* handle to internal charmap object */ typedef struct FT_CMapRec_* FT_CMap; - + /* handle to charmap class structure */ typedef const struct FT_CMap_ClassRec_* FT_CMap_Class; @@ -192,8 +192,7 @@ FT_BEGIN_HEADER { FT_CharMapRec charmap; FT_CMap_Class clazz; - FT_Pointer data; - + } FT_CMapRec; /* typecase any pointer to a charmap handle */ @@ -208,15 +207,16 @@ FT_BEGIN_HEADER /* class method definitions */ typedef FT_Error (*FT_CMap_InitFunc)( FT_CMap cmap, - FT_Pointer data ); + FT_Pointer init_data ); typedef void (*FT_CMap_DoneFunc)( FT_CMap cmap ); - typedef FT_UInt (*FT_CMap_CharIndexFunc)( FT_Pointer cmap_data, - FT_ULong char_code ); + typedef FT_UInt (*FT_CMap_CharIndexFunc)( FT_CMap cmap, + FT_UInt32 char_code ); - typedef FT_UInt (*FT_CMap_CharNextFunc)( FT_Pointer cmap_data, - FT_ULong *achar_code ); + typedef FT_UInt32 (*FT_CMap_CharNextFunc)( FT_CMap cmap, + FT_UInt32 char_code, + FT_UInt *agindex ); typedef struct FT_CMap_ClassRec_ { @@ -225,14 +225,14 @@ FT_BEGIN_HEADER FT_CMap_DoneFunc done; 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_Pointer init_data, FT_CharMap charmap, FT_CMap *acmap ); diff --git a/include/freetype/internal/tttypes.h b/include/freetype/internal/tttypes.h index f5f9802c8..5cab5ff5d 100644 --- a/include/freetype/internal/tttypes.h +++ b/include/freetype/internal/tttypes.h @@ -1101,18 +1101,6 @@ 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; /*************************************************************************/ @@ -1485,9 +1473,18 @@ FT_BEGIN_HEADER TT_OS2 os2; /* TrueType OS/2 table */ TT_Postscript postscript; /* TrueType Postscript table */ +#ifdef FT_CONFIG_OPTION_USE_CMAPS + + FT_Byte* cmap_table; /* extracted 'cmap' table */ + FT_ULong cmap_size; + +#else /* !FT_CONFIG_OPTION_USE_CMAPS */ + FT_Int num_charmaps; TT_CharMap charmaps; /* array of TT_CharMapRec */ +#endif /* !FT_CONFIG_OPTION_USE_CMAPS */ + TT_Goto_Table_Func goto_table; TT_Access_Glyph_Frame_Func access_glyph_frame; diff --git a/src/autohint/ahangles.c b/src/autohint/ahangles.c index 02da850cc..80d77d57b 100644 --- a/src/autohint/ahangles.c +++ b/src/autohint/ahangles.c @@ -64,7 +64,7 @@ }; - FT_LOCAL_DEF AH_Angle + FT_LOCAL_DEF( AH_Angle ) ah_angle( FT_Vector* v ) { FT_Pos dx, dy; diff --git a/src/autohint/ahangles.h b/src/autohint/ahangles.h index 8ed62aaa8..a74a4b0b3 100644 --- a/src/autohint/ahangles.h +++ b/src/autohint/ahangles.h @@ -47,7 +47,7 @@ FT_BEGIN_HEADER const AH_Angle ah_arctan[1L << AH_ATAN_BITS]; - FT_LOCAL AH_Angle + FT_LOCAL( AH_Angle ) ah_angle( FT_Vector* v ); diff --git a/src/autohint/ahglobal.c b/src/autohint/ahglobal.c index 4e648ac72..cd123e3a7 100644 --- a/src/autohint/ahglobal.c +++ b/src/autohint/ahglobal.c @@ -384,7 +384,7 @@ } - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) ah_hinter_compute_globals( AH_Hinter* hinter ) { return ah_hinter_compute_widths( hinter ) || diff --git a/src/autohint/ahglobal.h b/src/autohint/ahglobal.h index e9d424fb2..15645dbaa 100644 --- a/src/autohint/ahglobal.h +++ b/src/autohint/ahglobal.h @@ -37,8 +37,7 @@ FT_BEGIN_HEADER /* compute global metrics automatically */ - FT_LOCAL - FT_Error ah_hinter_compute_globals( AH_Hinter* hinter ); + FT_LOCAL( FT_Error ) ah_hinter_compute_globals( AH_Hinter* hinter ); FT_END_HEADER diff --git a/src/autohint/ahglyph.c b/src/autohint/ahglyph.c index 94afa0d95..56e7ff757 100644 --- a/src/autohint/ahglyph.c +++ b/src/autohint/ahglyph.c @@ -299,7 +299,7 @@ /* */ /* Creates a new and empty AH_Outline object. */ /* */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) ah_outline_new( FT_Memory memory, AH_Outline** aoutline ) { @@ -325,7 +325,7 @@ /* */ /* Destroys a given AH_Outline object. */ /* */ - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) ah_outline_done( AH_Outline* outline ) { FT_Memory memory = outline->memory; @@ -349,7 +349,7 @@ /* Saves the content of a given AH_Outline object into a face's glyph */ /* slot. */ /* */ - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) ah_outline_save( AH_Outline* outline, AH_Loader gloader ) { @@ -384,7 +384,7 @@ /* Loads an unscaled outline from a glyph slot into an AH_Outline */ /* object. */ /* */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) ah_outline_load( AH_Outline* outline, FT_Face face ) { @@ -622,7 +622,7 @@ } - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) ah_setup_uv( AH_Outline* outline, AH_UV source ) { @@ -676,7 +676,7 @@ } - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) ah_outline_compute_segments( AH_Outline* outline ) { int dimension; @@ -918,7 +918,7 @@ } - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) ah_outline_link_segments( AH_Outline* outline ) { AH_Segment* segments; @@ -1286,7 +1286,7 @@ /* */ /* Performs feature detection on a given AH_Outline object. */ /* */ - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) ah_outline_detect_features( AH_Outline* outline ) { ah_outline_compute_segments( outline ); @@ -1304,7 +1304,7 @@ /* Computes the `blue edges' in a given outline (i.e. those that must */ /* be snapped to a blue zone edge (top or bottom). */ /* */ - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) ah_outline_compute_blue_edges( AH_Outline* outline, AH_Face_Globals* face_globals ) { @@ -1438,7 +1438,7 @@ /* the contents of the detected edges (basically change the `blue */ /* edge' pointer from `design units' to `scaled ones'). */ /* */ - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) ah_outline_scale_blue_edges( AH_Outline* outline, AH_Face_Globals* globals ) { diff --git a/src/autohint/ahglyph.h b/src/autohint/ahglyph.h index 8a85e7737..77ee3d8c9 100644 --- a/src/autohint/ahglyph.h +++ b/src/autohint/ahglyph.h @@ -45,43 +45,43 @@ FT_BEGIN_HEADER } AH_UV; - FT_LOCAL void + FT_LOCAL( void ) ah_setup_uv( AH_Outline* outline, AH_UV source ); /* AH_Outline functions - they should be typically called in this order */ - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) ah_outline_new( FT_Memory memory, AH_Outline** aoutline ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) ah_outline_load( AH_Outline* outline, FT_Face face ); - FT_LOCAL void + FT_LOCAL( void ) ah_outline_compute_segments( AH_Outline* outline ); - FT_LOCAL void + FT_LOCAL( void ) ah_outline_link_segments( AH_Outline* outline ); - FT_LOCAL void + FT_LOCAL( void ) ah_outline_detect_features( AH_Outline* outline ); - FT_LOCAL void + FT_LOCAL( void ) ah_outline_compute_blue_edges( AH_Outline* outline, AH_Face_Globals* globals ); - FT_LOCAL void + FT_LOCAL( void ) ah_outline_scale_blue_edges( AH_Outline* outline, AH_Face_Globals* globals ); - FT_LOCAL void + FT_LOCAL( void ) ah_outline_save( AH_Outline* outline, AH_Loader loader ); - FT_LOCAL void + FT_LOCAL( void ) ah_outline_done( AH_Outline* outline ); diff --git a/src/autohint/ahhint.c b/src/autohint/ahhint.c index 7e0e2865c..b795ed6b4 100644 --- a/src/autohint/ahhint.c +++ b/src/autohint/ahhint.c @@ -378,7 +378,7 @@ } - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) ah_hinter_hint_edges( AH_Hinter* hinter, FT_Bool no_horz_edges, FT_Bool no_vert_edges ) @@ -807,7 +807,7 @@ #endif /* !AH_OPTION_NO_WEAK_INTERPOLATION */ - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) ah_hinter_align_points( AH_Hinter* hinter ) { ah_hinter_align_edge_points( hinter ); @@ -896,7 +896,7 @@ /* finalize a hinter object */ - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) ah_hinter_done( AH_Hinter* hinter ) { if ( hinter ) @@ -919,7 +919,7 @@ /* create a new empty hinter object */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) ah_hinter_new( FT_Library library, AH_Hinter** ahinter ) { @@ -955,7 +955,7 @@ /* create a face's autohint globals */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) ah_hinter_new_face_globals( AH_Hinter* hinter, FT_Face face, AH_Globals* globals ) @@ -987,7 +987,7 @@ /* discard a face's autohint globals */ - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) ah_hinter_done_face_globals( AH_Face_Globals* globals ) { FT_Face face = globals->face; @@ -1327,7 +1327,7 @@ /* load and hint a given glyph */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) ah_hinter_load_glyph( AH_Hinter* hinter, FT_GlyphSlot slot, FT_Size size, @@ -1381,7 +1381,7 @@ /* retrieve a face's autohint globals for client applications */ - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) ah_hinter_get_global_hints( AH_Hinter* hinter, FT_Face face, void** global_hints, @@ -1418,7 +1418,7 @@ } - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) ah_hinter_done_global_hints( AH_Hinter* hinter, void* global_hints ) { diff --git a/src/autohint/ahhint.h b/src/autohint/ahhint.h index c52760933..2be96acb7 100644 --- a/src/autohint/ahhint.h +++ b/src/autohint/ahhint.h @@ -37,12 +37,12 @@ FT_BEGIN_HEADER /* create a new empty hinter object */ - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) ah_hinter_new( FT_Library library, AH_Hinter** ahinter ); /* Load a hinted glyph in the hinter */ - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) ah_hinter_load_glyph( AH_Hinter* hinter, FT_GlyphSlot slot, FT_Size size, @@ -50,19 +50,19 @@ FT_BEGIN_HEADER FT_Int load_flags ); /* finalize a hinter object */ - FT_LOCAL void + FT_LOCAL( void ) ah_hinter_done( AH_Hinter* hinter ); - FT_LOCAL void + FT_LOCAL( void ) ah_hinter_done_face_globals( AH_Face_Globals* globals ); - FT_LOCAL void + FT_LOCAL( void ) ah_hinter_get_global_hints( AH_Hinter* hinter, FT_Face face, void** global_hints, long* global_len ); - FT_LOCAL void + FT_LOCAL( void ) ah_hinter_done_global_hints( AH_Hinter* hinter, void* global_hints ); diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index e347e4b86..2cb2faaf8 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -1382,9 +1382,9 @@ 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 ); + clazz->done( cmap ); FREE( cmap ); } @@ -1393,15 +1393,15 @@ FT_BASE_DEF( FT_Error ) FT_CMap_New( FT_CMap_Class clazz, - FT_Pointer data, + FT_Pointer init_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; @@ -1412,36 +1412,35 @@ { cmap->charmap = *charmap; cmap->clazz = clazz; - cmap->data = data; - + if ( clazz->init ) { - error = clazz->init( cmap, data ); + error = clazz->init( cmap, init_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 */ @@ -1457,8 +1456,14 @@ result = 0; if ( face && face->charmap ) { +#ifdef FT_CONFIG_OPTION_USE_CMAPS + FT_CMap cmap = FT_CMAP( face->charmap ); + + result = cmap->clazz->char_index( cmap, charcode ); +#else /* !FT_CONFIG_OPTION_USE_CMAPS */ driver = face->driver; result = driver->clazz->get_char_index( face->charmap, charcode ); +#endif /* !FT_CONFIG_OPTION_USE_CMAPS */ } return result; } @@ -1471,17 +1476,17 @@ { FT_ULong result = 0; FT_UInt gindex = 0; - + if ( face && face->charmap ) { gindex = FT_Get_Char_Index( face, 0 ); if ( gindex == 0 ) result = FT_Get_Next_Char( face, 0, &gindex ); } - + if ( agindex ) *agindex = gindex; - + return result; } @@ -1499,6 +1504,13 @@ if ( face && face->charmap ) { +#ifdef FT_CONFIG_OPTION_USE_CMAPS + FT_CMap cmap = FT_CMAP( face->charmap ); + + result = cmap->clazz->char_next( cmap, charcode, &gindex ); + if ( gindex == 0 ) + result = 0; +#else /* !FT_CONFIG_OPTION_USE_CMAPS */ driver = face->driver; result = driver->clazz->get_next_char( face->charmap, charcode ); if ( result != 0 ) @@ -1507,11 +1519,12 @@ if ( gindex == 0 ) result = 0; } +#endif /* !FT_CONFIG_OPTION_USE_CMAPS */ } - + if ( agindex ) *agindex = gindex; - + return result; } diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c index 2da9f8155..53efb4975 100644 --- a/src/cff/cffgload.c +++ b/src/cff/cffgload.c @@ -345,7 +345,7 @@ /* */ /* slot :: The current glyph object. */ /* */ - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) CFF_Init_Decoder( CFF_Decoder* decoder, TT_Face face, CFF_Size size, @@ -369,7 +369,7 @@ /* this function is used to select the locals subrs array */ - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) CFF_Prepare_Decoder( CFF_Decoder* decoder, FT_UInt glyph_index ) { @@ -699,7 +699,7 @@ /* */ /* FreeType error code. 0 means success. */ /* */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) CFF_Parse_CharStrings( CFF_Decoder* decoder, FT_Byte* charstring_base, FT_Int charstring_len ) @@ -2108,7 +2108,7 @@ #if 0 /* unused until we support pure CFF fonts */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) CFF_Compute_Max_Advance( TT_Face face, FT_Int* max_advance ) { @@ -2175,7 +2175,7 @@ /*************************************************************************/ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) CFF_Load_Glyph( CFF_GlyphSlot glyph, CFF_Size size, FT_Int glyph_index, diff --git a/src/cff/cffgload.h b/src/cff/cffgload.h index c542adf70..7bf7dc847 100644 --- a/src/cff/cffgload.h +++ b/src/cff/cffgload.h @@ -167,32 +167,32 @@ FT_BEGIN_HEADER } CFF_Decoder; - FT_LOCAL void + FT_LOCAL( void ) CFF_Init_Decoder( CFF_Decoder* decoder, TT_Face face, CFF_Size size, CFF_GlyphSlot slot, FT_Bool hinting ); - FT_LOCAL void + FT_LOCAL( void ) CFF_Prepare_Decoder( CFF_Decoder* decoder, FT_UInt glyph_index ); #if 0 /* unused until we support pure CFF fonts */ /* Compute the maximum advance width of a font through quick parsing */ - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) CFF_Compute_Max_Advance( TT_Face face, FT_Int* max_advance ); #endif /* 0 */ - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) CFF_Parse_CharStrings( CFF_Decoder* decoder, FT_Byte* charstring_base, FT_Int charstring_len ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) CFF_Load_Glyph( CFF_GlyphSlot glyph, CFF_Size size, FT_Int glyph_index, diff --git a/src/cff/cffload.c b/src/cff/cffload.c index e509326de..12202b6e0 100644 --- a/src/cff/cffload.c +++ b/src/cff/cffload.c @@ -1046,7 +1046,7 @@ #endif - FT_LOCAL_DEF FT_UShort + FT_LOCAL_DEF( FT_UShort ) CFF_Get_Standard_Encoding( FT_UInt charcode ) { return (FT_UShort)(charcode < 256 ? cff_standard_encoding[charcode] : 0); @@ -1204,7 +1204,7 @@ } - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) CFF_Access_Element( CFF_Index index, FT_UInt element, FT_Byte** pbytes, @@ -1269,7 +1269,7 @@ } - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) CFF_Forget_Element( CFF_Index index, FT_Byte** pbytes ) { @@ -1283,7 +1283,7 @@ } - FT_LOCAL_DEF FT_String* + FT_LOCAL_DEF( FT_String* ) CFF_Get_Name( CFF_Index index, FT_UInt element ) { @@ -1310,7 +1310,7 @@ } - FT_LOCAL_DEF FT_String* + FT_LOCAL_DEF( FT_String* ) CFF_Get_String( CFF_Index index, FT_UInt sid, PSNames_Service interface ) @@ -1413,7 +1413,7 @@ } - FT_LOCAL_DEF FT_Byte + FT_LOCAL_DEF( FT_Byte ) CFF_Get_FD( CFF_FD_Select* select, FT_UInt glyph_index ) { @@ -2056,7 +2056,7 @@ } - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) CFF_Load_Font( FT_Stream stream, FT_Int face_index, CFF_Font* font ) @@ -2239,7 +2239,7 @@ } - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) CFF_Done_Font( CFF_Font* font ) { FT_Memory memory = font->memory; diff --git a/src/cff/cffload.h b/src/cff/cffload.h index fb3685757..05228559f 100644 --- a/src/cff/cffload.h +++ b/src/cff/cffload.h @@ -27,41 +27,41 @@ FT_BEGIN_HEADER - FT_LOCAL FT_UShort + FT_LOCAL( FT_UShort ) CFF_Get_Standard_Encoding( FT_UInt charcode ); - FT_LOCAL FT_String* + FT_LOCAL( FT_String* ) CFF_Get_Name( CFF_Index index, FT_UInt element ); - FT_LOCAL FT_String* + FT_LOCAL( FT_String* ) CFF_Get_String( CFF_Index index, FT_UInt sid, PSNames_Service interface ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) CFF_Access_Element( CFF_Index index, FT_UInt element, FT_Byte** pbytes, FT_ULong* pbyte_len ); - FT_LOCAL void + FT_LOCAL( void ) CFF_Forget_Element( CFF_Index index, FT_Byte** pbytes ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) CFF_Load_Font( FT_Stream stream, FT_Int face_index, CFF_Font* font ); - FT_LOCAL void + FT_LOCAL( void ) CFF_Done_Font( CFF_Font* font ); - FT_LOCAL FT_Byte + FT_LOCAL( FT_Byte ) CFF_Get_FD( CFF_FD_Select* select, FT_UInt glyph_index ); diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c index 488622c6b..0a762f664 100644 --- a/src/cff/cffobjs.c +++ b/src/cff/cffobjs.c @@ -73,7 +73,7 @@ } - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) CFF_Size_Done( CFF_Size size ) { if ( size->internal ) @@ -90,7 +90,7 @@ } - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) CFF_Size_Init( CFF_Size size ) { FT_Error error = 0; @@ -163,7 +163,7 @@ } - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) CFF_Size_Reset( CFF_Size size ) { PSH_Globals_Funcs funcs = CFF_Size_Get_Globals_Funcs( size ); @@ -185,14 +185,14 @@ /* */ /*************************************************************************/ - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) CFF_GlyphSlot_Done( CFF_GlyphSlot slot ) { slot->root.internal->glyph_hints = 0; } - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) CFF_GlyphSlot_Init( CFF_GlyphSlot slot ) { CFF_Face face = (CFF_Face)slot->root.face; @@ -441,7 +441,7 @@ /* */ /* FreeType error code. 0 means success. */ /* */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) CFF_Face_Init( FT_Stream stream, CFF_Face face, FT_Int face_index, @@ -700,7 +700,7 @@ /* */ /* face :: A pointer to the face object to destroy. */ /* */ - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) CFF_Face_Done( CFF_Face face ) { FT_Memory memory = face->root.memory; @@ -737,7 +737,7 @@ /* */ /* FreeType error code. 0 means success. */ /* */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) CFF_Driver_Init( CFF_Driver driver ) { /* init extension registry if needed */ @@ -767,7 +767,7 @@ /* */ /* driver :: A handle to the target OpenType driver. */ /* */ - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) CFF_Driver_Done( CFF_Driver driver ) { /* destroy extensions registry if needed */ diff --git a/src/cff/cffobjs.h b/src/cff/cffobjs.h index 709bbe332..4918b6bbc 100644 --- a/src/cff/cffobjs.h +++ b/src/cff/cffobjs.h @@ -109,33 +109,33 @@ FT_BEGIN_HEADER } CFF_DriverRec; - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) CFF_Size_Init( CFF_Size size ); - FT_LOCAL void + FT_LOCAL( void ) CFF_Size_Done( CFF_Size size ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) CFF_Size_Reset( CFF_Size size ); - FT_LOCAL void + FT_LOCAL( void ) CFF_GlyphSlot_Done( CFF_GlyphSlot slot ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) CFF_GlyphSlot_Init( CFF_GlyphSlot slot ); /*************************************************************************/ /* */ /* Face functions */ /* */ - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) CFF_Face_Init( FT_Stream stream, CFF_Face face, FT_Int face_index, FT_Int num_params, FT_Parameter* params ); - FT_LOCAL void + FT_LOCAL( void ) CFF_Face_Done( CFF_Face face ); @@ -143,10 +143,10 @@ FT_BEGIN_HEADER /* */ /* Driver functions */ /* */ - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) CFF_Driver_Init( CFF_Driver driver ); - FT_LOCAL void + FT_LOCAL( void ) CFF_Driver_Done( CFF_Driver driver ); diff --git a/src/cff/cffparse.c b/src/cff/cffparse.c index 287545a38..43742feb6 100644 --- a/src/cff/cffparse.c +++ b/src/cff/cffparse.c @@ -63,7 +63,7 @@ } CFF_Field_Handler; - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) CFF_Parser_Init( CFF_Parser* parser, FT_UInt code, void* object ) @@ -479,7 +479,7 @@ }; - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) CFF_Parser_Run( CFF_Parser* parser, FT_Byte* start, FT_Byte* limit ) diff --git a/src/cff/cffparse.h b/src/cff/cffparse.h index c40b1983e..39e45b134 100644 --- a/src/cff/cffparse.h +++ b/src/cff/cffparse.h @@ -49,12 +49,12 @@ FT_BEGIN_HEADER } CFF_Parser; - FT_LOCAL void + FT_LOCAL( void ) CFF_Parser_Init( CFF_Parser* parser, FT_UInt code, void* object ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) CFF_Parser_Run( CFF_Parser* parser, FT_Byte* start, FT_Byte* limit ); diff --git a/src/cid/cidgload.c b/src/cid/cidgload.c index 77b54e824..4ef73e01e 100644 --- a/src/cid/cidgload.c +++ b/src/cid/cidgload.c @@ -138,7 +138,7 @@ /*************************************************************************/ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) CID_Compute_Max_Advance( CID_Face face, FT_Int* max_advance ) { @@ -201,7 +201,7 @@ /*************************************************************************/ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) CID_Load_Glyph( CID_GlyphSlot glyph, CID_Size size, FT_Int glyph_index, diff --git a/src/cid/cidgload.h b/src/cid/cidgload.h index bfab08122..1ba59c211 100644 --- a/src/cid/cidgload.h +++ b/src/cid/cidgload.h @@ -30,13 +30,13 @@ FT_BEGIN_HEADER #if 0 /* Compute the maximum advance width of a font through quick parsing */ - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) CID_Compute_Max_Advance( CID_Face face, FT_Int* max_advance ); #endif /* 0 */ - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) CID_Load_Glyph( CID_GlyphSlot glyph, CID_Size size, FT_Int glyph_index, diff --git a/src/cid/cidload.c b/src/cid/cidload.c index 66d34b0ce..3df25b69b 100644 --- a/src/cid/cidload.c +++ b/src/cid/cidload.c @@ -41,7 +41,7 @@ /* read a single offset */ - FT_LOCAL_DEF FT_Long + FT_LOCAL_DEF( FT_Long ) cid_get_offset( FT_Byte** start, FT_Byte offsize ) { @@ -60,7 +60,7 @@ } - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) cid_decrypt( FT_Byte* buffer, FT_Offset length, FT_UShort seed ) @@ -515,7 +515,7 @@ } - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) CID_Open_Face( CID_Face face ) { CID_Loader loader; diff --git a/src/cid/cidload.h b/src/cid/cidload.h index 0b70657d6..bc3dbe6d6 100644 --- a/src/cid/cidload.h +++ b/src/cid/cidload.h @@ -36,16 +36,16 @@ FT_BEGIN_HEADER } CID_Loader; - FT_LOCAL FT_Long + FT_LOCAL( FT_Long ) cid_get_offset( FT_Byte** start, FT_Byte offsize ); - FT_LOCAL void + FT_LOCAL( void ) cid_decrypt( FT_Byte* buffer, FT_Offset length, FT_UShort seed ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) CID_Open_Face( CID_Face face ); diff --git a/src/cid/cidobjs.c b/src/cid/cidobjs.c index acec769e9..27b384b73 100644 --- a/src/cid/cidobjs.c +++ b/src/cid/cidobjs.c @@ -44,14 +44,14 @@ /* */ /*************************************************************************/ - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) CID_GlyphSlot_Done( CID_GlyphSlot slot ) { slot->root.internal->glyph_hints = 0; } - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) CID_GlyphSlot_Init( CID_GlyphSlot slot ) { CID_Face face; @@ -105,7 +105,7 @@ } - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) CID_Size_Done( CID_Size size ) { if ( size->root.internal ) @@ -122,7 +122,7 @@ } - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) CID_Size_Init( CID_Size size ) { FT_Error error = 0; @@ -146,7 +146,7 @@ } - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) CID_Size_Reset( CID_Size size ) { PSH_Globals_Funcs funcs = CID_Size_Get_Globals_Funcs( size ); @@ -182,7 +182,7 @@ /* */ /* face :: A pointer to the face object to destroy. */ /* */ - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) CID_Face_Done( CID_Face face ) { FT_Memory memory; @@ -262,7 +262,7 @@ /* */ /* FreeType error code. 0 means success. */ /* */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) CID_Face_Init( FT_Stream stream, CID_Face face, FT_Int face_index, @@ -511,7 +511,7 @@ /* */ /* FreeType error code. 0 means success. */ /* */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) CID_Driver_Init( CID_Driver driver ) { FT_UNUSED( driver ); @@ -531,7 +531,7 @@ /* */ /* driver :: A handle to the target CID driver. */ /* */ - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) CID_Driver_Done( CID_Driver driver ) { FT_UNUSED( driver ); diff --git a/src/cid/cidobjs.h b/src/cid/cidobjs.h index 19d52c277..5e4673f45 100644 --- a/src/cid/cidobjs.h +++ b/src/cid/cidobjs.h @@ -111,26 +111,26 @@ FT_BEGIN_HEADER } CID_GlyphSlotRec; - FT_LOCAL void + FT_LOCAL( void ) CID_GlyphSlot_Done( CID_GlyphSlot slot ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) CID_GlyphSlot_Init( CID_GlyphSlot slot ); - FT_LOCAL void + FT_LOCAL( void ) CID_Size_Done( CID_Size size ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) CID_Size_Init( CID_Size size ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) CID_Size_Reset( CID_Size size ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) CID_Face_Init( FT_Stream stream, CID_Face face, FT_Int face_index, @@ -138,15 +138,15 @@ FT_BEGIN_HEADER FT_Parameter* params ); - FT_LOCAL void + FT_LOCAL( void ) CID_Face_Done( CID_Face face ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) CID_Driver_Init( CID_Driver driver ); - FT_LOCAL void + FT_LOCAL( void ) CID_Driver_Done( CID_Driver driver ); diff --git a/src/cid/cidparse.c b/src/cid/cidparse.c index 2f4b08caa..df14bc3fb 100644 --- a/src/cid/cidparse.c +++ b/src/cid/cidparse.c @@ -50,7 +50,7 @@ /*************************************************************************/ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) CID_New_Parser( CID_Parser* parser, FT_Stream stream, FT_Memory memory, @@ -139,7 +139,7 @@ } - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) CID_Done_Parser( CID_Parser* parser ) { /* always free the private dictionary */ diff --git a/src/cid/cidparse.h b/src/cid/cidparse.h index 7f8b2ecd3..df56b6ccf 100644 --- a/src/cid/cidparse.h +++ b/src/cid/cidparse.h @@ -71,13 +71,13 @@ FT_BEGIN_HEADER } CID_Parser; - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) CID_New_Parser( CID_Parser* parser, FT_Stream stream, FT_Memory memory, PSAux_Service psaux ); - FT_LOCAL void + FT_LOCAL( void ) CID_Done_Parser( CID_Parser* parser ); diff --git a/src/pcf/pcf.h b/src/pcf/pcf.h index 22d3da4fa..0a7bab52a 100644 --- a/src/pcf/pcf.h +++ b/src/pcf/pcf.h @@ -221,7 +221,7 @@ FT_BEGIN_HEADER #define GLYPHPADOPTIONS 4 /* I'm not sure about this */ - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) pcf_load_font( FT_Stream, PCF_Face ); diff --git a/src/pcf/pcfread.c b/src/pcf/pcfread.c index e9979d82e..e7cc8603e 100644 --- a/src/pcf/pcfread.c +++ b/src/pcf/pcfread.c @@ -855,7 +855,7 @@ THE SOFTWARE. } - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) pcf_load_font( FT_Stream stream, PCF_Face face ) { diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c index 68cd4eef0..7dadb0af5 100644 --- a/src/psaux/psobjs.c +++ b/src/psaux/psobjs.c @@ -53,7 +53,7 @@ /* */ /* FreeType error code. 0 means success. */ /* */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) PS_Table_New( PS_Table table, FT_Int count, FT_Memory memory ) @@ -149,7 +149,7 @@ /* FreeType error code. 0 means success. An error is returned if a */ /* reallocation fails. */ /* */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) PS_Table_Add( PS_Table table, FT_Int index, void* object, @@ -209,7 +209,7 @@ /* This function does NOT release the heap's memory block. It is up */ /* to the caller to clean it, or reference it in its own structures. */ /* */ - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) PS_Table_Done( PS_Table table ) { FT_Memory memory = table->memory; @@ -233,7 +233,7 @@ } - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) PS_Table_Release( PS_Table table ) { FT_Memory memory = table->memory; @@ -264,7 +264,7 @@ #define IS_T1_SPACE( c ) ( IS_T1_WHITESPACE( c ) || IS_T1_LINESPACE( c ) ) - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) PS_Parser_SkipSpaces( PS_Parser parser ) { FT_Byte* cur = parser->cursor; @@ -284,7 +284,7 @@ } - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) PS_Parser_SkipAlpha( PS_Parser parser ) { FT_Byte* cur = parser->cursor; @@ -304,7 +304,7 @@ } - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) PS_Parser_ToToken( PS_Parser parser, T1_Token token ) { @@ -387,7 +387,7 @@ } - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) PS_Parser_ToTokenArray( PS_Parser parser, T1_Token tokens, FT_UInt max_tokens, @@ -783,7 +783,7 @@ /* Load a simple field (i.e. non-table) into the current list of objects */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) PS_Parser_LoadField( PS_Parser parser, const T1_Field field, void** objects, @@ -904,7 +904,7 @@ #define T1_MAX_TABLE_ELEMENTS 32 - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) PS_Parser_LoadFieldTable( PS_Parser parser, const T1_Field field, void** objects, @@ -968,14 +968,14 @@ } - FT_LOCAL_DEF FT_Long + FT_LOCAL_DEF( FT_Long ) PS_Parser_ToInt( PS_Parser parser ) { return t1_toint( &parser->cursor, parser->limit ); } - FT_LOCAL_DEF FT_Fixed + FT_LOCAL_DEF( FT_Fixed ) PS_Parser_ToFixed( PS_Parser parser, FT_Int power_ten ) { @@ -983,7 +983,7 @@ } - FT_LOCAL_DEF FT_Int + FT_LOCAL_DEF( FT_Int ) PS_Parser_ToCoordArray( PS_Parser parser, FT_Int max_coords, FT_Short* coords ) @@ -993,7 +993,7 @@ } - FT_LOCAL_DEF FT_Int + FT_LOCAL_DEF( FT_Int ) PS_Parser_ToFixedArray( PS_Parser parser, FT_Int max_values, FT_Fixed* values, @@ -1006,14 +1006,14 @@ #if 0 - FT_LOCAL_DEF FT_String* + FT_LOCAL_DEF( FT_String* ) T1_ToString( PS_Parser parser ) { return t1_tostring( &parser->cursor, parser->limit, parser->memory ); } - FT_LOCAL_DEF FT_Bool + FT_LOCAL_DEF( FT_Bool ) T1_ToBool( PS_Parser parser ) { return t1_tobool( &parser->cursor, parser->limit ); @@ -1022,7 +1022,7 @@ #endif /* 0 */ - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) PS_Parser_Init( PS_Parser parser, FT_Byte* base, FT_Byte* limit, @@ -1037,7 +1037,7 @@ } - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) PS_Parser_Done( PS_Parser parser ) { FT_UNUSED( parser ); @@ -1070,7 +1070,7 @@ /* */ /* glyph :: The current glyph object. */ /* */ - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) T1_Builder_Init( T1_Builder* builder, FT_Face face, FT_Size size, @@ -1132,7 +1132,7 @@ /* */ /* builder :: A pointer to the glyph builder to finalize. */ /* */ - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) T1_Builder_Done( T1_Builder* builder ) { FT_GlyphSlot glyph = builder->glyph; @@ -1144,7 +1144,7 @@ /* check that there is enough room for `count' more points */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) T1_Builder_Check_Points( T1_Builder* builder, FT_Int count ) { @@ -1153,7 +1153,7 @@ /* add a new point, do not check space */ - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) T1_Builder_Add_Point( T1_Builder* builder, FT_Pos x, FT_Pos y, @@ -1184,7 +1184,7 @@ /* check space for a new on-curve point, then add it */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) T1_Builder_Add_Point1( T1_Builder* builder, FT_Pos x, FT_Pos y ) @@ -1201,7 +1201,7 @@ /* check room for a new contour, then add it */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) T1_Builder_Add_Contour( T1_Builder* builder ) { FT_Outline* outline = builder->current; @@ -1229,7 +1229,7 @@ /* if a path was begun, add its first on-curve point */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) T1_Builder_Start_Point( T1_Builder* builder, FT_Pos x, FT_Pos y ) @@ -1250,7 +1250,7 @@ /* close the current contour */ - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) T1_Builder_Close_Contour( T1_Builder* builder ) { FT_Outline* outline = builder->current; @@ -1293,7 +1293,7 @@ /*************************************************************************/ /*************************************************************************/ - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) T1_Decrypt( FT_Byte* buffer, FT_Offset length, FT_UShort seed ) diff --git a/src/psaux/psobjs.h b/src/psaux/psobjs.h index 84cd0b90e..002420c55 100644 --- a/src/psaux/psobjs.h +++ b/src/psaux/psobjs.h @@ -46,22 +46,22 @@ FT_BEGIN_HEADER const T1_Builder_Funcs t1_builder_funcs; - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) PS_Table_New( PS_Table table, FT_Int count, FT_Memory memory ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) PS_Table_Add( PS_Table table, FT_Int index, void* object, FT_Int length ); - FT_LOCAL void + FT_LOCAL( void ) PS_Table_Done( PS_Table table ); - FT_LOCAL void + FT_LOCAL( void ) PS_Table_Release( PS_Table table ); @@ -74,64 +74,64 @@ FT_BEGIN_HEADER /*************************************************************************/ - FT_LOCAL void + FT_LOCAL( void ) PS_Parser_SkipSpaces( PS_Parser parser ); - FT_LOCAL void + FT_LOCAL( void ) PS_Parser_SkipAlpha( PS_Parser parser ); - FT_LOCAL void + FT_LOCAL( void ) PS_Parser_ToToken( PS_Parser parser, T1_Token token ); - FT_LOCAL void + FT_LOCAL( void ) PS_Parser_ToTokenArray( PS_Parser parser, T1_Token tokens, FT_UInt max_tokens, FT_Int* pnum_tokens ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) PS_Parser_LoadField( PS_Parser parser, const T1_Field field, void** objects, FT_UInt max_objects, FT_ULong* pflags ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) PS_Parser_LoadFieldTable( PS_Parser parser, const T1_Field field, void** objects, FT_UInt max_objects, FT_ULong* pflags ); - FT_LOCAL FT_Long + FT_LOCAL( FT_Long ) PS_Parser_ToInt( PS_Parser parser ); - FT_LOCAL FT_Fixed + FT_LOCAL( FT_Fixed ) PS_Parser_ToFixed( PS_Parser parser, FT_Int power_ten ); - FT_LOCAL FT_Int + FT_LOCAL( FT_Int ) PS_Parser_ToCoordArray( PS_Parser parser, FT_Int max_coords, FT_Short* coords ); - FT_LOCAL FT_Int + FT_LOCAL( FT_Int ) PS_Parser_ToFixedArray( PS_Parser parser, FT_Int max_values, FT_Fixed* values, FT_Int power_ten ); - FT_LOCAL void + FT_LOCAL( void ) PS_Parser_Init( PS_Parser parser, FT_Byte* base, FT_Byte* limit, FT_Memory memory ); - FT_LOCAL void + FT_LOCAL( void ) PS_Parser_Done( PS_Parser parser ); @@ -143,42 +143,42 @@ FT_BEGIN_HEADER /*************************************************************************/ /*************************************************************************/ - FT_LOCAL void + FT_LOCAL( void ) T1_Builder_Init( T1_Builder* builder, FT_Face face, FT_Size size, FT_GlyphSlot glyph, FT_Bool hinting ); - FT_LOCAL void + FT_LOCAL( void ) T1_Builder_Done( T1_Builder* builder ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) T1_Builder_Check_Points( T1_Builder* builder, FT_Int count ); - FT_LOCAL void + FT_LOCAL( void ) T1_Builder_Add_Point( T1_Builder* builder, FT_Pos x, FT_Pos y, FT_Byte flag ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) T1_Builder_Add_Point1( T1_Builder* builder, FT_Pos x, FT_Pos y ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) T1_Builder_Add_Contour( T1_Builder* builder ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) T1_Builder_Start_Point( T1_Builder* builder, FT_Pos x, FT_Pos y ); - FT_LOCAL void + FT_LOCAL( void ) T1_Builder_Close_Contour( T1_Builder* builder ); @@ -190,7 +190,7 @@ FT_BEGIN_HEADER /*************************************************************************/ /*************************************************************************/ - FT_LOCAL void + FT_LOCAL( void ) T1_Decrypt( FT_Byte* buffer, FT_Offset length, FT_UShort seed ); diff --git a/src/psaux/t1decode.c b/src/psaux/t1decode.c index 398e27b3e..8a4bb84b9 100644 --- a/src/psaux/t1decode.c +++ b/src/psaux/t1decode.c @@ -330,7 +330,7 @@ /* */ /* FreeType error code. 0 means success. */ /* */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) T1_Decoder_Parse_Charstrings( T1_Decoder decoder, FT_Byte* charstring_base, FT_UInt charstring_len ) @@ -1097,7 +1097,7 @@ /* parse a single Type 1 glyph */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) T1_Decoder_Parse_Glyph( T1_Decoder decoder, FT_UInt glyph ) { @@ -1106,7 +1106,7 @@ /* initialise T1 decoder */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) T1_Decoder_Init( T1_Decoder decoder, FT_Face face, FT_Size size, @@ -1148,7 +1148,7 @@ /* finalize T1 decoder */ - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) T1_Decoder_Done( T1_Decoder decoder ) { T1_Builder_Done( &decoder->builder ); diff --git a/src/psaux/t1decode.h b/src/psaux/t1decode.h index 80000df58..1156bafad 100644 --- a/src/psaux/t1decode.h +++ b/src/psaux/t1decode.h @@ -33,16 +33,16 @@ FT_BEGIN_HEADER const T1_Decoder_FuncsRec t1_decoder_funcs; - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) T1_Decoder_Parse_Glyph( T1_Decoder decoder, FT_UInt glyph_index ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) T1_Decoder_Parse_Charstrings( T1_Decoder decoder, FT_Byte* base, FT_UInt len ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) T1_Decoder_Init( T1_Decoder decoder, FT_Face face, FT_Size size, @@ -52,7 +52,7 @@ FT_BEGIN_HEADER FT_Bool hinting, T1_Decoder_Callback parse_glyph ); - FT_LOCAL void + FT_LOCAL( void ) T1_Decoder_Done( T1_Decoder decoder ); diff --git a/src/pshinter/pshalgo1.c b/src/pshinter/pshalgo1.c index a31d8296a..a46f6c326 100644 --- a/src/pshinter/pshalgo1.c +++ b/src/pshinter/pshalgo1.c @@ -356,7 +356,7 @@ #endif - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) psh1_hint_table_optimize( PSH1_Hint_Table table, PSH_Globals globals, FT_Outline* outline, diff --git a/src/pshinter/pshglob.c b/src/pshinter/pshglob.c index 49fb8431e..4fb0788b2 100644 --- a/src/pshinter/pshglob.c +++ b/src/pshinter/pshglob.c @@ -57,7 +57,7 @@ /* org_width is is font units, result in device pixels, 26.6 format */ - FT_LOCAL_DEF FT_Pos + FT_LOCAL_DEF( FT_Pos ) psh_dimension_snap_width( PSH_Dimension dimension, FT_Int org_width ) { @@ -480,7 +480,7 @@ } - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) psh_blues_snap_stem( PSH_Blues blues, FT_Int stem_top, FT_Int stem_bot, @@ -701,7 +701,7 @@ } - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) psh_globals_funcs_init( PSH_Globals_FuncsRec* funcs ) { funcs->create = psh_globals_new; diff --git a/src/pshinter/pshglob.h b/src/pshinter/pshglob.h index 157cb2348..33045df37 100644 --- a/src/pshinter/pshglob.h +++ b/src/pshinter/pshglob.h @@ -159,18 +159,18 @@ FT_BEGIN_HEADER } PSH_AlignmentRec, *PSH_Alignment; - FT_LOCAL void + FT_LOCAL( void ) psh_globals_funcs_init( PSH_Globals_FuncsRec* funcs ); /* snap a stem width to fitter coordinates. `org_width' is in font */ /* units. The result is in device pixels (26.6 format). */ - FT_LOCAL FT_Pos + FT_LOCAL( FT_Pos ) psh_dimension_snap_width( PSH_Dimension dimension, FT_Int org_width ); /* snap a stem to one or two blue zones */ - FT_LOCAL void + FT_LOCAL( void ) psh_blues_snap_stem( PSH_Blues blues, FT_Int stem_top, FT_Int stem_bot, diff --git a/src/pshinter/pshrec.c b/src/pshinter/pshrec.c index c54ed06b4..e5485f445 100644 --- a/src/pshinter/pshrec.c +++ b/src/pshinter/pshrec.c @@ -779,7 +779,7 @@ /* destroy hints */ - FT_LOCAL void + FT_LOCAL( void ) ps_hints_done( PS_Hints hints ) { FT_Memory memory = hints->memory; @@ -793,7 +793,7 @@ } - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) ps_hints_init( PS_Hints hints, FT_Memory memory ) { @@ -1129,7 +1129,7 @@ } - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) t1_hints_funcs_init( T1_Hints_FuncsRec* funcs ) { memset( (char*)funcs, 0, sizeof ( *funcs ) ); @@ -1194,7 +1194,7 @@ } - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) t2_hints_funcs_init( T2_Hints_FuncsRec* funcs ) { memset( funcs, 0, sizeof ( *funcs ) ); diff --git a/src/pshinter/pshrec.h b/src/pshinter/pshrec.h index a939bea68..7345eb6d4 100644 --- a/src/pshinter/pshrec.h +++ b/src/pshinter/pshrec.h @@ -145,20 +145,20 @@ FT_BEGIN_HEADER /* */ /* initialize hints recorder */ - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) ps_hints_init( PS_Hints hints, FT_Memory memory ); /* finalize hints recorder */ - FT_LOCAL void + FT_LOCAL( void ) ps_hints_done( PS_Hints hints ); /* initialize Type1 hints recorder interface */ - FT_LOCAL void + FT_LOCAL( void ) t1_hints_funcs_init( T1_Hints_FuncsRec* funcs ); /* initialize Type2 hints recorder interface */ - FT_LOCAL void + FT_LOCAL( void ) t2_hints_funcs_init( T2_Hints_FuncsRec* funcs ); diff --git a/src/raster/ftraster.c b/src/raster/ftraster.c index 6c32a17ae..7d0ad9143 100644 --- a/src/raster/ftraster.c +++ b/src/raster/ftraster.c @@ -2965,7 +2965,7 @@ /* */ /* FreeType error code. 0 means success. */ /* */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) Render_Glyph( RAS_ARG ) { FT_Error error; @@ -3028,7 +3028,7 @@ /* */ /* FreeType error code. 0 means success. */ /* */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) Render_Gray_Glyph( RAS_ARG ) { Long pixel_width; @@ -3086,17 +3086,17 @@ return Raster_Err_Ok; } -#else /* FT_RASTER_OPTION_ANTI_ALIASING */ +#else /* !FT_RASTER_OPTION_ANTI_ALIASING */ - FT_LOCAL_DEF - FT_Error Render_Gray_Glyph( RAS_ARG ) + FT_LOCAL_DEF( FT_Error ) + Render_Gray_Glyph( RAS_ARG ) { FT_UNUSED_RASTER; return Raster_Err_Cannot_Render_Glyph; } -#endif /* FT_RASTER_OPTION_ANTI_ALIASING */ +#endif /* !FT_RASTER_OPTION_ANTI_ALIASING */ static void diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c index c4e8d9874..967c93c10 100644 --- a/src/sfnt/sfobjs.c +++ b/src/sfnt/sfobjs.c @@ -179,7 +179,7 @@ } - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) SFNT_Init_Face( FT_Stream stream, TT_Face face, FT_Int face_index, @@ -242,7 +242,7 @@ != SFNT_Err_Ok ) - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) SFNT_Load_Face( FT_Stream stream, TT_Face face, FT_Int face_index, @@ -592,7 +592,7 @@ #undef LOAD_ - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) SFNT_Done_Face( TT_Face face ) { FT_Memory memory = face->root.memory; diff --git a/src/sfnt/sfobjs.h b/src/sfnt/sfobjs.h index 463f0b62f..a93595674 100644 --- a/src/sfnt/sfobjs.h +++ b/src/sfnt/sfobjs.h @@ -28,21 +28,21 @@ FT_BEGIN_HEADER - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) SFNT_Init_Face( FT_Stream stream, TT_Face face, FT_Int face_index, FT_Int num_params, FT_Parameter* params ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) SFNT_Load_Face( FT_Stream stream, TT_Face face, FT_Int face_index, FT_Int num_params, FT_Parameter* params ); - FT_LOCAL void + FT_LOCAL( void ) SFNT_Done_Face( TT_Face face ); diff --git a/src/sfnt/ttcmap.c b/src/sfnt/ttcmap.c index 2fd58cf17..8bb3aeab0 100644 --- a/src/sfnt/ttcmap.c +++ b/src/sfnt/ttcmap.c @@ -106,7 +106,7 @@ /* opened). In case of error, all partially allocated tables are */ /* released. */ /* */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) TT_CharMap_Load( TT_Face face, TT_CMapTable* cmap, FT_Stream stream ) @@ -414,7 +414,7 @@ /* */ /* FreeType error code. 0 means success. */ /* */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) TT_CharMap_Free( TT_Face face, TT_CMapTable* cmap ) { diff --git a/src/sfnt/ttcmap.h b/src/sfnt/ttcmap.h index 2dea02e74..13861a8ff 100644 --- a/src/sfnt/ttcmap.h +++ b/src/sfnt/ttcmap.h @@ -27,12 +27,12 @@ FT_BEGIN_HEADER - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) TT_CharMap_Load( TT_Face face, TT_CMapTable* cmap, FT_Stream input ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) TT_CharMap_Free( TT_Face face, TT_CMapTable* cmap ); diff --git a/src/sfnt/ttcmap0.c b/src/sfnt/ttcmap0.c index 2ac62c4e5..52fbb93cc 100644 --- a/src/sfnt/ttcmap0.c +++ b/src/sfnt/ttcmap0.c @@ -45,32 +45,13 @@ #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 ) + tt_cmap_init( TT_CMap cmap, + FT_Byte* data ) { - 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; - } + cmap->data = data; + return 0; + } /************************************************************************/ @@ -124,19 +105,22 @@ FT_CALLBACK_DEF FT_UInt - tt_cmap0_char_index( FT_Byte* table, - FT_ULong char_code ) + tt_cmap0_char_index( TT_CMap cmap, + FT_UInt32 char_code ) { + FT_Byte* table = cmap->data; + return ( char_code < 256 ? table[6+char_code] : 0 ); } - FT_CALLBACK_DEF FT_ULong - tt_cmap0_char_next( FT_Byte* table, - FT_ULong char_code, + FT_CALLBACK_DEF FT_UInt32 + tt_cmap0_char_next( TT_CMap cmap, + FT_UInt32 char_code, FT_UInt *agindex ) { - FT_ULong result = 0; + FT_Byte* table = cmap->data; + FT_UInt32 result = 0; FT_UInt gindex = 0; table += 6; /* go to glyph ids */ @@ -157,20 +141,21 @@ } - FT_CALLBACK_TABLE const TT_Cmap_ClassRec tt_cmap0_class_rec = + FT_CALLBACK_TABLE const TT_CMap_ClassRec tt_cmap0_class_rec = { { 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 }, + 0, (TT_CMap_ValidateFunc) tt_cmap0_validate }; - FT_LOCAL_DEF TT_CMap_Class tt_cmap0_class = &tt_cmap0_class_rec; + FT_LOCAL_DEF( TT_CMap_Class ) tt_cmap0_class = &tt_cmap0_class_rec; #endif /* TT_CONFIG_CMAP_FORMAT_0 */ @@ -354,8 +339,8 @@ /* return sub header corresponding to a given character code */ /* NULL on invalid charcode.. */ static FT_Byte* - tt_cmap2_get_subheader( FT_Byte* table, - FT_ULong char_code ) + tt_cmap2_get_subheader( FT_Byte* table, + FT_UInt32 char_code ) { FT_Byte* result = NULL; @@ -401,9 +386,10 @@ FT_CALLBACK_DEF FT_UInt - tt_cmap2_char_index( FT_Byte* table, - FT_ULong char_code ) + tt_cmap2_char_index( TT_CMap cmap, + FT_UInt32 char_code ) { + FT_Byte* table = cmap->data; FT_UInt result = 0; FT_Byte* subheader; @@ -437,10 +423,11 @@ FT_CALLBACK_DEF FT_UInt - tt_cmap2_char_next( FT_Byte* table, - FT_ULong char_code, + tt_cmap2_char_next( TT_CMap cmap, + FT_UInt32 char_code, FT_UInt *agindex ) { + FT_Byte* table = cmap->data; FT_UInt result = 0; FT_UInt n, gindex = 0; FT_Byte* subheader; @@ -502,20 +489,21 @@ return result; } - FT_CALLBACK_TABLE const TT_Cmap_ClassRec tt_cmap2_class_rec = + FT_CALLBACK_TABLE const TT_CMap_ClassRec tt_cmap2_class_rec = { { 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 }, + 2, (TT_CMap_ValidateFunc) tt_cmap2_validate }; - FT_LOCAL_DEF TT_CMap_Class tt_cmap2_class = &tt_cmap2_class_rec; + FT_LOCAL_DEF( TT_CMap_Class ) tt_cmap2_class = &tt_cmap2_class_rec; #endif /* TT_CONFIG_CMAP_FORMAT_2 */ @@ -700,9 +688,10 @@ FT_CALLBACK_DEF FT_UInt - tt_cmap4_char_index( FT_Byte* table, - FT_ULong char_code ) + tt_cmap4_char_index( TT_CMap cmap, + FT_UInt32 char_code ) { + FT_Byte* table = cmap->data; FT_UInt result = 0; if ( char_code < 0x10000U ) @@ -749,12 +738,13 @@ - FT_CALLBACK_DEF FT_ULong - tt_cmap4_char_next( FT_Byte* table, - FT_ULong char_code, - FT_UInt *agindex ) + FT_CALLBACK_DEF FT_UInt32 + tt_cmap4_char_next( TT_CMap cmap, + FT_UInt32 char_code, + FT_UInt *agindex ) { - FT_ULong result = 0; + FT_Byte* table = cmap->data; + FT_UInt32 result = 0; FT_UInt gindex = 0; FT_Byte* p; FT_UInt code, num_segs2; @@ -830,20 +820,21 @@ return result; } - FT_CALLBACK_TABLE const TT_Cmap_ClassRec tt_cmap4_class_rec = + FT_CALLBACK_TABLE const TT_CMap_ClassRec tt_cmap4_class_rec = { { 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 }, + 4, (TT_CMap_ValidateFunc) tt_cmap4_validate }; - FT_LOCAL_DEF TT_CMap_Class tt_cmap4_class = &tt_cmap4_class_rec; + static TT_CMap_Class tt_cmap4_class = &tt_cmap4_class_rec; #endif /* TT_CONFIG_CMAP_FORMAT_4 */ @@ -912,9 +903,10 @@ FT_CALLBACK_DEF FT_UInt - tt_cmap6_char_index( FT_Byte* table, - FT_ULong char_code ) + tt_cmap6_char_index( TT_CMap cmap, + FT_UInt32 char_code ) { + FT_Byte* table = cmap->data; FT_UInt result = 0; FT_Byte* p = table + 6; FT_UInt start = TT_NEXT_USHORT(p); @@ -930,12 +922,13 @@ } - FT_CALLBACK_DEF FT_ULong - tt_cmap6_char_next( FT_Byte* table, - FT_ULong char_code, + FT_CALLBACK_DEF FT_UInt32 + tt_cmap6_char_next( TT_CMap cmap, + FT_UInt32 char_code, FT_UInt *agindex ) { - FT_ULong result = 0; + FT_Byte* table = cmap->data; + FT_UInt32 result = 0; FT_UInt gindex = 0; FT_Byte* p = table + 6; FT_UInt start = TT_NEXT_USHORT(p); @@ -971,20 +964,21 @@ } - FT_CALLBACK_TABLE const TT_Cmap_ClassRec tt_cmap6_class_rec = + FT_CALLBACK_TABLE const TT_CMap_ClassRec tt_cmap6_class_rec = { { 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 }, + 6, (TT_CMap_ValidateFunc) tt_cmap6_validate }; - FT_LOCAL_DEF TT_CMap_Class tt_cmap6_class = &tt_cmap6_class_rec; + FT_LOCAL_DEF( TT_CMap_Class ) tt_cmap6_class = &tt_cmap6_class_rec; #endif /* TT_CONFIG_CMAP_FORMAT_6 */ @@ -1054,8 +1048,8 @@ { FT_Byte* p = table + 4; FT_Byte* is32; - FT_ULong length; - FT_ULong num_groups; + FT_UInt32 length; + FT_UInt32 num_groups; if ( table + 16 + 8192 > valid->limit ) INVALID_TOO_SHORT; @@ -1073,7 +1067,7 @@ /* check groups, they must be in increasing order */ { - FT_ULong n, start, end, start_id, count, last = 0; + FT_UInt32 n, start, end, start_id, count, last = 0; for ( n = 0; n < num_groups; n++ ) { @@ -1095,7 +1089,7 @@ if ( start_id + end - start >= valid->num_glyphs ) INVALID_GLYPH_ID; - count = (FT_ULong)(end - start + 1); + count = (FT_UInt32)(end - start + 1); if ( start & ~0xFFFFU ) { @@ -1139,13 +1133,14 @@ FT_CALLBACK_DEF FT_UInt - tt_cmap8_char_index( FT_Byte* table, - FT_ULong char_code ) + tt_cmap8_char_index( TT_CMap cmap, + FT_UInt32 char_code ) { - FT_UInt result = 0; - FT_Byte* p = table + 8204; - FT_ULong num_groups = TT_NEXT_ULONG(p); - FT_ULong n, start, end, start_id; + FT_Byte* table = cmap->data; + FT_UInt result = 0; + FT_Byte* p = table + 8204; + FT_UInt32 num_groups = TT_NEXT_ULONG(p); + FT_UInt32 n, start, end, start_id; for ( ; num_groups > 0; num_groups-- ) { @@ -1166,16 +1161,16 @@ } - FT_CALLBACK_DEF FT_ULong - tt_cmap8_char_next( FT_Byte* table, - FT_ULong char_code, + FT_CALLBACK_DEF FT_UInt32 + tt_cmap8_char_next( TT_CMap cmap, + FT_UInt32 char_code, FT_UInt *agindex ) { - FT_ULong result = 0; + FT_UInt32 result = 0; FT_UInt gindex = 0; FT_Byte* p = table + 8204; - FT_ULong num_groups = TT_NEXT_ULONG(p); - FT_ULong n, start, end, start_id; + FT_UInt32 num_groups = TT_NEXT_ULONG(p); + FT_UInt32 n, start, end, start_id; ++char_code; p = table + 8208; @@ -1208,20 +1203,21 @@ } - FT_CALLBACK_TABLE const TT_Cmap_ClassRec tt_cmap8_class_rec = + FT_CALLBACK_TABLE const TT_CMap_ClassRec tt_cmap8_class_rec = { { 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 }, + 8, (TT_CMap_ValidateFunc) tt_cmap8_validate }; - FT_LOCAL_DEF TT_CMap_Class tt_cmap8_class = &tt_cmap8_class_rec; + FT_LOCAL_DEF( TT_CMap_Class ) tt_cmap8_class = &tt_cmap8_class_rec; #endif /* TT_CONFIG_CMAP_FORMAT_8 */ @@ -1286,14 +1282,15 @@ FT_CALLBACK_DEF FT_UInt - tt_cmap10_char_index( FT_Byte* table, - FT_ULong char_code ) + tt_cmap10_char_index( TT_CMap cmap, + FT_UInt32 char_code ) { - FT_UInt result = 0; - FT_Byte* p = table + 12; - FT_ULong start = TT_NEXT_ULONG(p); - FT_ULong count = TT_NEXT_ULONG(p); - FT_ULong index = (FT_ULong)( char_code - start ); + FT_Byte* table = cmap->data; + FT_UInt result = 0; + FT_Byte* p = table + 12; + FT_UInt32 start = TT_NEXT_ULONG(p); + FT_UInt32 count = TT_NEXT_ULONG(p); + FT_UInt32 index = (FT_ULong)( char_code - start ); if ( index < count ) { @@ -1304,23 +1301,24 @@ } - FT_CALLBACK_DEF FT_ULong - tt_cmap10_char_next( FT_Byte* table, - FT_ULong char_code, + FT_CALLBACK_DEF FT_UInt32 + tt_cmap10_char_next( TT_CMap cmap, + FT_UInt32 char_code, FT_UInt *agindex ) { - FT_ULong result = 0; - FT_UInt gindex = 0; - FT_Byte* p = table + 12; - FT_ULong start = TT_NEXT_ULONG(p); - FT_ULong count = TT_NEXT_ULONG(p); - FT_ULong index; + FT_Byte* table = cmap->data; + FT_UInt32 result = 0; + FT_UInt gindex = 0; + FT_Byte* p = table + 12; + FT_UInt32 start = TT_NEXT_ULONG(p); + FT_UInt32 count = TT_NEXT_ULONG(p); + FT_UInt32 index; char_code++; if ( char_code < start ) char_code = start; - index = (FT_ULong)( char_code - start ); + index = (FT_UInt32)( char_code - start ); p += 2*index; for ( ; index < count; index++ ) @@ -1342,20 +1340,21 @@ } - FT_CALLBACK_TABLE const TT_Cmap_ClassRec tt_cmap10_class_rec = + FT_CALLBACK_TABLE const TT_CMap_ClassRec tt_cmap10_class_rec = { { 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 }, + 10, (TT_CMap_ValidateFunc) tt_cmap10_validate }; - FT_LOCAL_DEF TT_CMap_Class tt_cmap10_class = &tt_cmap10_class_rec; + FT_LOCAL_DEF( TT_CMap_Class ) tt_cmap10_class = &tt_cmap10_class_rec; #endif /* TT_CONFIG_CMAP_FORMAT_10 */ @@ -1445,13 +1444,13 @@ FT_CALLBACK_DEF FT_UInt - tt_cmap12_char_index( FT_Byte* table, - FT_ULong char_code ) + tt_cmap12_char_index( TT_CMap cmap, + FT_UInt32 char_code ) { - FT_UInt result = 0; - FT_Byte* p = table + 12; - FT_ULong num_groups = TT_NEXT_ULONG(p); - FT_ULong n, start, end, start_id; + FT_UInt result = 0; + FT_Byte* p = table + 12; + FT_UInt32 num_groups = TT_NEXT_ULONG(p); + FT_UInt32 n, start, end, start_id; for ( ; num_groups > 0; num_groups-- ) { @@ -1472,16 +1471,17 @@ } - FT_CALLBACK_DEF FT_ULong - tt_cmap12_char_next( FT_Byte* table, - FT_ULong char_code, + FT_CALLBACK_DEF FT_UInt32 + tt_cmap12_char_next( TT_CMap cmap, + FT_UInt32 char_code, FT_UInt *agindex ) { - FT_ULong result = 0; + FT_Byte* table = cmap->data; + FT_UInt32 result = 0; FT_UInt gindex = 0; FT_Byte* p = table + 12; - FT_ULong num_groups = TT_NEXT_ULONG(p); - FT_ULong n, start, end, start_id; + FT_UInt32 num_groups = TT_NEXT_ULONG(p); + FT_UInt32 n, start, end, start_id; ++char_code; p = table + 8208; @@ -1514,21 +1514,124 @@ } - FT_CALLBACK_TABLE const TT_Cmap_ClassRec tt_cmap12_class_rec = + FT_CALLBACK_TABLE const TT_CMap_ClassRec tt_cmap12_class_rec = { { 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 }, + 12, (TT_CMap_ValidateFunc) tt_cmap12_validate }; - FT_LOCAL_DEF TT_CMap_Class tt_cmap12_class = &tt_cmap12_class_rec; + FT_LOCAL_DEF( TT_CMap_Class ) tt_cmap12_class = &tt_cmap12_class_rec; #endif /* TT_CONFIG_CMAP_FORMAT_12 */ + + + static TT_CMap_Class tt_cmap_classes[] = + { +#ifdef TT_CONFIG_CMAP_FORMAT_0 + tt_cmap0_class, +#endif + +#ifdef TT_CONFIG_CMAP_FORMAT_2 + tt_cmap2_class, +#endif + +#ifdef TT_CONFIG_CMAP_FORMAT_4 + tt_cmap4_class, +#endif + +#ifdef TT_CONFIG_CMAP_FORMAT_6 + tt_cmap6_class, +#endif + +#ifdef TT_CONFIG_CMAP_FORMAT_8 + tt_cmap8_class, +#endif + +#ifdef TT_CONFIG_CMAP_FORMAT_10 + tt_cmap10_class, +#endif + +#ifdef TT_CONFIG_CMAP_FORMAT_12 + tt_cmap12_class, +#endif + + NULL, + }; + + + /* parse the 'cmap' table and build the corresponding TT_CMap objects */ + /* in the current face.. */ + /* */ + FT_LOCAL_DEF( FT_Error ) + TT_Build_CMaps( TT_Face face ) + { + TT_CMap_Class clazz; + FT_ValidatorRec valid; + FT_UInt num_cmaps; + FT_Byte* table = face->cmap_table; + FT_Byte* limit = table + face->cmap_size; + FT_Byte* p = table; + FT_UInt format; + + if ( p + 4 < limit ) + return FT_Err_Invalid_Table; + + /* only recognize format 0 */ + if ( NEXT_UShort(p) != 0 ) + return FT_Err_Invalid_Table; + + num_cmaps = NEXT_UShort(p); + + for ( ; num_cmaps > 0 && p + 8 <= limit; num_cmaps-- ) + { + FT_CharMapRec charmap; + FT_UInt32 offset; + + charmap.platform_id = NEXT_UShort(p); + charmap.encoding_id = NEXT_UShort(p); + offset = NEXT_ULong(p); + + if ( offset && table + offset + 2 < limit ) + { + FT_Byte* cmap = table + offset; + FT_UInt format = PEEK_UShort(cmap); + TT_CMap_Class* pclazz = tt_cmap_classes; + TT_CMap_Class clazz; + + for ( ; *pclazz; pclazz++ ) + { + clazz = *pclazz; + if ( clazz->format == format ) + { + volatile FT_Validator valid; + + ft_validator_init( &valid, cmap, limit, + FT_VALIDATE_LEVEL_DEFAULT ); + + if ( setjmp( valid.jump_buffer ) == 0 ) + clazz->validate( cmap, &valid ); + + if ( valid.error == 0 ) + (void)FT_CMap_New( clazz, cmap, face, NULL ); + else + FT_ERROR(( "TT_Build_CMaps: broken cmap sub-table ignored !!\n" )); + } + } + } + } + + return 0; + } + + + /* END */ diff --git a/src/sfnt/ttcmap0.h b/src/sfnt/ttcmap0.h index 338ae2ffe..90e8a8924 100644 --- a/src/sfnt/ttcmap0.h +++ b/src/sfnt/ttcmap0.h @@ -27,14 +27,29 @@ FT_BEGIN_HEADER - FT_LOCAL FT_Error - TT_CharMap_Load( TT_Face face, - TT_CMapTable* cmap, - FT_Stream input ); + typedef struct TT_CMapRec_ + { + FT_CMapRec cmap; + FT_Byte* data; - FT_LOCAL FT_Error - TT_CharMap_Free( TT_Face face, - TT_CMapTable* cmap ); + } TT_CMapRec, *TT_CMap; + + 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; + FT_UInt format; + TT_CMap_ValidateFunc validate; + + } TT_CMap_ClassRec; + + + FT_LOCAL( FT_Error ) + TT_Build_CMaps( TT_Face face ) FT_END_HEADER diff --git a/src/sfnt/ttload.c b/src/sfnt/ttload.c index 8dc5cdc2a..4127bbd1d 100644 --- a/src/sfnt/ttload.c +++ b/src/sfnt/ttload.c @@ -53,7 +53,7 @@ /* */ /* A pointer to the table directory entry. 0 if not found. */ /* */ - FT_LOCAL_DEF TT_Table* + FT_LOCAL_DEF( TT_Table* ) TT_LookUp_Table( TT_Face face, FT_ULong tag ) { @@ -104,7 +104,7 @@ /* */ /* FreeType error code. 0 means success. */ /* */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) TT_Goto_Table( TT_Face face, FT_ULong tag, FT_Stream stream, @@ -159,7 +159,7 @@ /* The header will be checked whether it is valid by looking at the */ /* values of `search_range', `entry_selector', and `range_shift'. */ /* */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) TT_Load_SFNT_Header( TT_Face face, FT_Stream stream, FT_Long face_index, @@ -294,7 +294,7 @@ /* */ /* The stream cursor must be at the font file's origin. */ /* */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) TT_Load_Directory( TT_Face face, FT_Stream stream, SFNT_Header* sfnt ) @@ -388,7 +388,7 @@ /* */ /* FreeType error code. 0 means success. */ /* */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) TT_Load_Any( TT_Face face, FT_ULong tag, FT_Long offset, @@ -519,7 +519,7 @@ } - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) TT_Load_Header( TT_Face face, FT_Stream stream ) { @@ -529,7 +529,7 @@ #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) TT_Load_Bitmap_Header( TT_Face face, FT_Stream stream ) { @@ -554,7 +554,7 @@ /* */ /* FreeType error code. 0 means success. */ /* */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) TT_Load_MaxProfile( TT_Face face, FT_Stream stream ) { @@ -816,7 +816,7 @@ /* */ /* FreeType error code. 0 means success. */ /* */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) TT_Load_Metrics_Header( TT_Face face, FT_Stream stream, FT_Bool vertical ) @@ -915,7 +915,7 @@ /* */ /* FreeType error code. 0 means success. */ /* */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) TT_Load_Names( TT_Face face, FT_Stream stream ) { @@ -1080,7 +1080,7 @@ /* */ /* face :: A handle to the target face object. */ /* */ - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) TT_Free_Names( TT_Face face ) { FT_Memory memory = face->root.driver->root.memory; @@ -1115,7 +1115,7 @@ /* */ /* FreeType error code. 0 means success. */ /* */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) TT_Load_CMap( TT_Face face, FT_Stream stream ) { @@ -1229,7 +1229,7 @@ /* */ /* FreeType error code. 0 means success. */ /* */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) TT_Load_OS2( TT_Face face, FT_Stream stream ) { @@ -1371,7 +1371,7 @@ /* */ /* FreeType error code. 0 means success. */ /* */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) TT_Load_PostScript( TT_Face face, FT_Stream stream ) { @@ -1429,7 +1429,7 @@ /* */ /* FreeType error code. 0 means success. */ /* */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) TT_Load_PCLT( TT_Face face, FT_Stream stream ) { @@ -1496,7 +1496,7 @@ /* */ /* FreeType error code. 0 means success. */ /* */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) TT_Load_Gasp( TT_Face face, FT_Stream stream ) { @@ -1573,7 +1573,7 @@ /* */ /* FreeType error code. 0 means success. */ /* */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) TT_Load_Kern( TT_Face face, FT_Stream stream ) { @@ -1720,7 +1720,7 @@ /* */ /* FreeType error code. 0 means success. */ /* */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) TT_Load_Hdmx( TT_Face face, FT_Stream stream ) { @@ -1798,7 +1798,7 @@ /* */ /* face :: A handle to the target face object. */ /* */ - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) TT_Free_Hdmx( TT_Face face ) { if ( face ) diff --git a/src/sfnt/ttload.h b/src/sfnt/ttload.h index 2e67e036c..45e1ba162 100644 --- a/src/sfnt/ttload.h +++ b/src/sfnt/ttload.h @@ -29,29 +29,29 @@ FT_BEGIN_HEADER - FT_LOCAL TT_Table* + FT_LOCAL( TT_Table* ) TT_LookUp_Table( TT_Face face, FT_ULong tag ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) TT_Goto_Table( TT_Face face, FT_ULong tag, FT_Stream stream, FT_ULong* length ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) TT_Load_SFNT_Header( TT_Face face, FT_Stream stream, FT_Long face_index, SFNT_Header* sfnt ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) TT_Load_Directory( TT_Face face, FT_Stream stream, SFNT_Header* sfnt ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) TT_Load_Any( TT_Face face, FT_ULong tag, FT_Long offset, @@ -59,70 +59,70 @@ FT_BEGIN_HEADER FT_ULong* length ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) TT_Load_Header( TT_Face face, FT_Stream stream ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) TT_Load_Metrics_Header( TT_Face face, FT_Stream stream, FT_Bool vertical ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) TT_Load_CMap( TT_Face face, FT_Stream stream ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) TT_Load_MaxProfile( TT_Face face, FT_Stream stream ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) TT_Load_Names( TT_Face face, FT_Stream stream ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) TT_Load_OS2( TT_Face face, FT_Stream stream ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) TT_Load_PostScript( TT_Face face, FT_Stream stream ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) TT_Load_Hdmx( TT_Face face, FT_Stream stream ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) TT_Load_PCLT( TT_Face face, FT_Stream stream ); - FT_LOCAL void + FT_LOCAL( void ) TT_Free_Names( TT_Face face ); - FT_LOCAL void + FT_LOCAL( void ) TT_Free_Hdmx ( TT_Face face ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) TT_Load_Kern( TT_Face face, FT_Stream stream ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) TT_Load_Gasp( TT_Face face, FT_Stream stream ); #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) TT_Load_Bitmap_Header( TT_Face face, FT_Stream stream ); diff --git a/src/sfnt/ttpost.c b/src/sfnt/ttpost.c index 6942ff4a1..fa2baeec4 100644 --- a/src/sfnt/ttpost.c +++ b/src/sfnt/ttpost.c @@ -377,7 +377,7 @@ } - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) TT_Free_Post_Names( TT_Face face ) { FT_Memory memory = face->root.memory; @@ -441,7 +441,7 @@ /* */ /* FreeType error code. 0 means success. */ /* */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) TT_Get_PS_Name( TT_Face face, FT_UInt index, FT_String** PSname ) diff --git a/src/sfnt/ttpost.h b/src/sfnt/ttpost.h index 2c3012228..3c42e36c6 100644 --- a/src/sfnt/ttpost.h +++ b/src/sfnt/ttpost.h @@ -29,12 +29,12 @@ FT_BEGIN_HEADER - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) TT_Get_PS_Name( TT_Face face, FT_UInt index, FT_String** PSname ); - FT_LOCAL void + FT_LOCAL( void ) TT_Free_Post_Names( TT_Face face ); diff --git a/src/sfnt/ttsbit.c b/src/sfnt/ttsbit.c index 645d99e5b..41cdf668d 100644 --- a/src/sfnt/ttsbit.c +++ b/src/sfnt/ttsbit.c @@ -391,7 +391,7 @@ /* */ /* FreeType error code. 0 means success. */ /* */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) TT_Load_SBit_Strikes( TT_Face face, FT_Stream stream ) { @@ -588,7 +588,7 @@ /* */ /* face :: The target face object. */ /* */ - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) TT_Free_SBit_Strikes( TT_Face face ) { FT_Memory memory = face->root.memory; @@ -623,7 +623,7 @@ } - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) TT_Set_SBit_Strike( TT_Face face, FT_Int x_ppem, FT_Int y_ppem, @@ -1395,7 +1395,7 @@ /* */ /* The `map.buffer' field is always freed before the glyph is loaded. */ /* */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) TT_Load_SBit_Image( TT_Face face, FT_ULong strike_index, FT_UInt glyph_index, diff --git a/src/sfnt/ttsbit.h b/src/sfnt/ttsbit.h index 2e0c23627..b421c8625 100644 --- a/src/sfnt/ttsbit.h +++ b/src/sfnt/ttsbit.h @@ -27,21 +27,21 @@ FT_BEGIN_HEADER - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) TT_Load_SBit_Strikes( TT_Face face, FT_Stream stream ); - FT_LOCAL void + FT_LOCAL( void ) TT_Free_SBit_Strikes( TT_Face face ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) TT_Set_SBit_Strike( TT_Face face, FT_Int x_ppem, FT_Int y_ppem, FT_ULong *astrike_index ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) TT_Load_SBit_Image( TT_Face face, FT_ULong strike_index, FT_UInt glyph_index, diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index 32c5a3514..ba5ee7212 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -81,7 +81,7 @@ /* This function will much probably move to another component in the */ /* near future, but I haven't decided which yet. */ /* */ - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) TT_Get_Metrics( TT_HoriHeader* header, FT_UInt index, FT_Short* bearing, @@ -581,7 +581,7 @@ } - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) TT_Init_Glyph_Loading( TT_Face face ) { face->access_glyph_frame = TT_Access_Glyph_Frame; @@ -1416,7 +1416,7 @@ /* */ /* FreeType error code. 0 means success. */ /* */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) TT_Load_Glyph( TT_Size size, TT_GlyphSlot glyph, FT_UShort glyph_index, diff --git a/src/truetype/ttgload.h b/src/truetype/ttgload.h index ef0a4d7a1..eee9057c2 100644 --- a/src/truetype/ttgload.h +++ b/src/truetype/ttgload.h @@ -31,16 +31,16 @@ FT_BEGIN_HEADER - FT_LOCAL void + FT_LOCAL( void ) TT_Get_Metrics( TT_HoriHeader* header, FT_UInt index, FT_Short* bearing, FT_UShort* advance ); - FT_LOCAL void + FT_LOCAL( void ) TT_Init_Glyph_Loading( TT_Face face ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) TT_Load_Glyph( TT_Size size, TT_GlyphSlot glyph, FT_UShort glyph_index, diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index 9748e9a4e..1c08addc7 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -256,7 +256,7 @@ /* */ /* FreeType error code. 0 means success. */ /* */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) TT_Goto_CodeRange( TT_ExecContext exec, FT_Int range, FT_Long IP ) @@ -306,7 +306,7 @@ /* */ /* FreeType error code. 0 means success. */ /* */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) TT_Set_CodeRange( TT_ExecContext exec, FT_Int range, void* base, @@ -341,7 +341,7 @@ /* */ /* Does not set the Error variable. */ /* */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) TT_Clear_CodeRange( TT_ExecContext exec, FT_Int range ) { @@ -380,7 +380,7 @@ /* */ /* Only the glyph loader and debugger should call this function. */ /* */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) TT_Destroy_Context( TT_ExecContext exec, FT_Memory memory ) { @@ -544,7 +544,7 @@ /* */ /* Only the glyph loader and debugger should call this function. */ /* */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) TT_Load_Context( TT_ExecContext exec, TT_Face face, TT_Size size ) @@ -647,7 +647,7 @@ /* */ /* Only the glyph loader and debugger should call this function. */ /* */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) TT_Save_Context( TT_ExecContext exec, TT_Size size ) { @@ -694,7 +694,7 @@ /* */ /* Only the glyph loader and debugger should call this function. */ /* */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) TT_Run_Context( TT_ExecContext exec, FT_Bool debug ) { @@ -815,7 +815,7 @@ /* */ /* Only the glyph loader and debugger should call this function. */ /* */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) TT_Done_Context( TT_ExecContext exec ) { /* Nothing at all for now */ diff --git a/src/truetype/ttinterp.h b/src/truetype/ttinterp.h index f8d8781fe..d0f22b018 100644 --- a/src/truetype/ttinterp.h +++ b/src/truetype/ttinterp.h @@ -224,18 +224,18 @@ FT_BEGIN_HEADER extern const TT_GraphicsState tt_default_graphics_state; - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) TT_Goto_CodeRange( TT_ExecContext exec, FT_Int range, FT_Long IP ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) TT_Set_CodeRange( TT_ExecContext exec, FT_Int range, void* base, FT_Long length ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) TT_Clear_CodeRange( TT_ExecContext exec, FT_Int range ); @@ -263,23 +263,23 @@ FT_BEGIN_HEADER TT_New_Context( TT_Face face ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) TT_Done_Context( TT_ExecContext exec ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) TT_Destroy_Context( TT_ExecContext exec, FT_Memory memory ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) TT_Load_Context( TT_ExecContext exec, TT_Face face, TT_Size size ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) TT_Save_Context( TT_ExecContext exec, TT_Size ins ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) TT_Run_Context( TT_ExecContext exec, FT_Bool debug ); diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c index 6e0663d3b..97575127e 100644 --- a/src/truetype/ttobjs.c +++ b/src/truetype/ttobjs.c @@ -65,7 +65,7 @@ /* */ /* zone :: A pointer to the target glyph zone. */ /* */ - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) TT_Done_GlyphZone( TT_GlyphZone* zone ) { FT_Memory memory = zone->memory; @@ -102,7 +102,7 @@ /* */ /* FreeType error code. 0 means success. */ /* */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) TT_New_GlyphZone( FT_Memory memory, FT_UShort maxPoints, FT_Short maxContours, @@ -153,7 +153,7 @@ /* */ /* FreeType error code. 0 means success. */ /* */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) TT_Init_Face( FT_Stream stream, TT_Face face, FT_Int face_index, @@ -224,7 +224,7 @@ /* */ /* face :: A pointer to the face object to destroy. */ /* */ - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) TT_Done_Face( TT_Face face ) { FT_Memory memory = face->root.memory; @@ -277,7 +277,7 @@ /* */ /* FreeType error code. 0 means success. */ /* */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) TT_Init_Size( TT_Size size ) { FT_Error error = TT_Err_Ok; @@ -464,7 +464,7 @@ /* */ /* size :: A handle to the target size object. */ /* */ - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) TT_Done_Size( TT_Size size ) { @@ -756,7 +756,7 @@ /* */ /* size :: A handle to the target size object. */ /* */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) TT_Reset_Size( TT_Size size ) { FT_Face face; @@ -808,7 +808,7 @@ /* */ /* FreeType error code. 0 means success. */ /* */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) TT_Init_Driver( TT_Driver driver ) { FT_Error error; @@ -839,7 +839,7 @@ /* */ /* driver :: A handle to the target TrueType driver. */ /* */ - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) TT_Done_Driver( TT_Driver driver ) { /* destroy extensions registry if needed */ diff --git a/src/truetype/ttobjs.h b/src/truetype/ttobjs.h index d780ce420..2f6a58b58 100644 --- a/src/truetype/ttobjs.h +++ b/src/truetype/ttobjs.h @@ -107,10 +107,10 @@ FT_BEGIN_HEADER #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER - FT_LOCAL void + FT_LOCAL( void ) TT_Done_GlyphZone( TT_GlyphZone* zone ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) TT_New_GlyphZone( FT_Memory memory, FT_UShort maxPoints, FT_Short maxContours, @@ -378,14 +378,14 @@ FT_BEGIN_HEADER /* */ /* Face functions */ /* */ - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) TT_Init_Face( FT_Stream stream, TT_Face face, FT_Int face_index, FT_Int num_params, FT_Parameter* params ); - FT_LOCAL void + FT_LOCAL( void ) TT_Done_Face( TT_Face face ); @@ -393,13 +393,13 @@ FT_BEGIN_HEADER /* */ /* Size functions */ /* */ - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) TT_Init_Size( TT_Size size ); - FT_LOCAL void + FT_LOCAL( void ) TT_Done_Size( TT_Size size ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) TT_Reset_Size( TT_Size size ); @@ -407,10 +407,10 @@ FT_BEGIN_HEADER /* */ /* Driver functions */ /* */ - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) TT_Init_Driver( TT_Driver driver ); - FT_LOCAL void + FT_LOCAL( void ) TT_Done_Driver( TT_Driver driver ); diff --git a/src/truetype/ttpload.c b/src/truetype/ttpload.c index 478c67b0f..c57b098cf 100644 --- a/src/truetype/ttpload.c +++ b/src/truetype/ttpload.c @@ -54,7 +54,7 @@ /* */ /* FreeType error code. 0 means success. */ /* */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) TT_Load_Locations( TT_Face face, FT_Stream stream ) { @@ -147,7 +147,7 @@ /* */ /* FreeType error code. 0 means success. */ /* */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) TT_Load_CVT( TT_Face face, FT_Stream stream ) { @@ -214,7 +214,7 @@ /* */ /* FreeType error code. 0 means success. */ /* */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) TT_Load_Programs( TT_Face face, FT_Stream stream ) { diff --git a/src/truetype/ttpload.h b/src/truetype/ttpload.h index 83b0b3a29..26de13ea9 100644 --- a/src/truetype/ttpload.h +++ b/src/truetype/ttpload.h @@ -27,15 +27,15 @@ FT_BEGIN_HEADER - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) TT_Load_Locations( TT_Face face, FT_Stream stream ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) TT_Load_CVT( TT_Face face, FT_Stream stream ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) TT_Load_Programs( TT_Face face, FT_Stream stream ); diff --git a/src/type1/t1afm.c b/src/type1/t1afm.c index 04b2461e0..edb740876 100644 --- a/src/type1/t1afm.c +++ b/src/type1/t1afm.c @@ -35,7 +35,7 @@ #define FT_COMPONENT trace_t1afm - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) T1_Done_AFM( FT_Memory memory, T1_AFM* afm ) { @@ -156,7 +156,7 @@ /* parse an AFM file -- for now, only read the kerning pairs */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) T1_Read_AFM( FT_Face t1_face, FT_Stream stream ) { @@ -244,7 +244,7 @@ /* find the kerning for a given glyph pair */ - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) T1_Get_Kerning( T1_AFM* afm, FT_UInt glyph1, FT_UInt glyph2, diff --git a/src/type1/t1afm.h b/src/type1/t1afm.h index a82875375..c1788f53c 100644 --- a/src/type1/t1afm.h +++ b/src/type1/t1afm.h @@ -43,15 +43,15 @@ FT_BEGIN_HEADER } T1_AFM; - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) T1_Read_AFM( FT_Face face, FT_Stream stream ); - FT_LOCAL void + FT_LOCAL( void ) T1_Done_AFM( FT_Memory memory, T1_AFM* afm ); - FT_LOCAL void + FT_LOCAL( void ) T1_Get_Kerning( T1_AFM* afm, FT_UInt glyph1, FT_UInt glyph2, diff --git a/src/type1/t1cmap.c b/src/type1/t1cmap.c index 852b551e9..de6113476 100644 --- a/src/type1/t1cmap.c +++ b/src/type1/t1cmap.c @@ -112,7 +112,7 @@ }; - FT_LOCAL_DEF T1_CMap_Class + FT_LOCAL_DEF( T1_CMap_Class ) t1_cmap_standard_class = &t1_cmap_standard_class_rec; @@ -138,7 +138,7 @@ }; - FT_LOCAL_DEF T1_CMap_Class + FT_LOCAL_DEF( T1_CMap_Class ) t1_cmap_expert_class = &t1_cmap_expert_class_rec; @@ -232,7 +232,7 @@ }; - FT_LOCAL_DEF FT_CMap_Class + FT_LOCAL_DEF( FT_CMap_Class ) t1_cmap_custom_class = &t1_cmap_custom_class_rec; @@ -301,7 +301,7 @@ new_count, sizeof(T1_CMapUniPairRec), t1_cmap_uni_pair_compare ); - + cmap->num_pairs = new_count; } } @@ -316,7 +316,7 @@ { FT_Face face = FT_CMAP_FACE(cmap); FT_Memory memory = FT_FACE_MEMORY(face); - + FREE( cmap->pairs ); cmap->num_pairs = 0; } @@ -330,15 +330,15 @@ FT_UInt max = cmap->num_pairs; FT_UInt mid; T1_CMapUniPair pair; - + while ( min < max ) { mid = min + (max - min)/2; pair = cmap->pairs + mid; - + if ( pair->unicode == char_code ) return pair->gindex; - + if ( pair->unicode < char_code ) min = mid+1; else @@ -365,26 +365,26 @@ { mid = min + (max - min)/2; pair = cmap->pairs + mid; - + if ( pair->unicode == char_code ) { result = pair->gindex; if ( result != 0 ) goto Exit; - + char_code++; goto Restart; } - + if ( pair->unicode < char_code ) min = mid+1; else max = mid; } - + /* we didn't find it, but we have a pair just above it */ char_code = 0; - + if ( min < cmap->num_pairs ) { pair = cmap->num_pairs + min; diff --git a/src/type1/t1gload.c b/src/type1/t1gload.c index a0b4390d7..a4e2f53a8 100644 --- a/src/type1/t1gload.c +++ b/src/type1/t1gload.c @@ -73,7 +73,7 @@ } - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) T1_Compute_Max_Advance( T1_Face face, FT_Int* max_advance ) { @@ -136,7 +136,7 @@ /*************************************************************************/ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) T1_Load_Glyph( T1_GlyphSlot glyph, T1_Size size, FT_Int glyph_index, diff --git a/src/type1/t1gload.h b/src/type1/t1gload.h index d1960e579..962af59e0 100644 --- a/src/type1/t1gload.h +++ b/src/type1/t1gload.h @@ -27,11 +27,11 @@ FT_BEGIN_HEADER - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) T1_Compute_Max_Advance( T1_Face face, FT_Int* max_advance ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) T1_Load_Glyph( T1_GlyphSlot glyph, T1_Size size, FT_Int glyph_index, diff --git a/src/type1/t1load.c b/src/type1/t1load.c index 24e42eee2..d669e6a61 100644 --- a/src/type1/t1load.c +++ b/src/type1/t1load.c @@ -180,7 +180,7 @@ } - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) T1_Get_Multi_Master( T1_Face face, FT_Multi_Master* master ) { @@ -212,7 +212,7 @@ } - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) T1_Set_MM_Blend( T1_Face face, FT_UInt num_coords, FT_Fixed* coords ) @@ -258,7 +258,7 @@ } - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) T1_Set_MM_Design( T1_Face face, FT_UInt num_coords, FT_Long* coords ) @@ -328,7 +328,7 @@ } - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) T1_Done_Blend( T1_Face face ) { FT_Memory memory = face->root.memory; @@ -1637,7 +1637,7 @@ } - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) T1_Open_Face( T1_Face face ) { T1_Loader loader; diff --git a/src/type1/t1load.h b/src/type1/t1load.h index 815f63477..26f01cc80 100644 --- a/src/type1/t1load.h +++ b/src/type1/t1load.h @@ -51,26 +51,26 @@ FT_BEGIN_HEADER } T1_Loader; - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) T1_Open_Face( T1_Face face ); #ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) T1_Get_Multi_Master( T1_Face face, FT_Multi_Master* master ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) T1_Set_MM_Blend( T1_Face face, FT_UInt num_coords, FT_Fixed* coords ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) T1_Set_MM_Design( T1_Face face, FT_UInt num_coords, FT_Long* coords ); - FT_LOCAL void + FT_LOCAL( void ) T1_Done_Blend( T1_Face face ); #endif /* !T1_CONFIG_OPTION_NO_MM_SUPPORT */ diff --git a/src/type1/t1objs.c b/src/type1/t1objs.c index 514648737..16ab0fc79 100644 --- a/src/type1/t1objs.c +++ b/src/type1/t1objs.c @@ -71,7 +71,7 @@ } - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) T1_Size_Done( T1_Size size ) { if ( size->root.internal ) @@ -88,7 +88,7 @@ } - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) T1_Size_Init( T1_Size size ) { FT_Error error = 0; @@ -111,7 +111,7 @@ } - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) T1_Size_Reset( T1_Size size ) { PSH_Globals_Funcs funcs = T1_Size_Get_Globals_Funcs( size ); @@ -133,14 +133,14 @@ /* */ /*************************************************************************/ - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) T1_GlyphSlot_Done( T1_GlyphSlot slot ) { slot->root.internal->glyph_hints = 0; } - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) T1_GlyphSlot_Init( T1_GlyphSlot slot ) { T1_Face face; @@ -183,7 +183,7 @@ /* */ /* face :: A typeless pointer to the face object to destroy. */ /* */ - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) T1_Face_Done( T1_Face face ) { FT_Memory memory; @@ -267,7 +267,7 @@ /* */ /* FreeType error code. 0 means success. */ /* */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) T1_Face_Init( FT_Stream stream, T1_Face face, FT_Int face_index, @@ -530,7 +530,7 @@ /* */ /* FreeType error code. 0 means success. */ /* */ - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) T1_Driver_Init( T1_Driver driver ) { FT_UNUSED( driver ); @@ -550,7 +550,7 @@ /* */ /* driver :: A handle to the target Type 1 driver. */ /* */ - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) T1_Driver_Done( T1_Driver driver ) { FT_UNUSED( driver ); diff --git a/src/type1/t1objs.h b/src/type1/t1objs.h index 25ed6b57f..43dddaae4 100644 --- a/src/type1/t1objs.h +++ b/src/type1/t1objs.h @@ -105,13 +105,13 @@ FT_BEGIN_HEADER } T1_SizeRec; - FT_LOCAL void + FT_LOCAL( void ) T1_Size_Done( T1_Size size ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) T1_Size_Reset( T1_Size size ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) T1_Size_Init( T1_Size size ); @@ -139,26 +139,26 @@ FT_BEGIN_HEADER } T1_GlyphSlotRec; - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) T1_Face_Init( FT_Stream stream, T1_Face face, FT_Int face_index, FT_Int num_params, FT_Parameter* params ); - FT_LOCAL void + FT_LOCAL( void ) T1_Face_Done( T1_Face face ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) T1_GlyphSlot_Init( T1_GlyphSlot slot ); - FT_LOCAL void + FT_LOCAL( void ) T1_GlyphSlot_Done( T1_GlyphSlot slot ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) T1_Driver_Init( T1_Driver driver ); - FT_LOCAL void + FT_LOCAL( void ) T1_Driver_Done( T1_Driver driver ); diff --git a/src/type1/t1parse.c b/src/type1/t1parse.c index e3ae4762a..fe6ee4fb2 100644 --- a/src/type1/t1parse.c +++ b/src/type1/t1parse.c @@ -118,7 +118,7 @@ } - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) T1_New_Parser( T1_Parser parser, FT_Stream stream, FT_Memory memory, @@ -227,7 +227,7 @@ } - FT_LOCAL_DEF void + FT_LOCAL_DEF( void ) T1_Finalize_Parser( T1_Parser parser ) { FT_Memory memory = parser->root.memory; @@ -267,7 +267,7 @@ } - FT_LOCAL_DEF FT_Error + FT_LOCAL_DEF( FT_Error ) T1_Get_Private_Dict( T1_Parser parser, PSAux_Service psaux ) { diff --git a/src/type1/t1parse.h b/src/type1/t1parse.h index 4f6c81e01..174799852 100644 --- a/src/type1/t1parse.h +++ b/src/type1/t1parse.h @@ -113,17 +113,17 @@ FT_BEGIN_HEADER (p)->root.funcs.load_field_table( &(p)->root, f, o, m, pf ) - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) T1_New_Parser( T1_Parser parser, FT_Stream stream, FT_Memory memory, PSAux_Service psaux ); - FT_LOCAL FT_Error + FT_LOCAL( FT_Error ) T1_Get_Private_Dict( T1_Parser parser, PSAux_Service psaux ); - FT_LOCAL void + FT_LOCAL( void ) T1_Finalize_Parser( T1_Parser parser ); diff --git a/src/winfonts/winfnt.c b/src/winfonts/winfnt.c index 8f0fce038..f3c7d536c 100644 --- a/src/winfonts/winfnt.c +++ b/src/winfonts/winfnt.c @@ -310,6 +310,141 @@ } + +#ifdef FT_CONFIG_OPTION_USE_CMAPS + + typedef struct FNT_CMapRec_ + { + FT_CMapRec cmap; + FT_UInt32 first; + FT_UInt32 count; + + } FNT_CMapRec, *FNT_CMap; + + + static FT_Error + fnt_cmap_init( FT_CMap cmap ) + { + FNT_Face face = (FNT_Face) FT_CMAP_FACE(cmap); + FNT_Font* font = face->fonts; + + cmap->first = (FT_UInt32) font->header.first_char; + cmap->count = (FT_UInt32)(font->header.last_char - cmap->first + 1); + + return 0; + } + + + static FT_UInt + fnt_cmap_char_index( FT_CMap cmap, + FT_UInt32 char_code ) + { + FT_UInt gindex = 0; + + char_code -= cmap->first; + if ( char_code < cmap->count ) + gindex = char_code + 1; + + return gindex; + } + + + static FT_UInt32 + fnt_cmap_char_next( FT_CMap cmap, + FT_UInt32 char_code, + FT_UInt *agindex ) + { + FT_UInt gindex = 0; + FT_UInt32 result = 0; + + char_code ++; + if ( char_code <= cmap->first ) + { + result = cmap->first; + gindex = 1; + } + else + { + char_code -= cmap->first; + if ( char_code < cmap->count ) + { + result = cmap->first + char_code; + gindex = char_code + 1; + } + } + + *agindex = gindex; + return result; + } + + static FT_CMap_ClassRec fnt_cmap_class_rec = + { + sizeof( FNT_CMapRec ), + (FT_CMap_InitFunc) fnt_cmap_init, + (FT_CMap_DoneFunc) NULL, + (FT_CMap_CharIndexFunc) fnt_cmap_char_index, + (FT_CMap_CharNextFunc) fnt_cmap_char_next + }; + + static FT_CMap_Class fnt_cmap_class = &fnt_cmap_class_rec; + +#else /* !FT_CONFIG_OPTION_USE_CMAPS */ + + static FT_UInt + FNT_Get_Char_Index( FT_CharMap charmap, + FT_Long char_code ) + { + FT_Long result = char_code; + + + if ( charmap ) + { + FNT_Font* font = ((FNT_Face)charmap->face)->fonts; + FT_Long first = font->header.first_char; + FT_Long count = font->header.last_char - first + 1; + + + char_code -= first; + if ( char_code < count ) + result = char_code + 1; + else + result = 0; + } + + return result; + } + + static FT_Long + FNT_Get_Next_Char( FT_CharMap charmap, + FT_Long char_code ) + { + FT_ULong result = 0; + FT_UInt gindex = 0; + + char_code++; + if ( charmap ) + { + FNT_Font* font = ((FNT_Face)charmap->face)->fonts; + FT_Long first = font->header.first_char; + + + if ( char_code < first ) + char_code = first; + if ( char_code <= font->header.last_char ) + return char_code; + } + else + return char_code; + return 0; + } + +#endif /* !FT_CONFIG_OPTION_USE_CMAPS */ + + + + + + static void FNT_Face_Done( FNT_Face face ) { @@ -399,6 +534,25 @@ } } +#ifdef FT_CONFIG_OPTION_USE_CMAPS + + { + FT_CharMapRec charmap; + + charmap.encoding = ft_encoding_unicode; + charmap.platform_id = 3; + charmap.encoding_id = 1; + charmap.face = root; + + error = FT_CMap_New( fnt_cmap_class, + NULL, + &charmap, + NULL ); + if (error) goto Fail; + } + +#else /* !FT_CONFIG_OPTION_USE_CMAPS */ + /* Setup the `charmaps' array */ root->charmaps = &face->charmap_handle; root->num_charmaps = 1; @@ -412,6 +566,8 @@ root->charmap = face->charmap_handle; +#endif /* !FT_CONFIG_OPTION_USE_CMAPS */ + /* setup remaining flags */ root->num_glyphs = fonts->header.last_char - fonts->header.first_char + 1; @@ -470,52 +626,6 @@ } - static FT_UInt - FNT_Get_Char_Index( FT_CharMap charmap, - FT_Long char_code ) - { - FT_Long result = char_code; - - - if ( charmap ) - { - FNT_Font* font = ((FNT_Face)charmap->face)->fonts; - FT_Long first = font->header.first_char; - FT_Long count = font->header.last_char - first + 1; - - - char_code -= first; - if ( char_code < count ) - result = char_code + 1; - else - result = 0; - } - - return result; - } - - static FT_Long - FNT_Get_Next_Char( FT_CharMap charmap, - FT_Long char_code ) - { - char_code++; - if ( charmap ) - { - FNT_Font* font = ((FNT_Face)charmap->face)->fonts; - FT_Long first = font->header.first_char; - - - if ( char_code < first ) - char_code = first; - if ( char_code <= font->header.last_char ) - return char_code; - } - else - return char_code; - return 0; - } - - static FT_Error FNT_Load_Glyph( FT_GlyphSlot slot, FNT_Size size,