summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlgs/Resource/Init/gs_cet.ps
diff options
context:
space:
mode:
Diffstat (limited to 'Master/tlpkg/tlgs/Resource/Init/gs_cet.ps')
-rw-r--r--Master/tlpkg/tlgs/Resource/Init/gs_cet.ps103
1 files changed, 80 insertions, 23 deletions
diff --git a/Master/tlpkg/tlgs/Resource/Init/gs_cet.ps b/Master/tlpkg/tlgs/Resource/Init/gs_cet.ps
index d3e1686409b..54f17c645d6 100644
--- a/Master/tlpkg/tlgs/Resource/Init/gs_cet.ps
+++ b/Master/tlpkg/tlgs/Resource/Init/gs_cet.ps
@@ -1,31 +1,34 @@
-%!PS
% Set defaults for Ghostscript to match Adobe CPSI behaviour for CET
-% do this in the server level so it is persistent across jobs
-//true 0 startjob not {
- (*** Warning: CET startup is not in server default) = flush
+% skip if we've already run this -- based on fake "product"
+systemdict /product get (PhotoPRINT SE 5.0v2) readonly eq
+{
+ (%END GS_CET) .skipeof
} if
+% Note: this must be run at save level 0 and when systemdict is writeable
+currentglobal //true setglobal
+systemdict dup dup dup
+/version (3017.102) readonly .forceput % match CPSI 3017.102
+/product (PhotoPRINT SE 5.0v2) readonly .forceput % match CPSI 3017.102
+/revision 0 put % match CPSI 3017.103 Tek shows revision 5
+/serialnumber dup {233640} readonly .makeoperator .forceput % match CPSI 3017.102 Tek shows serialnumber 1401788461
+
+systemdict /.odef { % <name> <proc> odef -
+ 1 index exch //.makeoperator def
+} .bind .forceput % this will be undefined at the end
+
300 .sethiresscreen % needed for language switch build since it
% processes gs_init.ps BEFORE setting the resolution
0 array 0 setdash % CET 09-08 wants local setdash
-currentglobal //true setglobal
-{
- systemdict dup dup dup
- /version (3017.102) readonly put % match CPSI 3017.102
- /product (PhotoPRINT SE 5.0v2) readonly put % match CPSI 3017.102
- /revision 0 put % match CPSI 3017.103 Tek shows revision 5
- /serialnumber dup {233640} readonly .makeoperator put % match CPSI 3017.102 Tek shows serialnumber 1401788461
- systemdict /deviceinfo undef % for CET 20-23-1
-% /UNROLLFORMS true put % CET files do unreasonable things inside forms
-} 1183615869 internaldict /superexec get exec
-
-/UNROLLFORMS true def
-
-{ } bind dup
+/UNROLLFORMS //true def
+
+(%.defaultbgrucrproc) cvn { } bind def
+
+(%.defaultbgrucrproc) cvn load dup
setblackgeneration
setundercolorremoval
0 array cvx readonly dup dup dup setcolortransfer
@@ -66,10 +69,62 @@ dup 7 -1 put
% and GS_CHAR_FILL are now dynamic. Force CPSI compatibility.
//true .setCPSImode
+% Some QL jobs (/23-12B.PS for example) do:
+% '(%stdin) (r) file'
+% expecting that they are being read from stdin.
+% if that is not the case, they block waiting for input
+% from stdin.
+% This hooks the 'file' operator', so if a job tries to
+% open %stdin, and we're *not* reading the job from stdin
+% it'll return currentfile instead.
+/ofile /file load def
+/file
+{
+ 1 index (%stdin) eq 2 index (%stdin%) eq or
+ {
+ ofile dup currentfile eq not
+ {
+ pop currentfile
+ }if
+ }
+ {
+ ofile
+ } ifelse
+} bind //.odef exec
+currentdict /ofile undef
+
+% One QL job (23-12B.PS) effectively does:
+% (%stdin) (r) file 0 setfileposition
+% expecting it to throw an ioerror (stdin not being a positionable
+% stream.
+% With the above 'file' hook, when running from a file
+% rather than stdin, setfileposition will succeed, and we hit
+% an infinite loop - '0 setfileposition' meaning we restart intepreting
+% from the beginning of the file.
+% Hook setfileposition to throw an error attempting to reposition
+% the current file.
+/osetfileposition /setfileposition load def
+/setfileposition
+{
+ 1 index currentfile eq
+ {
+ /setfileposition cvx /ioerror signalerror
+ }
+ {
+ osetfileposition
+ } ifelse
+} bind //.odef exec
+currentdict /osetfileposition undef
+
setglobal
-% Remove all but 'letter' page size
+% Remove all but the default page size (the 0 entry in the InputAttributes
+% dictionary). This is usually 'letter'.
<<
+% As we're removing all but the default, make sure we're
+% using the default.
+/PageSize currentpagedevice /InputAttributes get 0 get /PageSize get
+
currentpagedevice /InputAttributes get
1 1 2 index length 1 sub {
1 index exch undef
@@ -86,8 +141,8 @@ userdict /.smoothness currentsmoothness put
} {
/setsmoothness .systemvar /typecheck signalerror
} ifelse
-} bind odef
-/currentsmoothness { userdict /.smoothness get } bind odef % for 09-55.PS, 09-57.PS .
+} bind //.odef exec
+/currentsmoothness { userdict /.smoothness get } bind //.odef exec % for 09-55.PS, 09-57.PS .
% slightly nasty hack to give consistent cluster results
/ofnfa systemdict /filenameforall get def
@@ -106,6 +161,8 @@ userdict /.smoothness currentsmoothness put
} ifelse
ofnfa
} bind def
-% end of slightly nasty hack to give consistent cluster results
-//false 0 startjob pop % re-enter encapsulated mode
+systemdict /.odef .undef
+
+% end of slightly nasty hack to give consistent cluster results
+%END GS_CET