home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2 / Openstep-4.2-Intel-User.iso / usr / lib / NextStep / printPackage.ps < prev    next >
Text File  |  1993-03-17  |  8KB  |  189 lines

  1. %!
  2. % NeXT Printing Package
  3. % Version: 3.1
  4. % Copyright: 1988, NeXT, Inc.
  5.  
  6. /__NXdef{1 index where{pop pop pop}{def}ifelse}bind def
  7. /__NXbdef{1 index where{pop pop pop}{bind def}ifelse}bind def
  8. /UserObjects 10 array __NXdef
  9. /defineuserobject{
  10.     exch dup 1 add dup UserObjects length gt{
  11.         array dup 0 UserObjects putinterval
  12.         /UserObjects exch def
  13.     }{pop}ifelse UserObjects exch 3 -1 roll put
  14. }__NXbdef
  15. /undefineuserobject{UserObjects exch null put}__NXbdef
  16. /execuserobject{UserObjects exch get exec}__NXbdef
  17. /__NXRectPath{4 2 roll moveto 1 index 0 rlineto
  18. 0 exch rlineto neg 0 rlineto closepath}__NXbdef
  19. /__NXProcessRectArgs{
  20.     1 index type /arraytype eq{
  21.         exch 0 4 2 index length 1 sub{
  22.             dup 3 add 1 exch{1 index exch get exch}for
  23.             5 1 roll 5 index exec
  24.         }for pop pop
  25.     }{exec}ifelse
  26. }__NXbdef
  27. /rectfill{gsave newpath {__NXRectPath fill} __NXProcessRectArgs grestore}__NXbdef
  28. /rectclip{newpath {__NXRectPath} __NXProcessRectArgs clip newpath}__NXbdef
  29. /rectstroke{
  30.     gsave newpath dup type /arraytype eq{dup length 6 eq}{false}ifelse{
  31.         {gsave __NXRectPath null concat stroke grestore}
  32.         dup length array cvx copy dup 2 4 -1 roll put __NXProcessRectArgs
  33.     }{{__NXRectPath stroke} __NXProcessRectArgs}ifelse grestore
  34. }__NXbdef
  35. /_NXLevel2 systemdict /languagelevel known {languagelevel 2 ge}{false}ifelse __NXdef
  36. /xyshow{
  37.     0 1 3 index length 1 sub{
  38.         currentpoint 4 index 3 index 1 getinterval show
  39.         3 index 3 index 2 mul 1 add get add exch
  40.         3 index    3 index 2 mul get add exch moveto pop
  41.     }for pop pop
  42. }__NXbdef
  43. /xshow{
  44.     0 1 3 index length 1 sub{
  45.         currentpoint 4 index 3 index 1 getinterval show
  46.         exch 3 index 3 index get add exch moveto pop
  47.     }for pop pop
  48. }__NXbdef
  49. /yshow{
  50.     0 1 3 index length 1 sub{
  51.         currentpoint 4 index 3 index 1 getinterval show
  52.         3 index 3 index get add moveto pop
  53.     }for pop pop
  54. }__NXbdef
  55. /arct{arcto pop pop pop pop}__NXbdef
  56. /setbbox{pop pop pop pop}__NXbdef
  57. /ucache{}__NXbdef
  58. /ucachestatus{mark 0 0 0 0 0}__NXbdef
  59. /setucacheparams{cleartomark}__NXbdef
  60. /uappend{systemdict begin cvx exec end}__NXbdef
  61. /ueofill{gsave newpath uappend eofill grestore}__NXbdef
  62. /ufill{gsave newpath uappend fill grestore}__NXbdef
  63. /ustroke{
  64.     gsave newpath dup length 6 eq
  65.     {exch uappend concat}{uappend}ifelse
  66.     stroke grestore
  67. }__NXbdef
  68. /__NXustrokepathMatrix dup where {pop pop}{matrix def}ifelse
  69. /ustrokepath{
  70.     newpath dup length 6 eq{
  71.         exch uappend __NXustrokepathMatrix currentmatrix exch concat
  72.         strokepath setmatrix
  73.     }{uappend strokepath}ifelse
  74. } __NXbdef
  75. /upath{
  76.     [exch {/ucache cvx}if pathbbox /setbbox cvx
  77.      {/moveto cvx}{/lineto cvx}{/curveto cvx}{/closepath cvx}pathforall]cvx
  78. } __NXbdef
  79. /setstrokeadjust{pop}__NXbdef
  80. /currentstrokeadjust{false}__NXbdef
  81. /selectfont{exch findfont exch
  82. dup type /arraytype eq {makefont}{scalefont}ifelse setfont}__NXbdef
  83. /_NXCombineArrays{
  84.     counttomark dup 2 add index dup length 3 -1 roll {
  85.         2 index length sub dup 4 1 roll 1 index exch 4 -1 roll putinterval exch
  86.     }repeat pop pop pop
  87. }__NXbdef
  88. /flushgraphics{}def
  89. /setwindowtype{pop pop}def
  90. /currentwindowtype{pop 0}def
  91. /setalpha{pop}def
  92. /currentalpha{1.0}def
  93. /hidecursor{}def
  94. /obscurecursor{}def
  95. /revealcursor{}def
  96. /setcursor{4 {pop}repeat}bind def
  97. /showcursor{}def
  98. /NextStepEncoding where not{
  99. /NextStepEncoding StandardEncoding 256 array copy def
  100. 0 [129/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/Ccedilla/Egrave
  101. /Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex/Idieresis
  102. /Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis/Ugrave/Uacute
  103. /Ucircumflex/Udieresis/Yacute/Thorn/mu/multiply/divide/copyright
  104. 176/registered 181/brokenbar 190/logicalnot 192/onesuperior 201/twosuperior
  105. 204/threesuperior 209/plusminus/onequarter/onehalf/threequarters/agrave
  106. /aacute/acircumflex/atilde/adieresis/aring/ccedilla/egrave/eacute
  107. /ecircumflex/edieresis/igrave 226/iacute 228/icircumflex/idieresis/eth
  108. /ntilde 236/ograve/oacute/ocircumflex/otilde/odieresis 242/ugrave/uacute
  109. /ucircumflex 246/udieresis/yacute 252/thorn/ydieresis]
  110. {dup type /nametype eq
  111.  {NextStepEncoding 2 index 2 index put pop 1 add}{exch pop}ifelse
  112. }forall pop
  113. /NextStepEncoding NextStepEncoding readonly def
  114. /_NXfstr 128 string dup 0 (_NX) putinterval def
  115. /_NXfindfont /findfont load def
  116. /findfont{
  117.  % Because we can never let NextStepEncoding get into
  118.  % SharedFontDirectory, we cannot reencode a font to NextStepEncoding
  119.  % if we are in shared mode.  So if currentshared is true,
  120.  % we call the normal findfont and return that
  121.  /currentshared where {pop currentshared} {false} ifelse
  122.  {_NXfindfont}
  123.  {dup _NXfstr 3 125 getinterval cvs length 3 add _NXfstr 0 3 -1 roll
  124.   getinterval cvn exch FontDirectory 2 index known 
  125.   {pop FontDirectory exch get}
  126.   {_NXfindfont dup /Encoding get StandardEncoding eq
  127.    {    dup length dict exch
  128.     {1 index /FID ne {2 index 3 1 roll put}{pop pop}ifelse}forall
  129.      dup /Encoding NextStepEncoding put definefont
  130.     }{exch pop} ifelse
  131.    }ifelse
  132.  }ifelse
  133. }bind def
  134. }{pop}ifelse
  135. /_NXImageString {/__NXImageString where{pop}{/__NXImageString 4000 string __NXdef}ifelse __NXImageString}__NXbdef
  136. /_NXDoImageOp{
  137.     3 dict begin /parr 5 array def 1 index{dup}{1}ifelse /chans exch def
  138.     chans 2 add 2 roll parr 0 chans getinterval astore pop
  139.     5 index 4 index mul 2 index{1 sub 8 idiv 1 add mul}{mul 1 sub 8 idiv 1 add}ifelse
  140.     4 index mul /totbytes exch def pop exch pop
  141.     gsave matrix invertmatrix concat 0.5 setgray 0 0 4 2 roll rectfill grestore
  142.     {0 1 chans 1 sub{parr exch get exec length totbytes exch sub /totbytes exch def}for totbytes 0 le{exit}if}loop end
  143. }__NXbdef
  144. /alphaimage{1 add _NXDoImageOp}def
  145. _NXLevel2{ 
  146.     /NXCalibratedRGBColorSpace where{pop}{
  147.         /NXCalibratedRGBColorSpace
  148.         {mark /NXCalibratedRGB /ColorSpace findresource exch pop}stopped
  149.         {cleartomark /NXCalibratedRGB[/CIEBasedABC 2 dict dup begin 
  150.         /MatrixLMN[.4124 .2126 .0193 .3576 .7152 .1192 .1805 .0722 .9505]def
  151.         /WhitePoint[.9505 1 1.089] def end] /ColorSpace defineresource}if def}ifelse
  152.     /nxsetrgbcolor{NXCalibratedRGBColorSpace setcolorspace setcolor}__NXbdef
  153.     /nxsetgray{dup dup nxsetrgbcolor}__NXbdef
  154.     /_NXCalibratedImage{exch{array astore dup length true}{false}ifelse
  155.         8 -1 roll{NXCalibratedRGBColorSpace setcolorspace}if
  156.         8 dict dup 9 1 roll begin /ImageType 1 def /MultipleDataSources exch def
  157.         currentcolorspace 0 get /Indexed eq{pop /Decode[0 2 6 index exp 1 sub]def}
  158.         {2 mul dup array /Decode exch def 1 sub 0 1 3 -1 roll{Decode exch dup 2 mod put}for}ifelse
  159.         /DataSource exch def /ImageMatrix exch def 
  160.         /BitsPerComponent exch def /Height exch def /Width exch def end image}__NXbdef
  161. } {
  162.     /setcmykcolor{
  163.         1.0 exch sub dup dup 6 -1 roll sub dup 0 lt{pop 0}if 5 1 roll
  164.         4 -1 roll sub dup 0 lt{pop 0}if 3 1 roll exch sub dup 0 lt{pop 0}if setrgbcolor}__NXbdef
  165.     /currentcmykcolor{currentrgbcolor 3{1.0 exch sub 3 1 roll}repeat 0}__NXbdef
  166.     /colorimage{2 copy 3 ne or{_NXDoImageOp}{4 index dup 8 ne exch 4 ne and{_NXDoImageOp}{
  167.         pop pop save 6 1 roll 12 dict begin/Proc exch def/Res 0 string def
  168.         /Alloc{2 index length mul 2 add dup 2 index load length gt{1.2 mul round cvi string def}{pop pop}ifelse}def
  169.         1 index 8 eq{/Unpack{.34 Alloc}def}{
  170.             /Wid 4 index 3 mul def exch pop 8 exch/Str1 0 string def/Lim Wid def
  171.             /Unpack{.67 Alloc/Str1 2 Alloc 0 exch Lim exch
  172.                 {dup -4 bitshift 17 mul Str1 exch 4 index exch put 15 and 17 mul Str1 exch 3 index 1 add exch put
  173.                 2 sub dup 0 le{0 lt Wid exch{exch 1 sub exch}if}if exch 2 add exch
  174.                 }forall/Lim exch def Str1 exch 0 exch getinterval
  175.             }def
  176.         }ifelse
  177.         /Ops[{.3 mul add 1}{.59 mul add 2}{.11 mul add round cvi Res exch 2 index exch put 1 add 0.0 0}]def/Val 0.0 def/Phase 0 def
  178.         {0 Val Phase Proc/Res Unpack{exch Ops exch get exec}forall/Phase exch def/Val exch def Res exch 0 exch getinterval}
  179.         image end restore}ifelse}ifelse
  180.     }__NXbdef
  181.     /nxsetrgbcolor{setrgbcolor}__NXbdef /nxsetgray{setgray}__NXbdef
  182.     /setpattern{pop .5 setgray}__NXbdef
  183.     /_NXCalibratedImage{dup 1 eq {pop pop image}{colorimage}ifelse pop}__NXbdef
  184. } ifelse
  185. /_NXSetCMYKOrRGB where{pop}{
  186.     mark{systemdict /currentwindow get exec}stopped
  187.     {{pop pop pop setcmykcolor}}{{nxsetrgbcolor pop pop pop pop}}ifelse /_NXSetCMYKOrRGB exch def cleartomark
  188. }ifelse
  189.