From 72447195cef09a0cb0139831f11faf1cef7cc8d6 Mon Sep 17 00:00:00 2001 From: David 'Digit' Turner Date: Fri, 25 Jan 2013 00:36:35 +0100 Subject: [PATCH] [truetype] Fix C++ compilation. * src/truetype/ttsubpix.h: Updated. (SPH_X_SCALING_RULES_SIZE): Moved and renamed to... * src/truetype/ttsubpix.c (X_SCALING_RULES_SIZE): This. (sph_X_SCALING_Rules): Removed. (scale_test_tweak): Make function static. (sph_test_tweak_x_scaling): New function. * src/truetype/ttgload.c (TT_Process_Simple_Glyph): Updated. --- ChangeLog | 13 +++++++++++++ src/truetype/ttgload.c | 9 +++++---- src/truetype/ttsubpix.c | 22 ++++++++++++++++------ src/truetype/ttsubpix.h | 17 +++++------------ 4 files changed, 39 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index b6011ddea..eb5c617cd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2013-01-25 David 'Digit' Turner + + [truetype] Fix C++ compilation. + + * src/truetype/ttsubpix.h: Updated. + (SPH_X_SCALING_RULES_SIZE): Moved and renamed to... + * src/truetype/ttsubpix.c (X_SCALING_RULES_SIZE): This. + (sph_X_SCALING_Rules): Removed. + (scale_test_tweak): Make function static. + (sph_test_tweak_x_scaling): New function. + + * src/truetype/ttgload.c (TT_Process_Simple_Glyph): Updated. + 2013-01-23 Werner Lemberg [base] Make `FT_Hypot' really internal. diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index 008b850ab..08718db0e 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -913,10 +913,11 @@ #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING /* scale, but only if enabled and only if TT hinting is being used */ if ( IS_HINTED( loader->load_flags ) ) - x_scale_factor = scale_test_tweak( face, family, ppem, style, - loader->glyph_index, - sph_X_SCALING_Rules, - SPH_X_SCALING_RULES_SIZE ); + x_scale_factor = sph_test_tweak_x_scaling( face, + family, + ppem, + style, + loader->glyph_index ); /* scale the glyph */ if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 || x_scale_factor != 1000 ) diff --git a/src/truetype/ttsubpix.c b/src/truetype/ttsubpix.c index dfae017e5..cfd99863e 100644 --- a/src/truetype/ttsubpix.c +++ b/src/truetype/ttsubpix.c @@ -756,7 +756,9 @@ /* This sometimes needs to be coordinated with compatible width rules. */ /* A value of 1000 corresponds to a scaled value of 1.0. */ - static const SPH_ScaleRule X_SCALING_Rules[SPH_X_SCALING_RULES_SIZE] = +#define X_SCALING_RULES_SIZE 50 + + static const SPH_ScaleRule X_SCALING_Rules[X_SCALING_RULES_SIZE] = { { "DejaVu Sans", 12, "Regular Class", 'm', 950 }, { "Verdana and Clones", 12, "Regular Class", 'a', 1100 }, @@ -834,10 +836,6 @@ #endif /* FORCE_NATURAL_WIDTHS */ - FT_LOCAL_DEF( const SPH_ScaleRule* const ) sph_X_SCALING_Rules - = X_SCALING_Rules; - - FT_LOCAL_DEF( FT_Bool ) is_member_of_family_class( const FT_String* detected_font_name, const FT_String* rule_font_name ) @@ -939,7 +937,7 @@ } - FT_LOCAL_DEF( FT_UInt ) + static FT_UInt scale_test_tweak( TT_Face face, const FT_String* family, FT_UInt ppem, @@ -970,6 +968,18 @@ } + FT_LOCAL_DEF( FT_UInt ) + sph_test_tweak_x_scaling( TT_Face face, + const FT_String* family, + FT_UInt ppem, + const FT_String* style, + FT_UInt glyph_index ) + { + return scale_test_tweak( face, family, ppem, style, glyph_index, + X_SCALING_Rules, X_SCALING_RULES_SIZE ); + } + + #define TWEAK_RULES( x ) \ if ( sph_test_tweak( face, family, ppem, style, glyph_index, \ x##_Rules, x##_RULES_SIZE ) ) \ diff --git a/src/truetype/ttsubpix.h b/src/truetype/ttsubpix.h index ff8988a14..6ae441373 100644 --- a/src/truetype/ttsubpix.h +++ b/src/truetype/ttsubpix.h @@ -70,24 +70,17 @@ FT_BEGIN_HEADER FT_UInt num_rules ); FT_LOCAL( FT_UInt ) - scale_test_tweak( TT_Face face, - const FT_String* family, - FT_UInt ppem, - const FT_String* style, - FT_UInt glyph_index, - const SPH_ScaleRule* rule, - FT_UInt num_rules ); + sph_test_tweak_x_scaling( TT_Face face, + const FT_String* family, + FT_UInt ppem, + const FT_String* style, + FT_UInt glyph_index ); FT_LOCAL( void ) sph_set_tweaks( TT_Loader loader, FT_UInt glyph_index ); -#define SPH_X_SCALING_RULES_SIZE 50 - - FT_LOCAL( const SPH_ScaleRule* const ) sph_X_SCALING_Rules; - - /* These macros are defined absent a method for setting them */ #define SPH_OPTION_BITMAP_WIDTHS FALSE #define SPH_OPTION_SET_SUBPIXEL TRUE