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.
This commit is contained in:
Ken Sharp 2009-12-14 22:32:32 +01:00 committed by Werner Lemberg
parent 2db9783869
commit ce41259372
2 changed files with 31 additions and 2 deletions

View File

@ -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.

View File

@ -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: