diff options
author | Ray Johnston <ray.johnston@artifex.com> | 2020-11-07 13:14:06 -0800 |
---|---|---|
committer | Ray Johnston <ray.johnston@artifex.com> | 2020-11-07 14:47:18 -0800 |
commit | cceb68900b433e7ce518619b9dd2ceb01c4fed9d (patch) | |
tree | d0ecb191419b8615a6505870b9c15cdb65147aff | |
parent | abe5348a1de7793a5d4d6ecfa4d054e5f94731de (diff) | |
download | ghostpdl-cceb68900b433e7ce518619b9dd2ceb01c4fed9d.tar.gz |
Fix bug 688166. EPS DSC comment processing not terminating properly.
The example files of this bug do not have %%EndComments before other
BoundingBox comments which confuse the image placement logic resulting
in a blank page.
This patch, provided by Peter Cherepanov, fixes the problem by stopping
the DSC processing when (%%BeginProlog) (%%BeginSetup) or %%EndComments
is encountered.
Cluster regression passes, showing only 1 file that rotates differently
when -dEPSFitPage is used (just to insure that DSC processing is OK).
-rw-r--r-- | Resource/Init/gs_epsf.ps | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/Resource/Init/gs_epsf.ps b/Resource/Init/gs_epsf.ps index 0e4e3c8cd..6eab760eb 100644 --- a/Resource/Init/gs_epsf.ps +++ b/Resource/Init/gs_epsf.ps @@ -160,6 +160,25 @@ } ifelse } bind executeonly odef +% Perform anchorsearch on the strings in the array until a match is found. +/anchorsearchforany { % haystack [needle1 ...] --> post needle true + % --> haystack false + false 3 1 roll % false haystack [...] + { % false haystack needle + dup 3 1 roll % false needle haystack needle + anchorsearch { + % false needle post needle + pop % false needle post + 3 1 roll % post false needle + exch not exch % post true needle + exit + } { + % false needle haystack + exch pop % false haystack + } ifelse + } forall + exch % haystack false | post needle true +} bind def /ProcessEPSComment { % file comment -- file comment /EPSBoundingBoxState .systemvar 3 lt { @@ -213,7 +232,8 @@ } ifelse } ifelse } { - (%%EndComments) anchorsearch { + {(%%EndComments) (%%BeginProlog) (%%BeginSetup)} anchorsearchforany { + EPSDEBUG { (EPSComment processing finished, encountered: ) print dup = } if pop pop % discard the strings from the anchorsearch % We may have seen BoundingBox or HiResBounfingBox. If so and if EPSFitPage % is set, then we do the transformation here to scale and center the page, |