| 1 |
% Set defaults for Ghostscript to match Adobe CPSI behaviour for CET |
| 2 |
|
| 3 |
% skip if we've already run this -- based on fake "product" |
| 4 |
systemdict /product get (PhotoPRINT SE 5.0v2) readonly eq |
| 5 |
{ |
| 6 |
(%END GS_CET) .skipeof |
| 7 |
} if |
| 8 |
|
| 9 |
% Note: this must be run at save level 0 and when systemdict is writeable |
| 10 |
currentglobal //true setglobal |
| 11 |
systemdict dup dup dup |
| 12 |
/version (3017.102) readonly .forceput % match CPSI 3017.102 |
| 13 |
/product (PhotoPRINT SE 5.0v2) readonly .forceput % match CPSI 3017.102 |
| 14 |
/revision 0 put % match CPSI 3017.103 Tek shows revision 5 |
| 15 |
/serialnumber dup {233640} readonly .makeoperator .forceput % match CPSI 3017.102 Tek shows serialnumber 1401788461 |
| 16 |
|
| 17 |
systemdict /.odef { % <name> <proc> odef - |
| 18 |
1 index exch //.makeoperator def |
| 19 |
} .bind .forceput % this will be undefined at the end |
| 20 |
|
| 21 |
300 .sethiresscreen % needed for language switch build since it |
| 22 |
% processes gs_init.ps BEFORE setting the resolution |
| 23 |
|
| 24 |
0 array 0 setdash % CET 09-08 wants local setdash |
| 25 |
|
| 26 |
|
| 27 |
/UNROLLFORMS //true def |
| 28 |
|
| 29 |
(%.defaultbgrucrproc) cvn { } bind def |
| 30 |
|
| 31 |
(%.defaultbgrucrproc) cvn load dup |
| 32 |
setblackgeneration |
| 33 |
setundercolorremoval |
| 34 |
0 array cvx readonly dup dup dup setcolortransfer |
| 35 |
|
| 36 |
% CPSI doesn't define "Localization" resource. |
| 37 |
/Localization /Category undefineresource |
| 38 |
|
| 39 |
% Quality Logic test 09-59.ps tries to set each listed /OutputDevice. |
| 40 |
% This can cause problems with some devices (eg mswinpr2 on Windows) |
| 41 |
% so for the CET files we define the OutputDevice resource as |
| 42 |
% being empty. We need to redefine /.definecategory as that definition |
| 43 |
% gets destroyed at the end of gs_res.ps |
| 44 |
/OutputDevice /Category undefineresource |
| 45 |
|
| 46 |
/.definecategory % <name> -mark- <key1> ... <valuen> .definecategory - |
| 47 |
{ counttomark 2 idiv 2 add % .Instances, Category |
| 48 |
/Generic /Category findresource dup maxlength 3 -1 roll add |
| 49 |
dict .copydict begin |
| 50 |
counttomark 2 idiv { def } repeat pop % pop the mark |
| 51 |
currentdict end /Category defineresource pop |
| 52 |
} bind def |
| 53 |
|
| 54 |
/OutputDevice mark /InstanceType /dicttype .definecategory |
| 55 |
|
| 56 |
% Redefine Font category to return -1 (unknown) VM usage |
| 57 |
% in all cases to avoid differences between hosts. |
| 58 |
/Font /Category findresource |
| 59 |
dup length dict copy |
| 60 |
dup |
| 61 |
dup /.loadfontresource get |
| 62 |
dup length array copy cvx |
| 63 |
dup 1 0 put |
| 64 |
dup 7 -1 put |
| 65 |
/.loadfontresource exch put |
| 66 |
/Font exch /Category defineresource pop |
| 67 |
|
| 68 |
% Some previously compile time options such as USE_ADOBE_CMYK_RGB |
| 69 |
% and GS_CHAR_FILL are now dynamic. Force CPSI compatibility. |
| 70 |
//true .setCPSImode |
| 71 |
|
| 72 |
% Some QL jobs (/23-12B.PS for example) do: |
| 73 |
% '(%stdin) (r) file' |
| 74 |
% expecting that they are being read from stdin. |
| 75 |
% if that is not the case, they block waiting for input |
| 76 |
% from stdin. |
| 77 |
% This hooks the 'file' operator', so if a job tries to |
| 78 |
% open %stdin, and we're *not* reading the job from stdin |
| 79 |
% it'll return currentfile instead. |
| 80 |
/ofile /file load def |
| 81 |
/file |
| 82 |
{ |
| 83 |
1 index (%stdin) eq 2 index (%stdin%) eq or |
| 84 |
{ |
| 85 |
ofile dup currentfile eq not |
| 86 |
{ |
| 87 |
pop currentfile |
| 88 |
}if |
| 89 |
} |
| 90 |
{ |
| 91 |
ofile |
| 92 |
} ifelse |
| 93 |
} .bind //.odef exec |
| 94 |
currentdict /ofile undef |
| 95 |
|
| 96 |
% One QL job (23-12B.PS) effectively does: |
| 97 |
% (%stdin) (r) file 0 setfileposition |
| 98 |
% expecting it to throw an ioerror (stdin not being a positionable |
| 99 |
% stream. |
| 100 |
% With the above 'file' hook, when running from a file |
| 101 |
% rather than stdin, setfileposition will succeed, and we hit |
| 102 |
% an infinite loop - '0 setfileposition' meaning we restart intepreting |
| 103 |
% from the beginning of the file. |
| 104 |
% Hook setfileposition to throw an error attempting to reposition |
| 105 |
% the current file. |
| 106 |
/osetfileposition /setfileposition load def |
| 107 |
/setfileposition |
| 108 |
{ |
| 109 |
1 index currentfile eq |
| 110 |
{ |
| 111 |
/setfileposition cvx /ioerror signalerror |
| 112 |
} |
| 113 |
{ |
| 114 |
osetfileposition |
| 115 |
} ifelse |
| 116 |
} .bind //.odef exec |
| 117 |
currentdict /osetfileposition undef |
| 118 |
|
| 119 |
setglobal |
| 120 |
|
| 121 |
% Remove all but the default page size (the 0 entry in the InputAttributes |
| 122 |
% dictionary). This is usually 'letter'. |
| 123 |
<< |
| 124 |
% As we're removing all but the default, make sure we're |
| 125 |
% using the default. |
| 126 |
/PageSize currentpagedevice /InputAttributes get 0 get /PageSize get |
| 127 |
|
| 128 |
currentpagedevice /InputAttributes get |
| 129 |
1 1 2 index length 1 sub { |
| 130 |
1 index exch undef |
| 131 |
} for |
| 132 |
/InputAttributes exch |
| 133 |
>> |
| 134 |
setpagedevice |
| 135 |
|
| 136 |
% Patch setsmoothness, currentsmoothness for a better view of shadings : |
| 137 |
userdict /.smoothness currentsmoothness put |
| 138 |
/setsmoothness { |
| 139 |
dup type dup /integertype eq exch /realtype eq or { |
| 140 |
userdict /.smoothness 3 2 roll cvr put |
| 141 |
} { |
| 142 |
/setsmoothness .systemvar /typecheck signalerror |
| 143 |
} ifelse |
| 144 |
} bind //.odef exec |
| 145 |
/currentsmoothness { userdict /.smoothness get } bind //.odef exec % for 09-55.PS, 09-57.PS . |
| 146 |
|
| 147 |
% slightly nasty hack to give consistent cluster results |
| 148 |
/ofnfa systemdict /filenameforall get def |
| 149 |
|
| 150 |
/filenameforall |
| 151 |
{ |
| 152 |
2 index dup length 1 eq |
| 153 |
{ |
| 154 |
(*) eq |
| 155 |
{ |
| 156 |
3 -1 roll pop ( ) 3 1 roll |
| 157 |
} if |
| 158 |
} |
| 159 |
{ |
| 160 |
pop |
| 161 |
} ifelse |
| 162 |
ofnfa |
| 163 |
} bind def |
| 164 |
|
| 165 |
systemdict /.odef .undef |
| 166 |
|
| 167 |
% end of slightly nasty hack to give consistent cluster results |
| 168 |
%END GS_CET |