shithub: freetype+ttf2subf

Download patch

ref: 72447195cef09a0cb0139831f11faf1cef7cc8d6
parent: 4cd5fd463edd0055c5270a0e13c52983668ce078
author: David 'Digit' Turner <[email protected]>
date: Thu Jan 24 19:36:35 EST 2013

[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.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2013-01-25  David 'Digit' Turner  <[email protected]>
+
+	[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  <[email protected]>
 
 	[base] Make `FT_Hypot' really internal.
--- 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                         )
--- 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,
@@ -967,6 +965,18 @@
     }
 
     return 1000;
+  }
+
+
+  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 );
   }
 
 
--- a/src/truetype/ttsubpix.h
+++ b/src/truetype/ttsubpix.h
@@ -70,22 +70,15 @@
                   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 */