[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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236
diff --git a/ChangeLog b/ChangeLog
index 63a8bf2..b561422 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,23 @@
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'.
* include/freetype/internal/fttrace.h: Add `afmodule'.
diff --git a/src/autofit/afloader.c b/src/autofit/afloader.c
index fabbf92..8d09866 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 707ce32..1f34d17 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 fd44f39..9231465 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 d979239..b02adf4 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)