ref: 33655a96474888d9fd46da351944d89635207293
parent: 92f5a047c9407f435f9e6f5a7370ae724aedea42
author: Werner Lemberg <[email protected]>
date: Mon Aug 26 05:58:50 EDT 2013
[autofit] Fix script selection. * src/autofit/afglobal.c (af_face_globals_get_metrics): Use `AF_SCRIPT_DFLT', not value 0. Simplify code. * src/autofit/afscript.h: Sort by script name.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2013-08-26 Werner Lemberg <[email protected]>
+ [autofit] Fix script selection.
+
+ * src/autofit/afglobal.c (af_face_globals_get_metrics): Use
+ `AF_SCRIPT_DFLT', not value 0.
+ Simplify code.
+
+ * src/autofit/afscript.h: Sort by script name.
+
+2013-08-26 Werner Lemberg <[email protected]>
+
[autofit] Make `dummy' hinter work as expected.
* src/autofit/afdummy.c (af_dummy_hints_init): Properly set scaling
--- a/src/autofit/afglobal.c
+++ b/src/autofit/afglobal.c
@@ -246,15 +246,12 @@
AF_ScriptMetrics *ametrics )
{
AF_ScriptMetrics metrics = NULL;
- FT_UInt gidx;
+ AF_Script script = options & 15;
AF_WritingSystemClass writing_system_class;
AF_ScriptClass script_class;
- FT_UInt script = options & 15;
- const FT_Offset script_max = sizeof ( AF_SCRIPT_CLASSES_GET ) /
- sizeof ( AF_SCRIPT_CLASSES_GET[0] );
- FT_Error error = FT_Err_Ok;
+ FT_Error error = FT_Err_Ok;
if ( gindex >= (FT_ULong)globals->glyph_count )
@@ -263,17 +260,16 @@
goto Exit;
}
- gidx = script;
- if ( gidx == 0 || gidx + 1 >= script_max )
- gidx = globals->glyph_scripts[gindex] & AF_SCRIPT_NONE;
+ /* if we have a forced script (via `options'), use it, */
+ /* otherwise look into `glyph_scripts' array */
+ if ( script == AF_SCRIPT_DFLT || script + 1 >= AF_SCRIPT_MAX )
+ script = globals->glyph_scripts[gindex] & AF_SCRIPT_NONE;
- script_class = AF_SCRIPT_CLASSES_GET[gidx];
+ script_class = AF_SCRIPT_CLASSES_GET[script];
writing_system_class = AF_WRITING_SYSTEM_CLASSES_GET
[script_class->writing_system];
- if ( script == 0 )
- script = script_class->script;
- metrics = globals->metrics[script_class->script];
+ metrics = globals->metrics[script];
if ( metrics == NULL )
{
/* create the global metrics object if necessary */
@@ -300,7 +296,7 @@
}
}
- globals->metrics[script_class->script] = metrics;
+ globals->metrics[script] = metrics;
}
Exit:
--- a/src/autofit/afscript.h
+++ b/src/autofit/afscript.h
@@ -22,10 +22,10 @@
/* Add new scripts here. */
+ SCRIPT( deva, DEVA )
SCRIPT( dflt, DFLT )
- SCRIPT( latn, LATN )
SCRIPT( hani, HANI )
- SCRIPT( deva, DEVA )
+ SCRIPT( latn, LATN )
#ifdef FT_OPTION_AUTOFIT2
SCRIPT( ltn2, LTN2 )
#endif