Commit 2e4188d83364219d0ff3a207fa7d3980844dded4

Werner Lemberg 2017-05-28T07:46:22

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

diff --git a/ChangeLog b/ChangeLog
index feb14f7..5ba0f51 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
 2017-05-28  Werner Lemberg  <wl@gnu.org>
 
+	[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  <wl@gnu.org>
+
 	Fix negation of INT_MIN and LONG_MIN (#46149).
 
 	* src/base/ftcalc.c (FT_MOVE_SIGN): Add argument to pass unsigned
diff --git a/src/cff/cf2blues.c b/src/cff/cf2blues.c
index 250f89e..141d0fc 100644
--- 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 )
diff --git a/src/cff/cf2blues.h b/src/cff/cf2blues.h
index 96fb60f..a6bcd9d 100644
--- a/src/cff/cf2blues.h
+++ b/src/cff/cf2blues.h
@@ -111,7 +111,7 @@ FT_BEGIN_HEADER
    * 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 */
diff --git a/src/cff/cf2fixed.h b/src/cff/cf2fixed.h
index 2e4b503..d8e695b 100644
--- a/src/cff/cf2fixed.h
+++ b/src/cff/cf2fixed.h
@@ -63,7 +63,7 @@ FT_BEGIN_HEADER
           ( (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) )
diff --git a/src/cff/cf2font.c b/src/cff/cf2font.c
index a86e361..2551437 100644
--- 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 )
diff --git a/src/cff/cf2hints.c b/src/cff/cf2hints.c
index c8f7dfe..a6fcef4 100644
--- 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 );
         }
       }