[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.
This commit is contained in:
Werner Lemberg 2012-09-14 12:26:57 +02:00
parent 6d29c5cbe3
commit 95dae1c47a
5 changed files with 68 additions and 35 deletions

View File

@ -1,3 +1,21 @@
2012-09-14 Werner Lemberg <wl@gnu.org>
[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 <wl@gnu.org>
[autofit] Fix `make multi'.

View File

@ -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;

View File

@ -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 );

View File

@ -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 );
}

View File

@ -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)