You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

168 lines
4.8 KiB

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