[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.
This commit is contained in:
Werner Lemberg 2012-09-15 10:33:43 +02:00
parent 073a4cefbd
commit d0014f2ccb
6 changed files with 32 additions and 10 deletions

View File

@ -1,3 +1,17 @@
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.

View File

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

View File

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

View File

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

View File

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

View File

@ -40,6 +40,8 @@ FT_BEGIN_HEADER
{
FT_ModuleRec root;
FT_UInt default_script;
AF_LoaderRec loader[1];
} AF_ModuleRec;