From: Cristy Date: Thu, 15 Dec 2016 13:09:35 +0000 (-0500) Subject: Only reference PS fonts if the image includes labels X-Git-Tag: 7.0.4-0~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d3bb6e5ee8c0f40330351a26dda0cd4d996f646d;p=imagemagick Only reference PS fonts if the image includes labels --- diff --git a/coders/ps.c b/coders/ps.c index 1e6d32101..5d2d063cb 100644 --- a/coders/ps.c +++ b/coders/ps.c @@ -1439,7 +1439,6 @@ static MagickBooleanType WritePSImage(const ImageInfo *image_info,Image *image, " 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[]= @@ -1810,13 +1809,18 @@ RestoreMSCWarning } value=GetImageProperty(image,"label",exception); if (value != (const char *) NULL) - for (j=(ssize_t) MultilineCensus(value)-1; j >= 0; j--) { - (void) WriteBlobString(image," /label 512 string def\n"); - (void) WriteBlobString(image," currentfile label readline pop\n"); - (void) FormatLocaleString(buffer,MagickPathExtent, - " 0 y %g add moveto label show pop\n",j*pointsize+12); - (void) WriteBlobString(image,buffer); + (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"); + (void) WriteBlobString(image, + " currentfile label readline pop\n"); + (void) FormatLocaleString(buffer,MagickPathExtent, + " 0 y %g add moveto label show pop\n",j*pointsize+12); + (void) WriteBlobString(image,buffer); + } } for (s=PostscriptEpilog; *s != (char *) NULL; s++) { diff --git a/coders/ps2.c b/coders/ps2.c index f4105d981..04f404e90 100644 --- a/coders/ps2.c +++ b/coders/ps2.c @@ -357,7 +357,6 @@ static MagickBooleanType WritePS2Image(const ImageInfo *image_info,Image *image, " 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,13 +656,18 @@ static MagickBooleanType WritePS2Image(const ImageInfo *image_info,Image *image, } value=GetImageProperty(image,"label",exception); if (value != (const char *) NULL) - for (j=(ssize_t) MultilineCensus(value)-1; j >= 0; j--) { - (void) WriteBlobString(image," /label 512 string def\n"); - (void) WriteBlobString(image," currentfile label readline pop\n"); - (void) FormatLocaleString(buffer,MagickPathExtent, - " 0 y %g add moveto label show pop\n",j*pointsize+12); - (void) WriteBlobString(image,buffer); + (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"); + (void) WriteBlobString(image, + " currentfile label readline pop\n"); + (void) FormatLocaleString(buffer,MagickPathExtent, + " 0 y %g add moveto label show pop\n",j*pointsize+12); + (void) WriteBlobString(image,buffer); + } } for (q=PostscriptEpilog; *q; q++) { @@ -693,7 +697,7 @@ static MagickBooleanType WritePS2Image(const ImageInfo *image_info,Image *image, 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);