From e260d2538de295949e9975fa7f35d0ee7b19b9f9 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Mon, 17 May 2004 09:25:04 +0000 Subject: [PATCH] * src/cache/ftcbasic.c (ftc_basic_family_compare, ftc_basic_family_init, ftc_basic_family_get_count, ftc_basic_family_load_bitmap, ftc_basic_family_load_glyph, ftc_basic_gnode_compare_faceid): Adjust parameters and return types to prototypes given in header files from include/freetype/cache. Use casts to proper types locally. (ftc_basic_image_family_class, ftc_basic_image_cache_class, ftc_basic_sbit_family_class, ftc_basic_sbit_cache_class): Remove casts. * src/cache/ftccback.h: Adjust parameters and return types to prototypes given in header files from include/freetype/cache. * src/cache/ftcimage.c (ftc_inode_free, ftc_inode_new, ftc_inode_weight): Adjust parameters and return types to prototypes given in header files from include/freetype/cache. Use casts to proper types locally. * src/cache/ftcsbits.c (ftc_snode_free, ftc_snode_new, ftc_snode_weight, ftc_snode_compare): Adjust parameters and return types to prototypes given in header files from include/freetype/cache. Use casts to proper types locally. * src/cache/ftccmap.c (ftc_cmap_node_free, ftc_cmap_node_new, ftc_cmap_node_weight, ftc_cmap_node_compare, ftc_cmap_node_remove_faceid): Adjust parameters and return types to prototypes given in header files from include/freetype/cache. Use casts to proper types locally. (ftc_cmap_cache_class): Remove casts. * src/cache/ftcglyph.c (ftc_gnode_compare, ftc_gcache_init, ftc_gcache_done): Adjust parameters and return types to prototypes given in header files from include/freetype/cache. Use casts to proper types locally. * src/cache/ftcmanag.c (ftc_size_node_done, ftc_size_node_compare, ftc_size_node_init, ftc_size_node_reset, ftc_size_node_compare_faceid, ftc_face_node_init, ftc_face_node_done, ftc_face_node_compare: Adjust parameters and return types to prototypes given in header files from include/freetype/cache. Use casts to proper types locally. (ftc_size_list_class, ftc_face_list_class): Remove casts. * src/autohint/ahmodule.c (ft_autohinter_init, ft_autohinter_done): Use FT_Module as parameter and do a cast to FT_AutoHinter locally. (autohint_module_class): Remove casts. * src/base/ftglyph.c (ft_bitmap_glyph_init, ft_bitmap_glyph_copy, ft_bitmap_glyph_done, ft_bitmap_glyph_bbox, ft_outline_glyph_init, ft_outline_glyph_done, ft_outline_glyph_copy, ft_outline_glyph_transform, ft_outline_glyph_bbox, ft_outline_glyph_prepare): Use FT_Glyph as parameter and do a cast to FT_XXXGlyph locally. Use FT_CALLBACK_DEF throughout. (ft_bitmap_glyph_class, ft_outline_glyph_class): Remove casts. * src/bdf/bdfdrivr.c (bdf_cmap_init, bdf_cmap_done, bdf_cmap_char_index, bdf_cmap_char_next): Use FT_CMap as parameter and do a cast to BDF_CMap locally. (bdf_cmap_class): Remove casts. --- ChangeLog | 68 ++++++++++++++++++++- src/autohint/ahmodule.c | 26 +++++--- src/base/ftglyph.c | 132 +++++++++++++++++++++++----------------- src/bdf/bdfdrivr.c | 31 ++++++---- src/cache/ftcbasic.c | 128 +++++++++++++++++++++----------------- src/cache/ftccback.h | 49 ++++++++------- src/cache/ftccmap.c | 60 +++++++++++------- src/cache/ftcglyph.c | 20 ++++-- src/cache/ftcimage.c | 22 +++++-- src/cache/ftcmanag.c | 107 ++++++++++++++++++++------------ src/cache/ftcsbits.c | 28 +++++++-- 11 files changed, 438 insertions(+), 233 deletions(-) diff --git a/ChangeLog b/ChangeLog index 02b6ac599..97e511e58 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,72 @@ +2004-05-14 Werner Lemberg + + * src/cache/ftcbasic.c (ftc_basic_family_compare, + ftc_basic_family_init, ftc_basic_family_get_count, + ftc_basic_family_load_bitmap, ftc_basic_family_load_glyph, + ftc_basic_gnode_compare_faceid): Adjust parameters and return types + to prototypes given in header files from include/freetype/cache. + Use casts to proper types locally. + (ftc_basic_image_family_class, ftc_basic_image_cache_class, + ftc_basic_sbit_family_class, ftc_basic_sbit_cache_class): Remove + casts. + + * src/cache/ftccback.h: Adjust parameters and return types to + prototypes given in header files from include/freetype/cache. + + * src/cache/ftcimage.c (ftc_inode_free, ftc_inode_new, + ftc_inode_weight): Adjust parameters and return types to prototypes + given in header files from include/freetype/cache. Use casts to + proper types locally. + + * src/cache/ftcsbits.c (ftc_snode_free, ftc_snode_new, + ftc_snode_weight, ftc_snode_compare): Adjust parameters and return + types to prototypes given in header files from + include/freetype/cache. Use casts to proper types locally. + + * src/cache/ftccmap.c (ftc_cmap_node_free, ftc_cmap_node_new, + ftc_cmap_node_weight, ftc_cmap_node_compare, + ftc_cmap_node_remove_faceid): Adjust parameters and return types to + prototypes given in header files from include/freetype/cache. Use + casts to proper types locally. + (ftc_cmap_cache_class): Remove casts. + + * src/cache/ftcglyph.c (ftc_gnode_compare, ftc_gcache_init, + ftc_gcache_done): Adjust parameters and return types to prototypes + given in header files from include/freetype/cache. Use casts to + proper types locally. + + * src/cache/ftcmanag.c (ftc_size_node_done, ftc_size_node_compare, + ftc_size_node_init, ftc_size_node_reset, + ftc_size_node_compare_faceid, ftc_face_node_init, + ftc_face_node_done, ftc_face_node_compare: Adjust parameters and + return types to prototypes given in header files from + include/freetype/cache. Use casts to proper types locally. + + (ftc_size_list_class, ftc_face_list_class): Remove casts. + +2004-05-13 Werner Lemberg + + * src/autohint/ahmodule.c (ft_autohinter_init, ft_autohinter_done): + Use FT_Module as parameter and do a cast to FT_AutoHinter locally. + (autohint_module_class): Remove casts. + + * src/base/ftglyph.c (ft_bitmap_glyph_init, ft_bitmap_glyph_copy, + ft_bitmap_glyph_done, ft_bitmap_glyph_bbox, ft_outline_glyph_init, + ft_outline_glyph_done, ft_outline_glyph_copy, + ft_outline_glyph_transform, ft_outline_glyph_bbox, + ft_outline_glyph_prepare): Use FT_Glyph as parameter and do a cast + to FT_XXXGlyph locally. + Use FT_CALLBACK_DEF throughout. + (ft_bitmap_glyph_class, ft_outline_glyph_class): Remove casts. + + * src/bdf/bdfdrivr.c (bdf_cmap_init, bdf_cmap_done, + bdf_cmap_char_index, bdf_cmap_char_next): Use FT_CMap as parameter + and do a cast to BDF_CMap locally. + (bdf_cmap_class): Remove casts. + 2004-05-12 Werner Lemberg - * src/cff/cffgload.h (CFF_Builder): Remove `error' + * src/cff/cffgload.h (CFF_Builder): Remove `error'. * src/cff/cffgload.c (cff_decoder_parse_charstrings): Replace `Memory_Error' with `Fail' und update all users. diff --git a/src/autohint/ahmodule.c b/src/autohint/ahmodule.c index 8fce31d61..03d067b87 100644 --- a/src/autohint/ahmodule.c +++ b/src/autohint/ahmodule.c @@ -4,7 +4,7 @@ /* */ /* Auto-hinting module implementation (declaration). */ /* */ -/* Copyright 2000-2001, 2002, 2003 Catharon Productions Inc. */ +/* Copyright 2000-2001, 2002, 2003, 2004 Catharon Productions Inc. */ /* Author: David Turner */ /* */ /* This file is part of the Catharon Typography Project and shall only */ @@ -39,24 +39,30 @@ FT_CALLBACK_DEF( FT_Error ) - ft_autohinter_init( FT_AutoHinter module ) + ft_autohinter_init( FT_Module module ) /* FT_AutoHinter */ { - FT_Error error; + FT_AutoHinter autohinter = (FT_AutoHinter)module; + FT_Error error; - error = ah_hinter_new( module->root.library, &module->hinter ); + error = ah_hinter_new( module->library, &autohinter->hinter ); + #ifdef DEBUG_HINTER if ( !error ) - ah_debug_hinter = module->hinter; + ah_debug_hinter = autohinter->hinter; #endif + return error; } FT_CALLBACK_DEF( void ) - ft_autohinter_done( FT_AutoHinter module ) + ft_autohinter_done( FT_Module module ) { - ah_hinter_done( module->hinter ); + FT_AutoHinter autohinter = (FT_AutoHinter)module; + + + ah_hinter_done( autohinter->hinter ); #ifdef DEBUG_HINTER ah_debug_hinter = NULL; @@ -128,9 +134,9 @@ (const void*) &ft_autohinter_service, - (FT_Module_Constructor)ft_autohinter_init, - (FT_Module_Destructor) ft_autohinter_done, - (FT_Module_Requester) 0 + ft_autohinter_init, + ft_autohinter_done, + 0 /* FT_Module_Requester */ }; diff --git a/src/base/ftglyph.c b/src/base/ftglyph.c index c6c458cc1..1b22ab6b3 100644 --- a/src/base/ftglyph.c +++ b/src/base/ftglyph.c @@ -138,13 +138,14 @@ } - static FT_Error - ft_bitmap_glyph_init( FT_BitmapGlyph glyph, - FT_GlyphSlot slot ) + FT_CALLBACK_DEF( FT_Error ) + ft_bitmap_glyph_init( FT_Glyph bitmap_glyph, + FT_GlyphSlot slot ) { - FT_Error error = FT_Err_Ok; - FT_Library library = FT_GLYPH(glyph)->library; - FT_Memory memory = library->memory; + FT_BitmapGlyph glyph = (FT_BitmapGlyph)bitmap_glyph; + FT_Error error = FT_Err_Ok; + FT_Library library = FT_GLYPH( glyph )->library; + FT_Memory memory = library->memory; if ( slot->format != FT_GLYPH_FORMAT_BITMAP ) @@ -171,11 +172,13 @@ } - static FT_Error - ft_bitmap_glyph_copy( FT_BitmapGlyph source, - FT_BitmapGlyph target ) + FT_CALLBACK_DEF( FT_Error ) + ft_bitmap_glyph_copy( FT_Glyph bitmap_source, + FT_Glyph bitmap_target ) { - FT_Memory memory = source->root.library->memory; + FT_BitmapGlyph source = (FT_BitmapGlyph)bitmap_source; + FT_BitmapGlyph target = (FT_BitmapGlyph)bitmap_target; + FT_Memory memory = bitmap_source->library->memory; target->left = source->left; @@ -185,20 +188,24 @@ } - static void - ft_bitmap_glyph_done( FT_BitmapGlyph glyph ) + FT_CALLBACK_DEF( void ) + ft_bitmap_glyph_done( FT_Glyph bitmap_glyph ) { - FT_Memory memory = FT_GLYPH(glyph)->library->memory; + FT_BitmapGlyph glyph = (FT_BitmapGlyph)bitmap_glyph; + FT_Memory memory = FT_GLYPH( glyph )->library->memory; FT_FREE( glyph->bitmap.buffer ); } - static void - ft_bitmap_glyph_bbox( FT_BitmapGlyph glyph, - FT_BBox* cbox ) + FT_CALLBACK_DEF( void ) + ft_bitmap_glyph_bbox( FT_Glyph bitmap_glyph, + FT_BBox* cbox ) { + FT_BitmapGlyph glyph = (FT_BitmapGlyph)bitmap_glyph; + + cbox->xMin = glyph->left << 6; cbox->xMax = cbox->xMin + ( glyph->bitmap.width << 6 ); cbox->yMax = glyph->top << 6; @@ -209,15 +216,15 @@ FT_CALLBACK_TABLE_DEF const FT_Glyph_Class ft_bitmap_glyph_class = { - sizeof( FT_BitmapGlyphRec ), + sizeof ( FT_BitmapGlyphRec ), FT_GLYPH_FORMAT_BITMAP, - (FT_Glyph_InitFunc) ft_bitmap_glyph_init, - (FT_Glyph_DoneFunc) ft_bitmap_glyph_done, - (FT_Glyph_CopyFunc) ft_bitmap_glyph_copy, - (FT_Glyph_TransformFunc)0, - (FT_Glyph_GetBBoxFunc) ft_bitmap_glyph_bbox, - (FT_Glyph_PrepareFunc) 0 + ft_bitmap_glyph_init, + ft_bitmap_glyph_done, + ft_bitmap_glyph_copy, + 0, /* FT_Glyph_TransformFunc */ + ft_bitmap_glyph_bbox, + 0 /* FT_Glyph_PrepareFunc */ }; @@ -230,14 +237,15 @@ /*************************************************************************/ - static FT_Error - ft_outline_glyph_init( FT_OutlineGlyph glyph, - FT_GlyphSlot slot ) + FT_CALLBACK_DEF( FT_Error ) + ft_outline_glyph_init( FT_Glyph outline_glyph, + FT_GlyphSlot slot ) { - FT_Error error = FT_Err_Ok; - FT_Library library = FT_GLYPH(glyph)->library; - FT_Outline* source = &slot->outline; - FT_Outline* target = &glyph->outline; + FT_OutlineGlyph glyph = (FT_OutlineGlyph)outline_glyph; + FT_Error error = FT_Err_Ok; + FT_Library library = FT_GLYPH( glyph )->library; + FT_Outline* source = &slot->outline; + FT_Outline* target = &glyph->outline; /* check format in glyph slot */ @@ -268,19 +276,24 @@ } - static void - ft_outline_glyph_done( FT_OutlineGlyph glyph ) + FT_CALLBACK_DEF( void ) + ft_outline_glyph_done( FT_Glyph outline_glyph ) { + FT_OutlineGlyph glyph = (FT_OutlineGlyph)outline_glyph; + + FT_Outline_Done( FT_GLYPH( glyph )->library, &glyph->outline ); } - static FT_Error - ft_outline_glyph_copy( FT_OutlineGlyph source, - FT_OutlineGlyph target ) + FT_CALLBACK_DEF( FT_Error ) + ft_outline_glyph_copy( FT_Glyph outline_source, + FT_Glyph outline_target ) { - FT_Error error; - FT_Library library = FT_GLYPH( source )->library; + FT_OutlineGlyph source = (FT_OutlineGlyph)outline_source; + FT_OutlineGlyph target = (FT_OutlineGlyph)outline_target; + FT_Error error; + FT_Library library = FT_GLYPH( source )->library; error = FT_Outline_New( library, source->outline.n_points, @@ -292,11 +305,14 @@ } - static void - ft_outline_glyph_transform( FT_OutlineGlyph glyph, - FT_Matrix* matrix, - FT_Vector* delta ) + FT_CALLBACK_DEF( void ) + ft_outline_glyph_transform( FT_Glyph outline_glyph, + FT_Matrix* matrix, + FT_Vector* delta ) { + FT_OutlineGlyph glyph = (FT_OutlineGlyph)outline_glyph; + + if ( matrix ) FT_Outline_Transform( &glyph->outline, matrix ); @@ -305,18 +321,24 @@ } - static void - ft_outline_glyph_bbox( FT_OutlineGlyph glyph, - FT_BBox* bbox ) + FT_CALLBACK_DEF( void ) + ft_outline_glyph_bbox( FT_Glyph outline_glyph, + FT_BBox* bbox ) { + FT_OutlineGlyph glyph = (FT_OutlineGlyph)outline_glyph; + + FT_Outline_Get_CBox( &glyph->outline, bbox ); } - static FT_Error - ft_outline_glyph_prepare( FT_OutlineGlyph glyph, - FT_GlyphSlot slot ) + FT_CALLBACK_DEF( FT_Error ) + ft_outline_glyph_prepare( FT_Glyph outline_glyph, + FT_GlyphSlot slot ) { + FT_OutlineGlyph glyph = (FT_OutlineGlyph)outline_glyph; + + slot->format = FT_GLYPH_FORMAT_OUTLINE; slot->outline = glyph->outline; slot->outline.flags &= ~FT_OUTLINE_OWNER; @@ -328,15 +350,15 @@ FT_CALLBACK_TABLE_DEF const FT_Glyph_Class ft_outline_glyph_class = { - sizeof( FT_OutlineGlyphRec ), + sizeof ( FT_OutlineGlyphRec ), FT_GLYPH_FORMAT_OUTLINE, - (FT_Glyph_InitFunc) ft_outline_glyph_init, - (FT_Glyph_DoneFunc) ft_outline_glyph_done, - (FT_Glyph_CopyFunc) ft_outline_glyph_copy, - (FT_Glyph_TransformFunc)ft_outline_glyph_transform, - (FT_Glyph_GetBBoxFunc) ft_outline_glyph_bbox, - (FT_Glyph_PrepareFunc) ft_outline_glyph_prepare + ft_outline_glyph_init, + ft_outline_glyph_done, + ft_outline_glyph_copy, + ft_outline_glyph_transform, + ft_outline_glyph_bbox, + ft_outline_glyph_prepare }; @@ -644,7 +666,7 @@ goto Exit; /* in case of success, copy the bitmap to the glyph bitmap */ - error = ft_bitmap_glyph_init( bitmap, &dummy ); + error = ft_bitmap_glyph_init( (FT_Glyph)bitmap, &dummy ); if ( error ) goto Exit; diff --git a/src/bdf/bdfdrivr.c b/src/bdf/bdfdrivr.c index e02a571ba..a7c3eaf47 100644 --- a/src/bdf/bdfdrivr.c +++ b/src/bdf/bdfdrivr.c @@ -60,9 +60,12 @@ THE SOFTWARE. FT_CALLBACK_DEF( FT_Error ) - bdf_cmap_init( BDF_CMap cmap ) + bdf_cmap_init( FT_CMap bdfcmap, + FT_Pointer init_data ) { + BDF_CMap cmap = (BDF_CMap)bdfcmap; BDF_Face face = (BDF_Face)FT_CMAP_FACE( cmap ); + FT_UNUSED( init_data ); cmap->num_encodings = face->bdffont->glyphs_used; @@ -73,20 +76,24 @@ THE SOFTWARE. FT_CALLBACK_DEF( void ) - bdf_cmap_done( BDF_CMap cmap ) + bdf_cmap_done( FT_CMap bdfcmap ) { + BDF_CMap cmap = (BDF_CMap)bdfcmap; + + cmap->encodings = NULL; cmap->num_encodings = 0; } FT_CALLBACK_DEF( FT_UInt ) - bdf_cmap_char_index( BDF_CMap cmap, + bdf_cmap_char_index( FT_CMap bdfcmap, FT_UInt32 charcode ) { + BDF_CMap cmap = (BDF_CMap)bdfcmap; BDF_encoding_el* encodings = cmap->encodings; FT_UInt min, max, mid; - FT_UInt result = 0; + FT_UInt result = 0; min = 0; @@ -117,9 +124,10 @@ THE SOFTWARE. FT_CALLBACK_DEF( FT_UInt ) - bdf_cmap_char_next( BDF_CMap cmap, + bdf_cmap_char_next( FT_CMap bdfcmap, FT_UInt32 *acharcode ) { + BDF_CMap cmap = (BDF_CMap)bdfcmap; BDF_encoding_el* encodings = cmap->encodings; FT_UInt min, max, mid; FT_UInt32 charcode = *acharcode + 1; @@ -162,13 +170,14 @@ THE SOFTWARE. } - FT_CALLBACK_TABLE_DEF const FT_CMap_ClassRec bdf_cmap_class = + FT_CALLBACK_TABLE_DEF + const FT_CMap_ClassRec bdf_cmap_class = { - sizeof( BDF_CMapRec ), - (FT_CMap_InitFunc) bdf_cmap_init, - (FT_CMap_DoneFunc) bdf_cmap_done, - (FT_CMap_CharIndexFunc)bdf_cmap_char_index, - (FT_CMap_CharNextFunc) bdf_cmap_char_next + sizeof ( BDF_CMapRec ), + bdf_cmap_init, + bdf_cmap_done, + bdf_cmap_char_index, + bdf_cmap_char_next }; diff --git a/src/cache/ftcbasic.c b/src/cache/ftcbasic.c index e14497141..a9b66dc21 100644 --- a/src/cache/ftcbasic.c +++ b/src/cache/ftcbasic.c @@ -62,19 +62,28 @@ } FTC_BasicFamilyRec, *FTC_BasicFamily; - FT_CALLBACK_DEF( FT_Bool ) - ftc_basic_family_compare( FTC_BasicFamily family, - FTC_BasicQuery query ) + FT_CALLBACK_DEF( FT_Int ) + ftc_basic_family_compare( FTC_MruNode ftcfamily, + FT_Pointer ftcquery ) { - return FT_BOOL( FTC_BASIC_ATTR_COMPARE( &family->attrs, &query->attrs ) ); + FTC_BasicFamily family = (FTC_BasicFamily)ftcfamily; + FTC_BasicQuery query = (FTC_BasicQuery)ftcquery; + + + return FTC_BASIC_ATTR_COMPARE( &family->attrs, &query->attrs ); } FT_CALLBACK_DEF( FT_Error ) - ftc_basic_family_init( FTC_BasicFamily family, - FTC_BasicQuery query, - FTC_Cache cache ) + ftc_basic_family_init( FTC_MruNode ftcfamily, + FT_Pointer ftcquery, + FT_Pointer ftccache ) { + FTC_BasicFamily family = (FTC_BasicFamily)ftcfamily; + FTC_BasicQuery query = (FTC_BasicQuery)ftcquery; + FTC_Cache cache = (FTC_Cache)ftccache; + + FTC_Family_Init( FTC_FAMILY( family ), cache ); family->attrs = query->attrs; return 0; @@ -82,12 +91,13 @@ FT_CALLBACK_DEF( FT_UInt ) - ftc_basic_family_get_count( FTC_BasicFamily family, - FTC_Manager manager ) + ftc_basic_family_get_count( FTC_Family ftcfamily, + FTC_Manager manager ) { - FT_Error error; - FT_Face face; - FT_UInt result = 0; + FTC_BasicFamily family = (FTC_BasicFamily)ftcfamily; + FT_Error error; + FT_Face face; + FT_UInt result = 0; error = FTC_Manager_LookupFace( manager, family->attrs.scaler.face_id, @@ -100,13 +110,14 @@ FT_CALLBACK_DEF( FT_Error ) - ftc_basic_family_load_bitmap( FTC_BasicFamily family, - FT_UInt gindex, - FTC_Manager manager, - FT_Face *aface ) + ftc_basic_family_load_bitmap( FTC_Family ftcfamily, + FT_UInt gindex, + FTC_Manager manager, + FT_Face *aface ) { - FT_Error error; - FT_Size size; + FTC_BasicFamily family = (FTC_BasicFamily)ftcfamily; + FT_Error error; + FT_Size size; error = FTC_Manager_LookupSize( manager, &family->attrs.scaler, &size ); @@ -126,15 +137,16 @@ FT_CALLBACK_DEF( FT_Error ) - ftc_basic_family_load_glyph( FTC_BasicFamily family, - FT_UInt gindex, - FTC_Cache cache, - FT_Glyph *aglyph ) + ftc_basic_family_load_glyph( FTC_Family ftcfamily, + FT_UInt gindex, + FTC_Cache cache, + FT_Glyph *aglyph ) { - FT_Error error; - FTC_Scaler scaler = &family->attrs.scaler; - FT_Face face; - FT_Size size; + FTC_BasicFamily family = (FTC_BasicFamily)ftcfamily; + FT_Error error; + FTC_Scaler scaler = &family->attrs.scaler; + FT_Face face; + FT_Size size; /* we will now load the glyph image */ @@ -173,11 +185,13 @@ FT_CALLBACK_DEF( FT_Bool ) - ftc_basic_gnode_compare_faceid( FTC_GNode gnode, - FTC_FaceID face_id, + ftc_basic_gnode_compare_faceid( FTC_Node ftcgnode, + FT_Pointer ftcface_id, FTC_Cache cache ) { - FTC_BasicFamily family = (FTC_BasicFamily)gnode->family; + FTC_GNode gnode = (FTC_GNode)ftcgnode; + FTC_FaceID face_id = (FTC_FaceID)ftcface_id; + FTC_BasicFamily family = (FTC_BasicFamily)gnode->family; FT_Bool result; @@ -203,13 +217,13 @@ const FTC_IFamilyClassRec ftc_basic_image_family_class = { { - sizeof( FTC_BasicFamilyRec ), - (FTC_MruNode_CompareFunc)ftc_basic_family_compare, - (FTC_MruNode_InitFunc) ftc_basic_family_init, - (FTC_MruNode_ResetFunc) NULL, - (FTC_MruNode_DoneFunc) NULL + sizeof ( FTC_BasicFamilyRec ), + ftc_basic_family_compare, + ftc_basic_family_init, + 0, /* FTC_MruNode_ResetFunc */ + 0 /* FTC_MruNode_DoneFunc */ }, - (FTC_IFamily_LoadGlyphFunc)ftc_basic_family_load_glyph + ftc_basic_family_load_glyph }; @@ -217,15 +231,15 @@ const FTC_GCacheClassRec ftc_basic_image_cache_class = { { - (FTC_Node_NewFunc) ftc_inode_new, - (FTC_Node_WeightFunc) ftc_inode_weight, - (FTC_Node_CompareFunc)ftc_gnode_compare, - (FTC_Node_CompareFunc)ftc_basic_gnode_compare_faceid, - (FTC_Node_FreeFunc) ftc_inode_free, + ftc_inode_new, + ftc_inode_weight, + ftc_gnode_compare, + ftc_basic_gnode_compare_faceid, + ftc_inode_free, - sizeof( FTC_GCacheRec ), - (FTC_Cache_InitFunc) ftc_gcache_init, - (FTC_Cache_DoneFunc) ftc_gcache_done + sizeof ( FTC_GCacheRec ), + ftc_gcache_init, + ftc_gcache_done }, (FTC_MruListClass)&ftc_basic_image_family_class }; @@ -321,13 +335,13 @@ { { sizeof( FTC_BasicFamilyRec ), - (FTC_MruNode_CompareFunc)ftc_basic_family_compare, - (FTC_MruNode_InitFunc) ftc_basic_family_init, - (FTC_MruNode_ResetFunc) NULL, - (FTC_MruNode_DoneFunc) NULL + ftc_basic_family_compare, + ftc_basic_family_init, + 0, /* FTC_MruNode_ResetFunc */ + 0 /* FTC_MruNode_DoneFunc */ }, - (FTC_SFamily_GetCountFunc) ftc_basic_family_get_count, - (FTC_SFamily_LoadGlyphFunc)ftc_basic_family_load_bitmap + ftc_basic_family_get_count, + ftc_basic_family_load_bitmap }; @@ -335,15 +349,15 @@ const FTC_GCacheClassRec ftc_basic_sbit_cache_class = { { - (FTC_Node_NewFunc) ftc_snode_new, - (FTC_Node_WeightFunc) ftc_snode_weight, - (FTC_Node_CompareFunc)ftc_snode_compare, - (FTC_Node_CompareFunc)ftc_basic_gnode_compare_faceid, - (FTC_Node_FreeFunc) ftc_snode_free, + ftc_snode_new, + ftc_snode_weight, + ftc_snode_compare, + ftc_basic_gnode_compare_faceid, + ftc_snode_free, - sizeof( FTC_GCacheRec ), - (FTC_Cache_InitFunc) ftc_gcache_init, - (FTC_Cache_DoneFunc) ftc_gcache_done + sizeof ( FTC_GCacheRec ), + ftc_gcache_init, + ftc_gcache_done }, (FTC_MruListClass)&ftc_basic_sbit_family_class }; diff --git a/src/cache/ftccback.h b/src/cache/ftccback.h index 68be91385..6b47e095e 100644 --- a/src/cache/ftccback.h +++ b/src/cache/ftccback.h @@ -28,46 +28,49 @@ FT_LOCAL( void ) - ftc_inode_free( FTC_INode inode, + ftc_inode_free( FTC_Node inode, FTC_Cache cache ); FT_LOCAL( FT_Error ) - ftc_inode_new( FTC_INode *pinode, - FTC_GQuery gquery, - FTC_Cache cache ); - - FT_LOCAL( FT_ULong ) - ftc_inode_weight( FTC_INode inode ); - - - FT_LOCAL( void ) - ftc_snode_free( FTC_SNode snode, - FTC_Cache cache ); - - FT_LOCAL( FT_Error ) - ftc_snode_new( FTC_SNode *psnode, - FTC_GQuery gquery, + ftc_inode_new( FTC_Node *pinode, + FT_Pointer gquery, FTC_Cache cache ); FT_LOCAL( FT_ULong ) - ftc_snode_weight( FTC_SNode snode ); + ftc_inode_weight( FTC_Node inode, + FTC_Cache cache ); + + + FT_LOCAL( void ) + ftc_snode_free( FTC_Node snode, + FTC_Cache cache ); + + FT_LOCAL( FT_Error ) + ftc_snode_new( FTC_Node *psnode, + FT_Pointer gquery, + FTC_Cache cache ); + + FT_LOCAL( FT_ULong ) + ftc_snode_weight( FTC_Node snode, + FTC_Cache cache ); FT_LOCAL( FT_Bool ) - ftc_snode_compare( FTC_SNode snode, - FTC_GQuery gquery, + ftc_snode_compare( FTC_Node snode, + FT_Pointer gquery, FTC_Cache cache ); FT_LOCAL( FT_Bool ) - ftc_gnode_compare( FTC_GNode gnode, - FTC_GQuery gquery ); + ftc_gnode_compare( FTC_Node gnode, + FT_Pointer gquery, + FTC_Cache cache ); FT_LOCAL( FT_Error ) - ftc_gcache_init( FTC_GCache cache ); + ftc_gcache_init( FTC_Cache cache ); FT_LOCAL( void ) - ftc_gcache_done( FTC_GCache cache ); + ftc_gcache_done( FTC_Cache cache ); FT_LOCAL( FT_Error ) diff --git a/src/cache/ftccmap.c b/src/cache/ftccmap.c index 60f995321..b2812c951 100644 --- a/src/cache/ftccmap.c +++ b/src/cache/ftccmap.c @@ -98,10 +98,11 @@ /* no need for specific finalizer; we use `ftc_node_done' directly */ FT_CALLBACK_DEF( void ) - ftc_cmap_node_free( FTC_CMapNode node, - FTC_Cache cache ) + ftc_cmap_node_free( FTC_Node ftcnode, + FTC_Cache cache ) { - FT_Memory memory = cache->memory; + FTC_CMapNode node = (FTC_CMapNode)ftcnode; + FT_Memory memory = cache->memory; FT_FREE( node ); @@ -110,14 +111,16 @@ /* initialize a new cmap node */ FT_CALLBACK_DEF( FT_Error ) - ftc_cmap_node_new( FTC_CMapNode *anode, - FTC_CMapQuery query, - FTC_Cache cache ) + ftc_cmap_node_new( FTC_Node *ftcanode, + FT_Pointer ftcquery, + FTC_Cache cache ) { - FT_Error error; - FT_Memory memory = cache->memory; - FTC_CMapNode node; - FT_UInt nn; + FTC_CMapNode *anode = (FTC_CMapNode*)ftcanode; + FTC_CMapQuery query = (FTC_CMapQuery)ftcquery; + FT_Error error; + FT_Memory memory = cache->memory; + FTC_CMapNode node; + FT_UInt nn; if ( !FT_NEW( node ) ) @@ -138,9 +141,11 @@ /* compute the weight of a given cmap node */ FT_CALLBACK_DEF( FT_ULong ) - ftc_cmap_node_weight( FTC_CMapNode cnode ) + ftc_cmap_node_weight( FTC_Node cnode, + FTC_Cache cache ) { FT_UNUSED( cnode ); + FT_UNUSED( cache ); return sizeof ( *cnode ); } @@ -148,9 +153,15 @@ /* compare a cmap node to a given query */ FT_CALLBACK_DEF( FT_Bool ) - ftc_cmap_node_compare( FTC_CMapNode node, - FTC_CMapQuery query ) + ftc_cmap_node_compare( FTC_Node ftcnode, + FT_Pointer ftcquery, + FTC_Cache cache ) { + FTC_CMapNode node = (FTC_CMapNode)ftcnode; + FTC_CMapQuery query = (FTC_CMapQuery)ftcquery; + FT_UNUSED( cache ); + + if ( node->face_id == query->face_id && node->cmap_index == query->cmap_index ) { @@ -165,9 +176,14 @@ FT_CALLBACK_DEF( FT_Bool ) - ftc_cmap_node_remove_faceid( FTC_CMapNode node, - FTC_FaceID face_id ) + ftc_cmap_node_remove_faceid( FTC_Node ftcnode, + FT_Pointer ftcface_id, + FTC_Cache cache ) { + FTC_CMapNode node = (FTC_CMapNode)ftcnode; + FTC_FaceID face_id = (FTC_FaceID)ftcface_id; + FT_UNUSED( cache ); + return FT_BOOL( node->face_id == face_id ); } @@ -184,15 +200,15 @@ FT_CALLBACK_TABLE_DEF const FTC_CacheClassRec ftc_cmap_cache_class = { - (FTC_Node_NewFunc) ftc_cmap_node_new, - (FTC_Node_WeightFunc) ftc_cmap_node_weight, - (FTC_Node_CompareFunc)ftc_cmap_node_compare, - (FTC_Node_CompareFunc)ftc_cmap_node_remove_faceid, - (FTC_Node_FreeFunc) ftc_cmap_node_free, + ftc_cmap_node_new, + ftc_cmap_node_weight, + ftc_cmap_node_compare, + ftc_cmap_node_remove_faceid, + ftc_cmap_node_free, sizeof ( FTC_CacheRec ), - (FTC_Cache_InitFunc) ftc_cache_init, - (FTC_Cache_DoneFunc) ftc_cache_done, + ftc_cache_init, + ftc_cache_done, }; diff --git a/src/cache/ftcglyph.c b/src/cache/ftcglyph.c index 5e6c9771a..edcd36d53 100644 --- a/src/cache/ftcglyph.c +++ b/src/cache/ftcglyph.c @@ -74,9 +74,15 @@ FT_LOCAL_DEF( FT_Bool ) - ftc_gnode_compare( FTC_GNode gnode, - FTC_GQuery gquery ) + ftc_gnode_compare( FTC_Node ftcgnode, + FT_Pointer ftcgquery, + FTC_Cache cache ) { + FTC_GNode gnode = (FTC_GNode)ftcgnode; + FTC_GQuery gquery = (FTC_GQuery)ftcgquery; + FT_UNUSED( cache ); + + return FTC_GNode_Compare( gnode, gquery ); } @@ -124,8 +130,11 @@ FT_LOCAL_DEF( FT_Error ) - ftc_gcache_init( FTC_GCache cache ) + ftc_gcache_init( FTC_Cache ftccache ) { + FTC_GCache cache = (FTC_GCache)ftccache; + + return FTC_GCache_Init( cache ); } @@ -139,8 +148,11 @@ FT_LOCAL_DEF( void ) - ftc_gcache_done( FTC_GCache cache ) + ftc_gcache_done( FTC_Cache ftccache ) { + FTC_GCache cache = (FTC_GCache)ftccache; + + FTC_GCache_Done( cache ); } diff --git a/src/cache/ftcimage.c b/src/cache/ftcimage.c index 22a26ac47..29f328886 100644 --- a/src/cache/ftcimage.c +++ b/src/cache/ftcimage.c @@ -45,9 +45,12 @@ FT_LOCAL_DEF( void ) - ftc_inode_free( FTC_INode inode, + ftc_inode_free( FTC_Node ftcinode, FTC_Cache cache ) { + FTC_INode inode = (FTC_INode)ftcinode; + + FTC_INode_Free( inode, cache ); } @@ -85,10 +88,14 @@ FT_LOCAL_DEF( FT_Error ) - ftc_inode_new( FTC_INode *pinode, - FTC_GQuery gquery, - FTC_Cache cache ) + ftc_inode_new( FTC_Node *ftcpinode, + FT_Pointer ftcgquery, + FTC_Cache cache ) { + FTC_INode *pinode = (FTC_INode*)ftcpinode; + FTC_GQuery gquery = (FTC_GQuery)ftcgquery; + + return FTC_INode_New( pinode, gquery, cache ); } @@ -136,8 +143,13 @@ FT_LOCAL_DEF( FT_ULong ) - ftc_inode_weight( FTC_INode inode ) + ftc_inode_weight( FTC_Node ftcinode, + FTC_Cache ftccache ) { + FTC_INode inode = (FTC_INode)ftcinode; + FT_UNUSED( ftccache ); + + return FTC_INode_Weight( inode ); } diff --git a/src/cache/ftcmanag.c b/src/cache/ftcmanag.c index 04d064be1..1f83a9282 100644 --- a/src/cache/ftcmanag.c +++ b/src/cache/ftcmanag.c @@ -79,9 +79,12 @@ FT_CALLBACK_DEF( void ) - ftc_size_node_done( FTC_SizeNode node ) + ftc_size_node_done( FTC_MruNode ftcnode, + FT_Pointer data ) { - FT_Size size = node->size; + FTC_SizeNode node = (FTC_SizeNode)ftcnode; + FT_Size size = node->size; + FT_UNUSED( data ); if ( size ) @@ -89,11 +92,13 @@ } - FT_CALLBACK_DEF( FT_Bool ) - ftc_size_node_compare( FTC_SizeNode node, - FTC_Scaler scaler ) + FT_CALLBACK_DEF( FT_Int ) + ftc_size_node_compare( FTC_MruNode ftcnode, + FT_Pointer ftcscaler ) { - FTC_Scaler scaler0 = &node->scaler; + FTC_SizeNode node = (FTC_SizeNode)ftcnode; + FTC_Scaler scaler = (FTC_Scaler)ftcscaler; + FTC_Scaler scaler0 = &node->scaler; if ( FTC_SCALER_COMPARE( scaler0, scaler ) ) @@ -106,10 +111,15 @@ FT_CALLBACK_DEF( FT_Error ) - ftc_size_node_init( FTC_SizeNode node, - FTC_Scaler scaler, - FTC_Manager manager ) + ftc_size_node_init( FTC_MruNode ftcnode, + FT_Pointer ftcscaler, + FT_Pointer ftcmanager ) { + FTC_SizeNode node = (FTC_SizeNode)ftcnode; + FTC_Scaler scaler = (FTC_Scaler)ftcscaler; + FTC_Manager manager = (FTC_Manager)ftcmanager; + + node->scaler = scaler[0]; return ftc_scaler_lookup_size( manager, scaler, &node->size ); @@ -117,10 +127,15 @@ FT_CALLBACK_DEF( FT_Error ) - ftc_size_node_reset( FTC_SizeNode node, - FTC_Scaler scaler, - FTC_Manager manager ) + ftc_size_node_reset( FTC_MruNode ftcnode, + FT_Pointer ftcscaler, + FT_Pointer ftcmanager ) { + FTC_SizeNode node = (FTC_SizeNode)ftcnode; + FTC_Scaler scaler = (FTC_Scaler)ftcscaler; + FTC_Manager manager = (FTC_Manager)ftcmanager; + + FT_Done_Size( node->size ); node->scaler = scaler[0]; @@ -132,20 +147,24 @@ FT_CALLBACK_TABLE_DEF const FTC_MruListClassRec ftc_size_list_class = { - sizeof( FTC_SizeNodeRec ), - (FTC_MruNode_CompareFunc)ftc_size_node_compare, - (FTC_MruNode_InitFunc) ftc_size_node_init, - (FTC_MruNode_ResetFunc) ftc_size_node_reset, - (FTC_MruNode_DoneFunc) ftc_size_node_done + sizeof ( FTC_SizeNodeRec ), + ftc_size_node_compare, + ftc_size_node_init, + ftc_size_node_reset, + ftc_size_node_done }; /* helper function used by ftc_face_node_done */ - static FT_Bool - ftc_size_node_compare_faceid( FTC_SizeNode node, - FTC_FaceID face_id ) + static FT_Int + ftc_size_node_compare_faceid( FTC_MruNode ftcnode, + FT_Pointer ftcface_id ) { - return FT_BOOL( node->scaler.face_id == face_id ); + FTC_SizeNode node = (FTC_SizeNode)ftcnode; + FTC_FaceID face_id = (FTC_FaceID)ftcface_id; + + + return node->scaler.face_id == face_id; } @@ -202,11 +221,14 @@ FT_CALLBACK_DEF( FT_Error ) - ftc_face_node_init( FTC_FaceNode node, - FTC_FaceID face_id, - FTC_Manager manager ) + ftc_face_node_init( FTC_MruNode ftcnode, + FT_Pointer ftcface_id, + FT_Pointer ftcmanager ) { - FT_Error error; + FTC_FaceNode node = (FTC_FaceNode)ftcnode; + FTC_FaceID face_id = (FTC_FaceID)ftcface_id; + FTC_Manager manager = (FTC_Manager)ftcmanager; + FT_Error error; node->face_id = face_id; @@ -227,15 +249,18 @@ FT_CALLBACK_DEF( void ) - ftc_face_node_done( FTC_FaceNode node, - FTC_Manager manager ) + ftc_face_node_done( FTC_MruNode ftcnode, + FT_Pointer ftcmanager ) { + FTC_FaceNode node = (FTC_FaceNode)ftcnode; + FTC_Manager manager = (FTC_Manager)ftcmanager; + + /* we must begin by removing all scalers for the target face */ /* from the manager's list */ - FTC_MruList_RemoveSelection( - & manager->sizes, - (FTC_MruNode_CompareFunc)ftc_size_node_compare_faceid, - node->face_id ); + FTC_MruList_RemoveSelection( &manager->sizes, + ftc_size_node_compare_faceid, + node->face_id ); /* all right, we can discard the face now */ FT_Done_Face( node->face ); @@ -244,10 +269,14 @@ } - FT_CALLBACK_DEF( FT_Bool ) - ftc_face_node_compare( FTC_FaceNode node, - FTC_FaceID face_id ) + FT_CALLBACK_DEF( FT_Int ) + ftc_face_node_compare( FTC_MruNode ftcnode, + FT_Pointer ftcface_id ) { + FTC_FaceNode node = (FTC_FaceNode)ftcnode; + FTC_FaceID face_id = (FTC_FaceID)ftcface_id; + + return FT_BOOL( node->face_id == face_id ); } @@ -255,12 +284,12 @@ FT_CALLBACK_TABLE_DEF const FTC_MruListClassRec ftc_face_list_class = { - sizeof( FTC_FaceNodeRec), + sizeof ( FTC_FaceNodeRec), - (FTC_MruNode_CompareFunc)ftc_face_node_compare, - (FTC_MruNode_InitFunc) ftc_face_node_init, - (FTC_MruNode_ResetFunc) NULL, - (FTC_MruNode_DoneFunc) ftc_face_node_done + ftc_face_node_compare, + ftc_face_node_init, + 0, /* FTC_MruNode_ResetFunc */ + ftc_face_node_done }; diff --git a/src/cache/ftcsbits.c b/src/cache/ftcsbits.c index 6af5c7ee6..68bab08cd 100644 --- a/src/cache/ftcsbits.c +++ b/src/cache/ftcsbits.c @@ -77,9 +77,12 @@ FT_LOCAL_DEF( void ) - ftc_snode_free( FTC_SNode snode, + ftc_snode_free( FTC_Node ftcsnode, FTC_Cache cache ) { + FTC_SNode snode = (FTC_SNode)ftcsnode; + + FTC_SNode_Free( snode, cache ); } @@ -240,10 +243,14 @@ FT_LOCAL_DEF( FT_Error ) - ftc_snode_new( FTC_SNode *psnode, - FTC_GQuery gquery, + ftc_snode_new( FTC_Node *ftcpsnode, + FT_Pointer ftcgquery, FTC_Cache cache ) { + FTC_SNode *psnode = (FTC_SNode*)ftcpsnode; + FTC_GQuery gquery = (FTC_GQuery)ftcgquery; + + return FTC_SNode_New( psnode, gquery, cache ); } @@ -280,8 +287,13 @@ FT_LOCAL_DEF( FT_ULong ) - ftc_snode_weight( FTC_SNode snode ) + ftc_snode_weight( FTC_Node ftcsnode, + FTC_Cache cache ) { + FTC_SNode snode = (FTC_SNode)ftcsnode; + FT_UNUSED( cache ); + + return FTC_SNode_Weight( snode ); } @@ -322,10 +334,14 @@ FT_LOCAL_DEF( FT_Bool ) - ftc_snode_compare( FTC_SNode snode, - FTC_GQuery gquery, + ftc_snode_compare( FTC_Node ftcsnode, + FT_Pointer ftcgquery, FTC_Cache cache ) { + FTC_SNode snode = (FTC_SNode)ftcsnode; + FTC_GQuery gquery = (FTC_GQuery)ftcgquery; + + return FTC_SNode_Compare( snode, gquery, cache ); }