aboutsummaryrefslogtreecommitdiff
path: root/freetype/src/autofit/afmodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'freetype/src/autofit/afmodule.c')
-rw-r--r--freetype/src/autofit/afmodule.c71
1 files changed, 58 insertions, 13 deletions
diff --git a/freetype/src/autofit/afmodule.c b/freetype/src/autofit/afmodule.c
index 2081925f1..55c8d596f 100644
--- a/freetype/src/autofit/afmodule.c
+++ b/freetype/src/autofit/afmodule.c
@@ -4,7 +4,7 @@
/* */
/* Auto-fitter module implementation (body). */
/* */
-/* Copyright 2003-2006, 2009, 2011-2013 by */
+/* Copyright 2003-2006, 2009, 2011-2014 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -45,7 +45,7 @@
#define FT_COMPONENT trace_afmodule
- FT_Error
+ static FT_Error
af_property_get_face_globals( FT_Face face,
AF_FaceGlobals* aglobals,
AF_Module module )
@@ -60,8 +60,8 @@
globals = (AF_FaceGlobals)face->autohint.data;
if ( !globals )
{
- /* trigger computation of the global script data */
- /* in case it hasn't been done yet */
+ /* trigger computation of the global style data */
+ /* in case it hasn't been done yet */
error = af_face_globals_new( face, &globals, module );
if ( !error )
{
@@ -79,7 +79,7 @@
}
- FT_Error
+ static FT_Error
af_property_set( FT_Module ft_module,
const char* property_name,
const void* value )
@@ -92,8 +92,40 @@
{
FT_UInt* fallback_script = (FT_UInt*)value;
+ FT_UInt ss;
- module->fallback_script = *fallback_script;
+
+ /* We translate the fallback script to a fallback style that uses */
+ /* `fallback-script' as its script and `AF_COVERAGE_NONE' as its */
+ /* coverage value. */
+ for ( ss = 0; AF_STYLE_CLASSES_GET[ss]; ss++ )
+ {
+ AF_StyleClass style_class = AF_STYLE_CLASSES_GET[ss];
+
+
+ if ( style_class->script == *fallback_script &&
+ style_class->coverage == AF_COVERAGE_DEFAULT )
+ {
+ module->fallback_style = ss;
+ break;
+ }
+ }
+
+ if ( !AF_STYLE_CLASSES_GET[ss] )
+ {
+ FT_TRACE0(( "af_property_set: Invalid value %d for property `%s'\n",
+ fallback_script, property_name ));
+ return FT_THROW( Invalid_Argument );
+ }
+
+ return error;
+ }
+ else if ( !ft_strcmp( property_name, "default-script" ) )
+ {
+ FT_UInt* default_script = (FT_UInt*)value;
+
+
+ module->default_script = *default_script;
return error;
}
@@ -116,14 +148,15 @@
}
- FT_Error
+ static FT_Error
af_property_get( FT_Module ft_module,
const char* property_name,
void* value )
{
- FT_Error error = FT_Err_Ok;
- AF_Module module = (AF_Module)ft_module;
- FT_UInt fallback_script = module->fallback_script;
+ FT_Error error = FT_Err_Ok;
+ AF_Module module = (AF_Module)ft_module;
+ FT_UInt fallback_style = module->fallback_style;
+ FT_UInt default_script = module->default_script;
if ( !ft_strcmp( property_name, "glyph-to-script-map" ) )
@@ -134,7 +167,7 @@
error = af_property_get_face_globals( prop->face, &globals, module );
if ( !error )
- prop->map = globals->glyph_scripts;
+ prop->map = globals->glyph_styles;
return error;
}
@@ -142,8 +175,19 @@
{
FT_UInt* val = (FT_UInt*)value;
+ AF_StyleClass style_class = AF_STYLE_CLASSES_GET[fallback_style];
+
+
+ *val = style_class->script;
+
+ return error;
+ }
+ else if ( !ft_strcmp( property_name, "default-script" ) )
+ {
+ FT_UInt* val = (FT_UInt*)value;
+
- *val = fallback_script;
+ *val = default_script;
return error;
}
@@ -206,7 +250,8 @@
AF_Module module = (AF_Module)ft_module;
- module->fallback_script = AF_SCRIPT_FALLBACK;
+ module->fallback_style = AF_STYLE_FALLBACK;
+ module->default_script = AF_SCRIPT_DEFAULT;
return af_loader_init( module );
}