ref: d0014f2ccbe70ffabae3851dc7c1a1f8fd538b62
parent: 073a4cefbdac04c6b74b097cbb39001a3232db9e
author: Werner Lemberg <[email protected]>
date: Sat Sep 15 06:33:43 EDT 2012
[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.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
2012-09-15 Werner Lemberg <[email protected]>
+ [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 <[email protected]>
+
Use `FT_Module' instead of `FT_Library' argument in property funcs.
This internal change simplifies access to global module data.
--- 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 );
--- a/src/autofit/afglobal.h
+++ b/src/autofit/afglobal.h
@@ -69,7 +69,8 @@
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,
--- 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 =
--- a/src/autofit/afmodule.c
+++ b/src/autofit/afmodule.c
@@ -62,11 +62,10 @@
const char* property_name,
void* value )
{
- FT_Error error = FT_Err_Ok;
+ FT_Error error = FT_Err_Ok;
+ FT_UInt default_script = ((AF_Module)module)->default_script;
- FT_UNUSED( module );
-
if ( !ft_strcmp( property_name, "glyph-to-script-map" ) )
{
FT_Prop_GlyphToScriptMap* prop = (FT_Prop_GlyphToScriptMap*)value;
@@ -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 );
}
--- a/src/autofit/afmodule.h
+++ b/src/autofit/afmodule.h
@@ -40,6 +40,8 @@
{
FT_ModuleRec root;
+ FT_UInt default_script;
+
AF_LoaderRec loader[1];
} AF_ModuleRec;