[autofit] Make default script a global property. * src/autofit/afmodule.h (AF_ModuleRec): Add `default_script' field. * src/autofit/afglobal.c (af_face_globals_compute_script_coverage, af_face_globals_new), src/autofit/afloader.c (af_loader_reset), src/autofit/afmodule.c (af_property_get) <glyph-to-script-map>, af_autofitter_init: Handle default script. * src/autofit/afglobal.h: 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
diff --git a/ChangeLog b/ChangeLog
index 6d2a0a1..d17bcb7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
2012-09-15 Werner Lemberg <wl@gnu.org>
+ [autofit] Make default script a global property.
+
+ * src/autofit/afmodule.h (AF_ModuleRec): Add `default_script' field.
+
+ * src/autofit/afglobal.c (af_face_globals_compute_script_coverage,
+ af_face_globals_new), src/autofit/afloader.c (af_loader_reset),
+ src/autofit/afmodule.c (af_property_get) <glyph-to-script-map>,
+ af_autofitter_init:
+ Handle default script.
+
+ * src/autofit/afglobal.h: Updated.
+
+2012-09-15 Werner Lemberg <wl@gnu.org>
+
Use `FT_Module' instead of `FT_Library' argument in property funcs.
This internal change simplifies access to global module data.
diff --git a/src/autofit/afglobal.c b/src/autofit/afglobal.c
index 1842c86..464e6d5 100644
--- a/src/autofit/afglobal.c
+++ b/src/autofit/afglobal.c
@@ -53,7 +53,8 @@
/* Compute the script index of each glyph within a given face. */
static FT_Error
- af_face_globals_compute_script_coverage( AF_FaceGlobals globals )
+ af_face_globals_compute_script_coverage( AF_FaceGlobals globals,
+ FT_UInt default_script )
{
FT_Error error = AF_Err_Ok;
FT_Face face = globals->face;
@@ -144,7 +145,7 @@
if ( ( gscripts[nn] & ~AF_DIGIT ) == AF_SCRIPT_NONE )
{
gscripts[nn] &= ~AF_SCRIPT_NONE;
- gscripts[nn] |= AF_SCRIPT_DEFAULT;
+ gscripts[nn] |= default_script;
}
}
}
@@ -156,7 +157,8 @@
FT_LOCAL_DEF( FT_Error )
af_face_globals_new( FT_Face face,
- AF_FaceGlobals *aglobals )
+ AF_FaceGlobals *aglobals,
+ FT_UInt default_script )
{
FT_Error error;
FT_Memory memory;
@@ -173,7 +175,8 @@
globals->glyph_count = face->num_glyphs;
globals->glyph_scripts = (FT_Byte*)( globals + 1 );
- error = af_face_globals_compute_script_coverage( globals );
+ error = af_face_globals_compute_script_coverage( globals,
+ default_script );
if ( error )
{
af_face_globals_free( globals );
diff --git a/src/autofit/afglobal.h b/src/autofit/afglobal.h
index 3bb77d1..3dec6d0 100644
--- a/src/autofit/afglobal.h
+++ b/src/autofit/afglobal.h
@@ -69,7 +69,8 @@ FT_BEGIN_HEADER
FT_LOCAL( FT_Error )
af_face_globals_new( FT_Face face,
- AF_FaceGlobals *aglobals );
+ AF_FaceGlobals *aglobals,
+ FT_UInt default_script );
FT_LOCAL( FT_Error )
af_face_globals_get_metrics( AF_FaceGlobals globals,
diff --git a/src/autofit/afloader.c b/src/autofit/afloader.c
index 8d09866..98824dc 100644
--- a/src/autofit/afloader.c
+++ b/src/autofit/afloader.c
@@ -59,7 +59,8 @@
if ( loader->globals == NULL )
{
- error = af_face_globals_new( face, &loader->globals );
+ error = af_face_globals_new( face, &loader->globals,
+ module->default_script );
if ( !error )
{
face->autohint.data =
diff --git a/src/autofit/afmodule.c b/src/autofit/afmodule.c
index 7e6a5dc..2252bc3 100644
--- a/src/autofit/afmodule.c
+++ b/src/autofit/afmodule.c
@@ -62,9 +62,8 @@
const char* property_name,
void* value )
{
- FT_Error error = FT_Err_Ok;
-
- FT_UNUSED( module );
+ FT_Error error = FT_Err_Ok;
+ FT_UInt default_script = ((AF_Module)module)->default_script;
if ( !ft_strcmp( property_name, "glyph-to-script-map" ) )
@@ -81,7 +80,7 @@
{
/* trigger computation of the global script data */
/* in case it hasn't been done yet */
- error = af_face_globals_new( prop->face, &globals );
+ error = af_face_globals_new( prop->face, &globals, default_script );
if ( !error )
{
prop->face->autohint.data =
@@ -139,6 +138,8 @@
FT_CALLBACK_DEF( FT_Error )
af_autofitter_init( AF_Module module )
{
+ module->default_script = AF_SCRIPT_DEFAULT;
+
return af_loader_init( module );
}
diff --git a/src/autofit/afmodule.h b/src/autofit/afmodule.h
index b02adf4..8948c1b 100644
--- a/src/autofit/afmodule.h
+++ b/src/autofit/afmodule.h
@@ -40,6 +40,8 @@ FT_BEGIN_HEADER
{
FT_ModuleRec root;
+ FT_UInt default_script;
+
AF_LoaderRec loader[1];
} AF_ModuleRec;