Math simplifications. * src/cf2blues.c (cf2_blues_init): Use `FT_MulDiv'. * src/cf2ft.c (cf2_getScaleAndHintFlag): Use simple division.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
diff --git a/ChangeLog b/ChangeLog
index 164aa6b..5a8e8e2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2014-02-28 Alexei Podtelezhnikov <apodtele@gmail.com>
+
+ [cff] Math simplifications.
+
+ * src/cf2blues.c (cf2_blues_init): Use `FT_MulDiv'.
+ * src/cf2ft.c (cf2_getScaleAndHintFlag): Use simple division.
+
2014-02-28 Dave Arnold <darnold@adobe.com>
[cff] Fix Savannah bug #41697, part 2.
diff --git a/src/cff/cf2blues.c b/src/cff/cf2blues.c
index eec589e..250f89e 100644
--- a/src/cff/cf2blues.c
+++ b/src/cff/cf2blues.c
@@ -4,7 +4,7 @@
/* */
/* Adobe's code for handling Blue Zones (body). */
/* */
-/* Copyright 2009-2013 Adobe Systems Incorporated. */
+/* Copyright 2009-2014 Adobe Systems Incorporated. */
/* */
/* This software, and all works of authorship, whether in source or */
/* object code form as indicated by the copyright notice(s) included */
@@ -408,11 +408,10 @@
/* Note: constant changed from 0.5 to 0.6 to avoid a problem with */
/* 10ppem Arial */
- blues->boost = FT_MulFix(
- cf2_floatToFixed( .6 ),
- ( cf2_intToFixed( 1 ) -
- FT_DivFix( blues->scale,
- blues->blueScale ) ) );
+ blues->boost = cf2_floatToFixed( .6 ) -
+ FT_MulDiv( cf2_floatToFixed ( .6 ),
+ blues->scale,
+ blues->blueScale );
if ( blues->boost > 0x7FFF )
{
/* boost must remain less than 0.5, or baseline could go negative */
diff --git a/src/cff/cf2ft.c b/src/cff/cf2ft.c
index 82bac75..cb8d31c 100644
--- a/src/cff/cf2ft.c
+++ b/src/cff/cf2ft.c
@@ -4,7 +4,7 @@
/* */
/* FreeType Glue Component to Adobe's Interpreter (body). */
/* */
-/* Copyright 2013 Adobe Systems Incorporated. */
+/* Copyright 2013-2014 Adobe Systems Incorporated. */
/* */
/* This software, and all works of authorship, whether in source or */
/* object code form as indicated by the copyright notice(s) included */
@@ -238,10 +238,8 @@
if ( *hinted )
{
- *x_scale = FT_DivFix( decoder->builder.glyph->x_scale,
- cf2_intToFixed( 64 ) );
- *y_scale = FT_DivFix( decoder->builder.glyph->y_scale,
- cf2_intToFixed( 64 ) );
+ *x_scale = ( decoder->builder.glyph->x_scale + 32 ) / 64;
+ *y_scale = ( decoder->builder.glyph->y_scale + 32 ) / 64;
}
else
{
diff --git a/src/cff/cf2hints.c b/src/cff/cf2hints.c
index 79f84fc..5853d77 100644
--- a/src/cff/cf2hints.c
+++ b/src/cff/cf2hints.c
@@ -4,7 +4,7 @@
/* */
/* Adobe's code for handling CFF hints (body). */
/* */
-/* Copyright 2007-2013 Adobe Systems Incorporated. */
+/* Copyright 2007-2014 Adobe Systems Incorporated. */
/* */
/* This software, and all works of authorship, whether in source or */
/* object code form as indicated by the copyright notice(s) included */