diff --git a/ChangeLog b/ChangeLog index 63a8bf2ff..b56142284 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2012-09-14 Werner Lemberg + + [autofit] Pass `AF_Module' instead of `AF_Loader'. + + We want to access the (not yet existing) module's global data later + on. + + * src/autofit/afloader.c: Include `afmodule.h'. + (af_loader_init, af_loader_reset, af_loader_done, + af_loader_load_glyph): Change accordingly. + * src/autofit/afmodule.c (AF_ModuleRec): Move to `afmodule.h'. + Updated. + + * src/autofit/afmodule.h: Include `afloader.h'. + (AF_ModuleRec): Define here. + * src/autofit/afloader.h (AF_Module): Define here. + Updated. + 2012-09-14 Werner Lemberg [autofit] Fix `make multi'. diff --git a/src/autofit/afloader.c b/src/autofit/afloader.c index fabbf929f..8d0986690 100644 --- a/src/autofit/afloader.c +++ b/src/autofit/afloader.c @@ -20,14 +20,18 @@ #include "afhints.h" #include "afglobal.h" #include "aferrors.h" +#include "afmodule.h" /* Initialize glyph loader. */ FT_LOCAL_DEF( FT_Error ) - af_loader_init( AF_Loader loader, - FT_Memory memory ) + af_loader_init( AF_Module module ) { + AF_Loader loader = module->loader; + FT_Memory memory = module->root.library->memory; + + FT_ZERO( loader ); af_glyph_hints_init( &loader->hints, memory ); @@ -41,10 +45,11 @@ /* Reset glyph loader and compute globals if necessary. */ FT_LOCAL_DEF( FT_Error ) - af_loader_reset( AF_Loader loader, + af_loader_reset( AF_Module module, FT_Face face ) { - FT_Error error = AF_Err_Ok; + FT_Error error = AF_Err_Ok; + AF_Loader loader = module->loader; loader->face = face; @@ -71,8 +76,11 @@ /* Finalize glyph loader. */ FT_LOCAL_DEF( void ) - af_loader_done( AF_Loader loader ) + af_loader_done( AF_Module module ) { + AF_Loader loader = module->loader; + + af_glyph_hints_done( &loader->hints ); loader->face = NULL; @@ -482,13 +490,14 @@ /* Load a glyph. */ FT_LOCAL_DEF( FT_Error ) - af_loader_load_glyph( AF_Loader loader, + af_loader_load_glyph( AF_Module module, FT_Face face, FT_UInt gindex, FT_Int32 load_flags ) { FT_Error error; - FT_Size size = face->size; + FT_Size size = face->size; + AF_Loader loader = module->loader; AF_ScalerRec scaler; @@ -506,7 +515,7 @@ scaler.render_mode = FT_LOAD_TARGET_MODE( load_flags ); scaler.flags = 0; /* XXX: fix this */ - error = af_loader_reset( loader, face ); + error = af_loader_reset( module, face ); if ( !error ) { AF_ScriptMetrics metrics; diff --git a/src/autofit/afloader.h b/src/autofit/afloader.h index 707ce32fc..1f34d17cc 100644 --- a/src/autofit/afloader.h +++ b/src/autofit/afloader.h @@ -25,11 +25,14 @@ FT_BEGIN_HEADER + typedef struct AF_ModuleRec_* AF_Module; + /* - * The autofitter module's global data structure. If necessary, `local' - * data like the current face, the current face's auto-hint data, or the - * current glyph's parameters relevant to auto-hinting are `swapped in'. - * Cf. functions like `af_loader_reset' and `af_loader_load_g'. + * The autofitter module's (global) data structure to communicate with + * actual fonts. If necessary, `local' data like the current face, the + * current face's auto-hint data, or the current glyph's parameters + * relevant to auto-hinting are `swapped in'. Cf. functions like + * `af_loader_reset' and `af_loader_load_g'. */ typedef struct AF_LoaderRec_ @@ -53,21 +56,20 @@ FT_BEGIN_HEADER FT_LOCAL( FT_Error ) - af_loader_init( AF_Loader loader, - FT_Memory memory ); + af_loader_init( AF_Module module ); FT_LOCAL( FT_Error ) - af_loader_reset( AF_Loader loader, + af_loader_reset( AF_Module module, FT_Face face ); FT_LOCAL( void ) - af_loader_done( AF_Loader loader ); + af_loader_done( AF_Module module ); FT_LOCAL( FT_Error ) - af_loader_load_glyph( AF_Loader loader, + af_loader_load_glyph( AF_Module module, FT_Face face, FT_UInt gindex, FT_Int32 load_flags ); diff --git a/src/autofit/afmodule.c b/src/autofit/afmodule.c index fd44f391b..923146524 100644 --- a/src/autofit/afmodule.c +++ b/src/autofit/afmodule.c @@ -136,32 +136,17 @@ } - /* - * This is the `extended' FT_Module structure which holds the - * autofitter's global data (in `loader'). Right before hinting a glyph, - * the data specific to the glyph's face (blue zones, stem widths, etc.) - * are `swapped in' in function `af_loader_reset'. - */ - - typedef struct AF_ModuleRec_ - { - FT_ModuleRec root; - AF_LoaderRec loader[1]; - - } AF_ModuleRec, *AF_Module; - - FT_CALLBACK_DEF( FT_Error ) af_autofitter_init( AF_Module module ) { - return af_loader_init( module->loader, module->root.library->memory ); + return af_loader_init( module ); } FT_CALLBACK_DEF( void ) af_autofitter_done( AF_Module module ) { - af_loader_done( module->loader ); + af_loader_done( module ); } @@ -174,7 +159,7 @@ { FT_UNUSED( size ); - return af_loader_load_glyph( module->loader, slot->face, + return af_loader_load_glyph( module, slot->face, glyph_index, load_flags ); } diff --git a/src/autofit/afmodule.h b/src/autofit/afmodule.h index d9792399b..b02adf49e 100644 --- a/src/autofit/afmodule.h +++ b/src/autofit/afmodule.h @@ -23,9 +23,28 @@ #include FT_INTERNAL_OBJECTS_H #include FT_MODULE_H +#include "afloader.h" + FT_BEGIN_HEADER + + /* + * This is the `extended' FT_Module structure which holds the + * autofitter's global data. Right before hinting a glyph, the data + * specific to the glyph's face (blue zones, stem widths, etc.) are + * loaded into `loader' (see function `af_loader_reset'). + */ + + typedef struct AF_ModuleRec_ + { + FT_ModuleRec root; + + AF_LoaderRec loader[1]; + + } AF_ModuleRec; + + FT_DECLARE_MODULE(autofit_module_class)