Bugs with unused font being referenced in PNG-to-EPS conversion (level 1 and 2)
Posted: 2016-12-14T18:06:49-07:00
There are bugs with an unused font being referenced in the PNG-to-EPS conversion results, both level 1 and level 2 PS output (bug does not exist in code for level 3 PS output).
It has to do with the font being referenced for the "label" in the PS output, even when the option to output the image "label" is not being specified.
The unused font being referenced in the EPS results can cause some distillers to fail when processing PS containing the EPS conversion results if the unused font is not available to the distiller (and even though the font is actually unused).
The fixes are to the ImageMagick/coders/ps.c file (level 1 PS output) and to the ImageMagick/coders/ps2.c file (level 2 PS output).
Here are the "unified diffs" for the patches:
In the case of ps2.c, not only was the "label" font reference written out even when the label was not being used, but the label font being referenced was the wrong font, as for the level 2 PS output the Helvetica font is being used for the label but the code was writing out a Times-Roman font reference (which was the label font that was used for the level 1 PS output). This problem is also fixed in the following ps2.c patch.
It has to do with the font being referenced for the "label" in the PS output, even when the option to output the image "label" is not being specified.
The unused font being referenced in the EPS results can cause some distillers to fail when processing PS containing the EPS conversion results if the unused font is not available to the distiller (and even though the font is actually unused).
The fixes are to the ImageMagick/coders/ps.c file (level 1 PS output) and to the ImageMagick/coders/ps2.c file (level 2 PS output).
Here are the "unified diffs" for the patches:
Code: Select all
--- orig/ImageMagick/coders/ps.c 2016-12-14 19:44:07.689461000 -0500
+++ new/ImageMagick/coders/ps.c 2016-12-14 19:44:51.053878000 -0500
@@ -1438,7 +1438,6 @@
" token pop /y exch def pop",
" currentfile buffer readline pop",
" token pop /pointsize exch def pop",
- " /Times-Roman findfont pointsize scalefont setfont",
(const char *) NULL
},
*const PostscriptEpilog[]=
@@ -1809,6 +1808,9 @@
}
value=GetImageProperty(image,"label",exception);
if (value != (const char *) NULL)
+ {
+ (void) WriteBlobString(image,
+ " /Times-Roman findfont pointsize scalefont setfont\n");
for (j=(ssize_t) MultilineCensus(value)-1; j >= 0; j--)
{
(void) WriteBlobString(image," /label 512 string def\n");
@@ -1817,6 +1819,7 @@
" 0 y %g add moveto label show pop\n",j*pointsize+12);
(void) WriteBlobString(image,buffer);
}
+ }
for (s=PostscriptEpilog; *s != (char *) NULL; s++)
{
(void) FormatLocaleString(buffer,MagickPathExtent,"%s\n",*s);
Code: Select all
--- orig/ImageMagick/coders/ps2.c 2016-12-14 19:44:28.491188000 -0500
+++ new/ImageMagick/coders/ps2.c 2016-12-14 19:44:53.428761000 -0500
@@ -357,7 +357,6 @@
" token pop /y exch def pop",
" currentfile buffer readline pop",
" token pop /pointsize exch def pop",
- " /Helvetica findfont pointsize scalefont setfont",
(const char *) NULL
},
*const PostscriptEpilog[]=
@@ -657,6 +656,9 @@
}
value=GetImageProperty(image,"label",exception);
if (value != (const char *) NULL)
+ {
+ (void) WriteBlobString(image,
+ " /Helvetica findfont pointsize scalefont setfont\n");
for (j=(ssize_t) MultilineCensus(value)-1; j >= 0; j--)
{
(void) WriteBlobString(image," /label 512 string def\n");
@@ -665,6 +667,7 @@
" 0 y %g add moveto label show pop\n",j*pointsize+12);
(void) WriteBlobString(image,buffer);
}
+ }
for (q=PostscriptEpilog; *q; q++)
{
(void) FormatLocaleString(buffer,MagickPathExtent,"%s\n",*q);
@@ -693,7 +696,7 @@
bounds.y2=(double) geometry.y+(geometry.height+text_size)-1;
value=GetImageProperty(image,"label",exception);
if (value != (const char *) NULL)
- (void) WriteBlobString(image,"%%PageResources: font Times-Roman\n");
+ (void) WriteBlobString(image,"%%PageResources: font Helvetica\n");
if (LocaleCompare(image_info->magick,"PS2") != 0)
(void) WriteBlobString(image,"userdict begin\n");
start=TellBlob(image);