* src/cff/cf2font.c (cf2_computeDarkening): Avoid division by zero.
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
diff --git a/ChangeLog b/ChangeLog
index 10acbbf..2e21e75 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2013-10-03 Dave Arnold <darnold@adobe.com>
+
+ * src/cff/cf2font.c (cf2_computeDarkening): Avoid division by zero.
+
2013-10-02 Darrell Bellert <darrell.bellert@hl.konicaminolta.us>
* src/sfnt/ttload.c (tt_face_load_pclt): Fix `pclt_fields'.
diff --git a/src/cff/cf2font.c b/src/cff/cf2font.c
index 2eb7732..718d1e2 100644
--- a/src/cff/cf2font.c
+++ b/src/cff/cf2font.c
@@ -98,9 +98,15 @@
*/
/* Internal calculations are done in units per thousand for */
- /* convenience. */
+ /* convenience. The x axis is scaled stem width in */
+ /* thousandths of a pixel. That is, 1000 is 1 pixel. */
+ /* The y axis is darkening amount in thousandths of a pixel.*/
+ /* In the code, below, dividing by ppem and */
+ /* adjusting for emRatio converts darkenAmount to character */
+ /* space (font units). */
CF2_Fixed stemWidthPer1000, scaledStem;
+
*darkenAmount = 0;
if ( boldenAmount == 0 && !stemDarkened )
@@ -158,7 +164,7 @@
FT_DivFix( cf2_intToFixed( x1 ), ppem );
- if ( !ydelta )
+ if ( !xdelta )
goto Try_x3;
*darkenAmount = FT_MulFix( x, FT_DivFix( ydelta, xdelta ) ) +
@@ -175,7 +181,7 @@
FT_DivFix( cf2_intToFixed( x2 ), ppem );
- if ( !ydelta )
+ if ( !xdelta )
goto Try_x4;
*darkenAmount = FT_MulFix( x, FT_DivFix( ydelta, xdelta ) ) +
@@ -193,7 +199,7 @@
FT_DivFix( cf2_intToFixed( x3 ), ppem );
- if ( !ydelta )
+ if ( !xdelta )
goto Use_y4;
*darkenAmount = FT_MulFix( x, FT_DivFix( ydelta, xdelta ) ) +