Fix Savannah bug #29846. Previously we discovered fonts which used `setcurrentpoint' to set the initial point of a contour to 0,0. This caused FreeType to raise an error, because the `setcurrentpoint' operator is only supposed to be used with the results from an OtherSubr subroutine. This was fixed by simply ignoring the error and carrying on. Now we have found a font which uses setcurrentpoint to actually establish a non-zero point for a contour during the course of a glyph program. FWIW, these files may be produced by an application called `Intaglio' on the Mac, when converting TrueType fonts to Type 1. The fix allows the new invalid behaviour, the old invalid behaviour and real proper usage of the operator to work the same way as Adobe interpreters apparently do. (t1_decoder_parse_charstrings): Make `setcurrentpoint' use the top two elements of the stack to establish unconditionally the current x and y coordinates. Make the `flex' subroutine handling (OtherSubr 0) put the current x,y coordinates onto the stack, instead of two dummy uninitialised values.
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
diff --git a/ChangeLog b/ChangeLog
index 9e14fb5..0a0f4ec 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,33 @@
-2010-04-14 Ken Sharp <ken.sharp@artifex.com>
+2010-05-10 Ken Sharp <ken.sharp@artifex.com>
+
+ Fix Savannah bug #29846.
+
+ Previously we discovered fonts which used `setcurrentpoint' to set
+ the initial point of a contour to 0,0. This caused FreeType to
+ raise an error, because the `setcurrentpoint' operator is only
+ supposed to be used with the results from an OtherSubr subroutine.
+
+ This was fixed by simply ignoring the error and carrying on.
+
+ Now we have found a font which uses setcurrentpoint to actually
+ establish a non-zero point for a contour during the course of a
+ glyph program. FWIW, these files may be produced by an application
+ called `Intaglio' on the Mac, when converting TrueType fonts to
+ Type 1.
+ The fix allows the new invalid behaviour, the old invalid behaviour
+ and real proper usage of the operator to work the same way as Adobe
+ interpreters apparently do.
+
+ (t1_decoder_parse_charstrings): Make `setcurrentpoint' use the top
+ two elements of the stack to establish unconditionally the current x
+ and y coordinates.
+
+ Make the `flex' subroutine handling (OtherSubr 0) put the current
+ x,y coordinates onto the stack, instead of two dummy uninitialised
+ values.
+
+2010-04-14 Ken Sharp <ken.sharp@artifex.com>
Fix Savannah bug #29444.
* src/psaux/psobjs.c (t1_builder_start_point): Accept (invalid)
diff --git a/src/psaux/t1decode.c b/src/psaux/t1decode.c
index 31554ff..4f7853e 100644
--- a/src/psaux/t1decode.c
+++ b/src/psaux/t1decode.c
@@ -777,6 +777,8 @@
}
/* the two `results' are popped by the following setcurrentpoint */
+ top[0] = x;
+ top[1] = y;
known_othersubr_result_cnt = 2;
break;
@@ -1481,6 +1483,8 @@
}
else
#endif
+ x = top[0];
+ y = top[1];
decoder->flex_state = 0;
break;