summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlgs/Resource/Init/gs_epsf.ps
diff options
context:
space:
mode:
Diffstat (limited to 'Master/tlpkg/tlgs/Resource/Init/gs_epsf.ps')
-rw-r--r--Master/tlpkg/tlgs/Resource/Init/gs_epsf.ps63
1 files changed, 44 insertions, 19 deletions
diff --git a/Master/tlpkg/tlgs/Resource/Init/gs_epsf.ps b/Master/tlpkg/tlgs/Resource/Init/gs_epsf.ps
index 2d0f6774716..b337f42856f 100644
--- a/Master/tlpkg/tlgs/Resource/Init/gs_epsf.ps
+++ b/Master/tlpkg/tlgs/Resource/Init/gs_epsf.ps
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2018 Artifex Software, Inc.
+% Copyright (C) 2001-2019 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
@@ -44,7 +44,7 @@
} {
cleartomark //false
} ifelse
-} bind def
+} bind executeonly odef
% Crop the page to the BoundingBox
/EPSBoundingBoxCrop { % llx lly urx ury --
@@ -54,7 +54,7 @@
exch 3 index sub exch 2 index sub % stack: llx lly urx-llx ury-lly
<< /PageSize [ 5 -2 roll ] >> setpagedevice
neg exch neg exch translate
-} bind def
+} bind executeonly odef
% Rescale, translate and rotate to fit the BoundingBox on the page
/EPSBoundingBoxFitPage { % llx lly urx ury --
@@ -69,9 +69,18 @@
6 index 10 index sub 6 index 10 index sub gt % bbox page-clipbox page-is-landscape bbox-is-landscape
xor
}{
- false
+ //false
}ifelse
- 9 1 roll % compute need-rotate.
+ dup 10 1 roll % need-rotate compute need-rotate.
+
+ % if we are rotating the contents, we need to also rotate the
+ % bounding box of the content!
+ {
+ 8 -4 roll
+ exch 4 -2 roll exch 4 2 roll
+ 8 4 roll
+ } if
+
% stack: rotate-needed bbox page-clipbox
% calculate scale to fit smaller of width or height
exch 4 -1 roll sub 3 1 roll exch sub
@@ -84,8 +93,8 @@
% translate to EPS -llx,-lly
exch neg exch neg translate
% Finally perform the rotate if needed.
- { clippath pathbbox pop 0 exch translate 90 rotate pop pop } if
-} bind def
+ { clippath pathbbox pop 0 translate 90 rotate pop pop } if
+} bind executeonly odef
/EPSBoundingBoxProcess { % (llx lly urx ury) state --
//systemdict /EPSBoundingBoxState get 1 index lt {
@@ -121,7 +130,8 @@
} {
pop pop
} ifelse
-} bind def
+} bind executeonly odef
+
/ProcessEPSComment { % file comment -- file comment
/EPSBoundingBoxState .systemvar 3 lt {
@@ -184,19 +194,20 @@
} ifelse
} ifelse
} if
-} bind def
+} bind executeonly def
% Install EPS handler for DSC comments, which we do later
/EPSBoundingBoxInit {
systemdict /NOEPS known not {
% Merge ProcessEPSComment with existing handler
- /ProcessEPSComment load /exec load
+ //ProcessEPSComment /exec load
currentuserparams /ProcessDSCComment get
dup //null eq {pop {pop pop}} if /exec load
4 array astore cvx readonly
<< /ProcessDSCComment 3 -1 roll >> setuserparams
} if
-} bind def
+} bind executeonly odef
+
/.runNoEPS /run load def
@@ -206,13 +217,13 @@
/runEPS_op_count count 2 sub def
/runEPS_page_count currentpagedevice /PageCount get def
0 EPSBoundingBoxSetState
- .runNoEPS
+ //.runNoEPS
currentpagedevice /PageCount get runEPS_page_count sub 0 eq
{ /showpage load exec } if
count runEPS_op_count sub {pop} repeat
countdictstack runEPS_dict_count sub {end} repeat
runEPS_save restore
-} bind def
+} bind executeonly odef
/run { % file OR string --
dup type /filetype ne { (r) file } if
@@ -223,29 +234,29 @@
pop pop pop
EPSDEBUG {(runEPS: Found EPS\n) print flush} if
systemdict /NOEPS known {
- cvx .runNoEPS
+ cvx //.runNoEPS
} {
cvx .runEPS
} ifelse
} {
EPSDEBUG {(runEPS: Normal DSC\n) print flush} if
pop
- cvx .runNoEPS
+ cvx //.runNoEPS
} ifelse
} {
EPSDEBUG {(runEPS: Short DSC\n) print flush} if
pop
- cvx .runNoEPS
+ cvx //.runNoEPS
} ifelse
} {
EPSDEBUG {(runEPS: Not DSC\n) print flush} if
- cvx .runNoEPS
+ cvx //.runNoEPS
} ifelse
} {
EPSDEBUG {(runEPS: Short non-DSC\n) print flush} if
pop
- cvx .runNoEPS
+ cvx //.runNoEPS
} ifelse
} bind odef
@@ -278,7 +289,7 @@
% Now interpret the PostScript.
exch () /SubFileDecode filter cvx run
}
- { .runnoepsf
+ { //.runnoepsf
}
ifelse
} odef
@@ -289,3 +300,17 @@ userdict begin
{ (%stdin) run } execute0
} bind def
end
+
+% undefine things defined in this file and not referenced elsewhere
+[
+ /.runNoEPS
+ /.runnoepsf
+ /.runEPS
+ /EPSBoundingBoxSetState
+ /EPSBoundingBoxCrop
+ /EPSBoundingBoxFitPage
+ /EPSBoundingBoxParse
+ /EPSBoundingBoxProcess
+ /ProcessEPSComment
+]
+{currentdict exch .forceundef} forall