From 2e4188d83364219d0ff3a207fa7d3980844dded4 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 28 May 2017 07:46:22 +0200 Subject: [PATCH] [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. --- ChangeLog | 12 ++++++++++++ src/cff/cf2blues.c | 4 ++-- src/cff/cf2blues.h | 2 +- src/cff/cf2fixed.h | 2 +- src/cff/cf2font.c | 2 +- src/cff/cf2hints.c | 18 +++++++++--------- 6 files changed, 26 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index feb14f71a..5ba0f51c4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2017-05-28 Werner Lemberg + + [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 Fix negation of INT_MIN and LONG_MIN (#46149). diff --git a/src/cff/cf2blues.c b/src/cff/cf2blues.c index 250f89e0d..141d0fcae 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 96fb60f38..a6bcd9de5 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 2e4b5032f..d8e695b15 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 a86e3619b..25514373b 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 c8f7dfeba..a6fcef44d 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 ); } }