[autofit] Updated to reduce casting (cont'd).

* src/autofit/afmodule.h (AF_ModuleRec): Change `default_script` type.
* src/autofit/afglobal.c (af_face_globals_compute_style_coverage):
Remove casting.
* src/autofit/afmodule.c (af_property_{set,get}): Updated accordingly.
This commit is contained in:
Alexei Podtelezhnikov 2022-08-01 13:20:13 -04:00
parent 4f195185ee
commit a18ad83e8b
3 changed files with 13 additions and 16 deletions

View File

@ -168,8 +168,7 @@
*/
if ( style_class->coverage == AF_COVERAGE_DEFAULT )
{
if ( (FT_UInt)style_class->script ==
globals->module->default_script )
if ( style_class->script == globals->module->default_script )
dflt = ss;
for ( range = script_class->script_uni_ranges;

View File

@ -119,8 +119,8 @@
if ( !ft_strcmp( property_name, "fallback-script" ) )
{
FT_UInt* fallback_script;
FT_UInt ss;
AF_Script* fallback_script;
FT_UInt ss;
#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
@ -128,7 +128,7 @@
return FT_THROW( Invalid_Argument );
#endif
fallback_script = (FT_UInt*)value;
fallback_script = (AF_Script*)value;
/* We translate the fallback script to a fallback style that uses */
/* `fallback-script' as its script and `AF_COVERAGE_NONE' as its */
@ -138,8 +138,8 @@
AF_StyleClass style_class = af_style_classes[ss];
if ( (FT_UInt)style_class->script == *fallback_script &&
style_class->coverage == AF_COVERAGE_DEFAULT )
if ( style_class->script == *fallback_script &&
style_class->coverage == AF_COVERAGE_DEFAULT )
{
module->fallback_style = ss;
break;
@ -157,7 +157,7 @@
}
else if ( !ft_strcmp( property_name, "default-script" ) )
{
FT_UInt* default_script;
AF_Script* default_script;
#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
@ -165,7 +165,7 @@
return FT_THROW( Invalid_Argument );
#endif
default_script = (FT_UInt*)value;
default_script = (AF_Script*)value;
module->default_script = *default_script;
@ -291,8 +291,6 @@
{
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" ) )
@ -309,9 +307,9 @@
}
else if ( !ft_strcmp( property_name, "fallback-script" ) )
{
FT_UInt* val = (FT_UInt*)value;
AF_Script* val = (AF_Script*)value;
AF_StyleClass style_class = af_style_classes[fallback_style];
AF_StyleClass style_class = af_style_classes[module->fallback_style];
*val = style_class->script;
@ -320,10 +318,10 @@
}
else if ( !ft_strcmp( property_name, "default-script" ) )
{
FT_UInt* val = (FT_UInt*)value;
AF_Script* val = (AF_Script*)value;
*val = default_script;
*val = module->default_script;
return error;
}

View File

@ -36,7 +36,7 @@ FT_BEGIN_HEADER
FT_ModuleRec root;
FT_UInt fallback_style;
FT_UInt default_script;
AF_Script default_script;
FT_Bool no_stem_darkening;
FT_Int darken_params[8];