Ignore invalid `setcurrentpoint' operations in Type 1 fonts. This fixes Savannah bug #28226. At least two wild PostScript files of unknown provenance contain Type 1 fonts, apparently converted from TrueType fonts in earlier PDF versions of the files, which use the `setcurrentpoint' operator inappropriately. FreeType currently throws an error in this case, but Ghostscript and Adobe Distiller both accept the fonts and ignore the problem. This commit #ifdefs out the check so PostScript interpreters using FreeType can render these files. The specification says `setcurrentpoint' should only be used to set the point after a `Subr' call, but these fonts use it to set the initial point to (0,0). Unnecessarily so, as they correctly use an `hsbw' operation which implicitly sets the initial point.
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
diff --git a/ChangeLog b/ChangeLog
index 454d73b..b8b209f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+2009-12-14 Ken Sharp <ken.sharp@artifex.com>
+
+ Ignore invalid `setcurrentpoint' operations in Type 1 fonts.
+ This fixes Savannah bug #28226.
+
+ At least two wild PostScript files of unknown provenance contain
+ Type 1 fonts, apparently converted from TrueType fonts in earlier
+ PDF versions of the files, which use the `setcurrentpoint' operator
+ inappropriately.
+
+ FreeType currently throws an error in this case, but Ghostscript and
+ Adobe Distiller both accept the fonts and ignore the problem. This
+ commit #ifdefs out the check so PostScript interpreters using
+ FreeType can render these files.
+
+ The specification says `setcurrentpoint' should only be used to set
+ the point after a `Subr' call, but these fonts use it to set the
+ initial point to (0,0). Unnecessarily so, as they correctly use an
+ `hsbw' operation which implicitly sets the initial point.
+
2009-12-14 Bram Tassyns <bramt@enfocus.be>
Fix parsing of /CIDFontVersion.
diff --git a/src/psaux/t1decode.c b/src/psaux/t1decode.c
index b3245a6..7c6a787 100644
--- a/src/psaux/t1decode.c
+++ b/src/psaux/t1decode.c
@@ -1453,12 +1453,20 @@
case op_setcurrentpoint:
FT_TRACE4(( " setcurrentpoint" ));
- /* From the T1 specs, section 6.4: */
+#if 0
+ /* From the T1 specification, section 6.4: */
/* */
/* The setcurrentpoint command is used only in */
/* conjunction with results from OtherSubrs procedures. */
- /* known_othersubr_result_cnt != 0 is already handled above */
+ /* known_othersubr_result_cnt != 0 is already handled */
+ /* above. */
+
+ /* Note, however, that both Ghostscript and Adobe */
+ /* Distiller handle this situation by silently ignoring */
+ /* the inappropriate `setcurrentpoint' instruction. So */
+ /* we do the same. */
+
if ( decoder->flex_state != 1 )
{
FT_ERROR(( "t1_decoder_parse_charstrings:"
@@ -1467,6 +1475,7 @@
}
else
decoder->flex_state = 0;
+#endif
break;
case op_unknown15: