ref: 95dae1c47a441b815d3a70c051cdfd9d8ad747d7
parent: 6d29c5cbe3abe578430fcc5f90a943740d539f90
author: Werner Lemberg <[email protected]>
date: Fri Sep 14 08:26:57 EDT 2012
[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.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,23 @@
2012-09-14 Werner Lemberg <[email protected]>
+ [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 <[email protected]>
+
[autofit] Fix `make multi'.
* include/freetype/internal/fttrace.h: Add `afmodule'.
--- 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;
--- 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_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 );
--- a/src/autofit/afmodule.c
+++ b/src/autofit/afmodule.c
@@ -136,25 +136,10 @@
}
- /*
- * 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 );
}
@@ -161,7 +146,7 @@
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 );
}
--- a/src/autofit/afmodule.h
+++ b/src/autofit/afmodule.h
@@ -23,8 +23,27 @@
#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)