From cceb68900b433e7ce518619b9dd2ceb01c4fed9d Mon Sep 17 00:00:00 2001 From: Ray Johnston Date: Sat, 7 Nov 2020 13:14:06 -0800 Subject: 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). --- Resource/Init/gs_epsf.ps | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) 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, -- cgit v1.2.1