shithub: freetype+ttf2subf

Download patch

ref: 2e4188d83364219d0ff3a207fa7d3980844dded4
parent: 93572190822160f0671b32000ea6a01d9a0ffd07
author: Werner Lemberg <[email protected]>
date: Sun May 28 03:46:22 EDT 2017

[cff] s/cf2_floatToFixed/cf2_doubleToFixed/.

The new name better describes what the macro actually does;
additionally, we don't need a trailing `f' for literals (there was
only a single such instance in the code, but this caused a clang
warning because the macro itself uses `double' literals).

* src/cff/cf2blues.c, src/cff/cf2blues.h, src/cff/cf2fixed.h,
src/cff/cf2font.c, src/cff/cf2hints.c: Updated.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
 2017-05-28  Werner Lemberg  <[email protected]>
 
+	[cff] s/cf2_floatToFixed/cf2_doubleToFixed/.
+
+	The new name better describes what the macro actually does;
+	additionally, we don't need a trailing `f' for literals (there was
+	only a single such instance in the code, but this caused a clang
+	warning because the macro itself uses `double' literals).
+
+	* src/cff/cf2blues.c, src/cff/cf2blues.h, src/cff/cf2fixed.h,
+	src/cff/cf2font.c, src/cff/cf2hints.c: Updated.
+
+2017-05-28  Werner Lemberg  <[email protected]>
+
 	Fix negation of INT_MIN and LONG_MIN (#46149).
 
 	* src/base/ftcalc.c (FT_MOVE_SIGN): Add argument to pass unsigned
--- a/src/cff/cf2blues.c
+++ b/src/cff/cf2blues.c
@@ -408,8 +408,8 @@
       /* Note: constant changed from 0.5 to 0.6 to avoid a problem with */
       /*       10ppem Arial                                             */
 
-      blues->boost = cf2_floatToFixed( .6 ) -
-                       FT_MulDiv( cf2_floatToFixed ( .6 ),
+      blues->boost = cf2_doubleToFixed( .6 ) -
+                       FT_MulDiv( cf2_doubleToFixed ( .6 ),
                                   blues->scale,
                                   blues->blueScale );
       if ( blues->boost > 0x7FFF )
--- a/src/cff/cf2blues.h
+++ b/src/cff/cf2blues.h
@@ -111,7 +111,7 @@
    * Constant used for hint adjustment and for synthetic em box hint
    * placement.
    */
-#define CF2_MIN_COUNTER  cf2_floatToFixed( 0.5 )
+#define CF2_MIN_COUNTER  cf2_doubleToFixed( 0.5 )
 
 
   /* shared typedef is in cf2glue.h */
--- a/src/cff/cf2fixed.h
+++ b/src/cff/cf2fixed.h
@@ -63,7 +63,7 @@
           ( (FT_Short)( ( (FT_UInt32)(x) + 0x8000U ) >> 16 ) )
 #define cf2_fixedRound( x )                                              \
           ( (CF2_Fixed)( ( (FT_UInt32)(x) + 0x8000U ) & 0xFFFF0000UL ) )
-#define cf2_floatToFixed( f )                                            \
+#define cf2_doubleToFixed( f )                                           \
           ( (CF2_Fixed)( (f) * 65536.0 + 0.5 ) )
 #define cf2_fixedAbs( x )                                                \
           ( (x) < 0 ? -(x) : (x) )
--- a/src/cff/cf2font.c
+++ b/src/cff/cf2font.c
@@ -117,7 +117,7 @@
       return;
 
     /* protect against range problems and divide by zero */
-    if ( emRatio < cf2_floatToFixed( .01 ) )
+    if ( emRatio < cf2_doubleToFixed( .01 ) )
       return;
 
     if ( stemDarkened )
--- a/src/cff/cf2hints.c
+++ b/src/cff/cf2hints.c
@@ -1063,7 +1063,7 @@
                                      cf2_fixedAbs( glyphpath->yOffset ) );
 
     /* .1 character space unit */
-    glyphpath->snapThreshold = cf2_floatToFixed( 0.1f );
+    glyphpath->snapThreshold = cf2_doubleToFixed( 0.1 );
 
     glyphpath->moveIsPending = TRUE;
     glyphpath->pathIsOpen    = FALSE;
@@ -1489,9 +1489,9 @@
         else
         {
           /* +x +y */
-          *x = FT_MulFix( cf2_floatToFixed( 0.7 ),
+          *x = FT_MulFix( cf2_doubleToFixed( 0.7 ),
                           glyphpath->xOffset );
-          *y = FT_MulFix( cf2_floatToFixed( 1.0 - 0.7 ),
+          *y = FT_MulFix( cf2_doubleToFixed( 1.0 - 0.7 ),
                           glyphpath->yOffset );
         }
       }
@@ -1514,9 +1514,9 @@
         else
         {
           /* +x -y */
-          *x = FT_MulFix( cf2_floatToFixed( -0.7 ),
+          *x = FT_MulFix( cf2_doubleToFixed( -0.7 ),
                           glyphpath->xOffset );
-          *y = FT_MulFix( cf2_floatToFixed( 1.0 - 0.7 ),
+          *y = FT_MulFix( cf2_doubleToFixed( 1.0 - 0.7 ),
                           glyphpath->yOffset );
         }
       }
@@ -1542,9 +1542,9 @@
         else
         {
           /* -x +y */
-          *x = FT_MulFix( cf2_floatToFixed( 0.7 ),
+          *x = FT_MulFix( cf2_doubleToFixed( 0.7 ),
                           glyphpath->xOffset );
-          *y = FT_MulFix( cf2_floatToFixed( 1.0 + 0.7 ),
+          *y = FT_MulFix( cf2_doubleToFixed( 1.0 + 0.7 ),
                           glyphpath->yOffset );
         }
       }
@@ -1567,9 +1567,9 @@
         else
         {
           /* -x -y */
-          *x = FT_MulFix( cf2_floatToFixed( -0.7 ),
+          *x = FT_MulFix( cf2_doubleToFixed( -0.7 ),
                           glyphpath->xOffset );
-          *y = FT_MulFix( cf2_floatToFixed( 1.0 + 0.7 ),
+          *y = FT_MulFix( cf2_doubleToFixed( 1.0 + 0.7 ),
                           glyphpath->yOffset );
         }
       }