home *** CD-ROM | disk | FTP | other *** search
/ Global Amiga Experience / globalamigaexperience.iso / text_dtp / wordprocessors_dtp / pagestream2.2 / printers / postscript.prolog < prev    next >
Text File  |  1995-07-10  |  17KB  |  844 lines

  1. %%BeginProlog
  2. % $VER: 2.2.11 06/15/92
  3. %Copyright 1991-1992 Soft-Logik Publishing Corp.
  4.  
  5. /AsphaltDict dup 153 dict def load begin
  6.  
  7. %
  8. % some definitions & variables
  9. %
  10. /bdef {bind def} bind def
  11. /xdef {exch def} bdef
  12. /ldef {load def} bdef
  13. /SG /setgray ldef
  14. /dmatrix matrix def
  15. /cmatrix matrix def
  16. /omatrix matrix def
  17.  
  18. /deltax 0 def
  19. /deltay 0 def
  20. /slant 0 def
  21. /twist 0 def
  22. /xscl 0 def
  23. /yscl 0 def
  24. /eang 0 def
  25. /bang 0 def
  26. /NwScrn false def
  27.  
  28. %
  29. % drawing definitions
  30. %
  31.  
  32. /sclm [0 0 0 0 0 0] def
  33. /setscl {
  34.   /deltay exch neg def
  35.   /deltax exch neg def
  36.   100 div /twist xdef
  37.   100 div /slant xdef
  38.   cmatrix setmatrix deltax neg deltay neg translate
  39.   sclm 0 twist cos put
  40.   sclm 1 twist sin put
  41.   sclm 2 slant sin neg put
  42.   sclm 3 slant cos put
  43.   sclm concat
  44.   /omatrix omatrix currentmatrix def
  45. } bdef
  46.  
  47. /scl {
  48.  deltay add exch
  49.  deltax add exch
  50.  transform round .2 add exch round .2 add exch itransform
  51. } bdef
  52.  
  53. /NW {newpath} bdef
  54. /MT {scl moveto} bdef
  55. /LT {scl lineto} bdef
  56. /CRV {scl 6 2 roll scl 6 2 roll scl 6 2 roll curveto} bdef
  57.  
  58. /AT {
  59.   100 div /eang xdef 100 div /bang xdef
  60.   /yscl xdef /xscl xdef scl translate
  61.   xscl yscl scale 0 0 1 bang eang
  62.   arc omatrix setmatrix
  63. } bdef
  64.  
  65. /AN {
  66.   100 div /eang xdef 100 div /bang xdef
  67.   /yscl xdef /xscl xdef scl translate
  68.   xscl yscl scale 0 0 1 bang eang
  69.   arcn omatrix setmatrix
  70. } bdef
  71.  
  72. /CP {closepath} bdef
  73.  
  74. /LTYPE {0 setdash setlinewidth} bdef
  75.  
  76. %
  77. % - BeginDoc -
  78. %
  79. /BeginDoc {
  80.   7 dict begin
  81.     /FontDict 12 dict def
  82.     FontDict begin
  83.       /cache true def
  84.       /key /mypatternfont def
  85.       /patterns 256 array def
  86.       /patterncount 1 def
  87.       /char 1 def
  88.       /mtx [300 72 div 0 0 300 72 div 0 0] matrix invertmatrix def
  89.       /height 30 def
  90.       /width 30 def
  91.       /ctm matrix currentmatrix def
  92.       /ptm matrix identmatrix def
  93.       /str ( ) def
  94.     end
  95.     /FontBBox [0 0 FontDict /width get FontDict /height get] def
  96.     /FontMatrix FontDict /mtx get def
  97.     /Encoding 256 array 0 1 255 {1 index exch dup put} for def
  98.     /FontType 3 def
  99.     /BuildChar { %def
  100.       exch begin
  101.       FontDict begin
  102.       /char xdef
  103.       cache
  104.         {width 0 0 0 width height setcachedevice}
  105.         {width 0 setcharwidth}
  106.       ifelse
  107.       width height scale 16 16 true [16 0 0 -16 0 16] {patterns char get} imagemask
  108.       end end
  109.     } def
  110.     FontDict /key get currentdict definefont pop
  111.   end
  112.  
  113. }bdef
  114.  
  115. %
  116. % angle cx cy cropmark -
  117. %
  118. /cropmark {
  119.   gsave translate rotate
  120.   newpath
  121.   bh 6 add 0 moveto 20 0 rlineto
  122.   0 bv 6 add moveto 0 20 rlineto
  123.   stroke grestore
  124. } bdef
  125.  
  126. %
  127. % cx cy regmark -
  128. %
  129. /regmark {
  130.   gsave translate
  131.   newpath
  132.   10 0 moveto 0 0 10 0 360 arc
  133.   1 SG fill
  134.   8 0 moveto 0 0 8 0 360 arc
  135.   -10 0 moveto 10 0 lineto 0 -10 moveto 0 10 lineto
  136.   0 SG stroke
  137.   4 0 moveto 0 0 4 0 360 arc
  138.   fill
  139.   -4 0 moveto 4 0 lineto 0 -4 moveto 0 4 lineto
  140.   1 SG stroke
  141.   grestore
  142. } bdef
  143.  
  144. %
  145. % cx cy slurgauge -
  146. %
  147. /slurgauge {
  148.   gsave translate
  149.   newpath
  150.   0 0 10 0 360 arc
  151.   1 SG fill
  152.   0 0 10 0 360 arc
  153.   0 SG stroke
  154.   36 { 1 0 moveto 0 0 10 -2.5 2.5 arc fill 10 rotate} repeat
  155.   grestore
  156. } bdef
  157.  
  158. %
  159. % string cx cy label -
  160. %
  161. /label {
  162.   gsave translate 90 rotate
  163.   /Courier findfont 8 scalefont setfont
  164.   0 0 moveto show
  165.   0 -8 moveto
  166.   currentscreen pop exch 20 string cvs show ( lpi  ) show
  167.   20 string cvs show (\312   ) show
  168.   docscale 20 string cvs show (%) show
  169.   grestore
  170. } bdef
  171.  
  172. %
  173. % angle cx cy colorstrip -
  174. %
  175. /boxit {newpath moveto 14 0 rlineto 0 -14 rlineto -14 0 rlineto closepath} def
  176.  
  177. /colorstrip {
  178.   gsave translate rotate
  179.   /Courier findfont 6 scalefont setfont
  180.  
  181.   psepmode 0 eq {
  182.     0 8 translate
  183.     0 1 9 {dup 15 mul 0 boxit 10 div SG fill} for
  184.    }if
  185.  
  186.   psepmode 1 eq {
  187.     gsave 320 15 translate
  188.     0 0 boxit .5 .41 .41 0 setcmykcolor fill
  189.     15 0 boxit 0 0 0 .5 setcmykcolor fill
  190.     30 0 boxit 1 1 0 0 setcmykcolor fill
  191.     45 0 boxit 1 0 1 0 setcmykcolor fill
  192.     60 0 boxit 0 1 1 0 setcmykcolor fill
  193.     75 0 boxit 1 1 1 0 setcmykcolor fill
  194.     1 SG
  195.     33 -6 moveto (CM) show
  196.     48 -6 moveto (CY) show
  197.     63 -6 moveto (MY) show
  198.     77 -6 moveto (CMY) show
  199.     grestore
  200.  
  201.     
  202.     pblack 0 ne {0 15 translate (K)} if
  203.     pcyan 0 ne {0 0 translate (C)} if
  204.     pmagenta 0 ne {160 15 translate (M)} if
  205.     pyellow 0 ne {160 0 translate (Y)} if
  206.     -6 -6 moveto 0 SG show
  207.  
  208.     0 1 9 {dup 15 mul 0 boxit 10 div SG fill} for
  209.    }if
  210.  
  211.   psepmode 2 eq {
  212.     320 0 translate
  213.     0 1 9 {dup 15 mul 0 boxit 10 div SG fill} for
  214.    }if
  215.  
  216.   grestore
  217. } def
  218.  
  219. %
  220. % tilestring sepmode cyan magenta yellow black
  221. % negative mirror cropmarks manualfeed landscape scale
  222. % documentwidth documentheight paperw paperh tilex tiley tilew tileh
  223. % bh bv frequency angle copies iseps BEGINTILE
  224. %
  225. /begintile {
  226.   /iseps xdef
  227.   /#copies xdef
  228.   /cangle xdef
  229.   /cfreq xdef
  230.   /bv xdef
  231.   /bh xdef
  232.   /tileh xdef
  233.   /tilew xdef
  234.   /tiley xdef
  235.   /tilex xdef
  236.   /paperh xdef
  237.   /paperw xdef
  238.   /doch xdef
  239.   /docw xdef
  240.   /docscale xdef
  241.   /landscape xdef
  242.   /manual xdef
  243.   /cropmarks xdef
  244.   /mirror xdef
  245.   /negative xdef
  246.   /pblack xdef
  247.   /pyellow xdef
  248.   /pmagenta xdef
  249.   /pcyan xdef
  250.   /psepmode xdef
  251.   /tilename xdef
  252.  
  253.   /dmatrix dmatrix currentmatrix def
  254.  
  255.   bh 0 ge {/bleed true def}{/bleed false def /bh 0 def /bv 0 def}ifelse
  256.  
  257.   iseps {
  258.    /cropmarks false def
  259.    /bleed false def /bh 0 def bv 0 def
  260.    /mirror false def
  261.    /negative false def
  262.    /manual false def
  263.   }
  264.   {
  265.    statusdict /setpageparams known
  266.     {
  267.      mirror {statusdict /mirrorprint known {statusdict /mirrorprint true put /mirror false def}if }if
  268.      negative {statusdict /negativeprint known {statusdict /negativeprint true put /negative false def}if }if
  269.      statusdict begin tileh tilew cropmarks {72 add exch 72 add exch}if 0 0 setpageparams end
  270.     }
  271.     {
  272.      paperw 612 eq paperh 1008 eq and {/legal where{pop legal}if} if
  273.      paperw 612 eq paperh 792 eq and {/letter where{pop letter}if} if
  274.     } ifelse
  275.   } ifelse
  276.  
  277.   /leftclip paperw tilew cropmarks {72 add bh 2 mul add}if sub 2 div def
  278.   /topclip paperh tileh cropmarks {72 add bv 2 mul add}if sub 2 div def
  279.   leftclip topclip translate
  280.  
  281.   mirror {docw 0 translate -1 1 scale} if
  282.   negative {{1 exch sub} settransfer newpath clippath 1 SG fill} if
  283.   manual {statusdict /manualfeed known {statusdict /manualfeed true put}if }if
  284.   tilex neg tiley neg translate
  285.  
  286.   currentscreen /dproc xdef /dangle xdef /dfreq xdef
  287.   /dtrans currenttransfer def
  288.  
  289.   cangle 10000 gt {/cangle dangle def} if
  290.   cfreq 10000 gt {/cfreq dfreq def} if
  291.   cfreq cangle /dproc load setscreen
  292.  
  293.  
  294.  psepmode 0 eq {systemdict /setcmykcolor known not
  295.    {/setcmykcolor
  296.     {1 sub 4 1 roll 3 {3 index add neg dup 0 lt{pop 0}if 3 1 roll}
  297.      repeat setrgbcolor pop} bdef}if
  298.    /setgray /SG load def
  299.  } if
  300.  psepmode 1 eq {
  301.   pcyan 0 ne {/setcmykcolor {pop pop pop 1 exch sub SG}bdef /setgray {pop 1 SG}bdef } if
  302.   pmagenta 0 ne {/setcmykcolor {pop pop 1 exch sub SG pop}bdef /setgray {pop 1 SG}bdef } if
  303.   pyellow 0 ne {/setcmykcolor {pop 1 exch sub SG pop pop}bdef /setgray {pop 1 SG}bdef } if
  304.   pblack 0 ne {/setcmykcolor {1 exch sub SG pop pop pop}bdef /setgray /SG load def } if
  305.  } if
  306.  psepmode 2 eq {/setcmykcolor {
  307.   pblack 10000 div eq exch
  308.   pyellow 10000 div eq and exch
  309.   pmagenta 10000 div eq and exch
  310.   pcyan 10000 div eq and {0 SG}{1 SG}ifelse}bdef
  311.   pblack 10000 eq pyellow 0 eq and pmagenta 0 eq and pcyan 0 eq and
  312.    {/setgray /SG load def}{/setgray {pop 1 SG} bdef} ifelse
  313.  } if
  314.  
  315.  
  316.   cropmarks {
  317.     mirror {bh 36 add neg bv 36 add translate}{bh 36 add bv 36 add translate}ifelse
  318.     gsave
  319.     0 SG [] 0 setdash .3 setlinewidth 0 setlinejoin 0 setlinecap
  320.  
  321.     180 tilex tiley cropmark
  322.     270 tilex tilew add tiley cropmark
  323.     0 tilex tilew add tiley tileh add cropmark
  324.     90 tilex tiley tileh add cropmark
  325.  
  326.     tilew 2 div tilex add 18 tiley add tileh add bv add regmark
  327.     tilew 2 div tilex add -18 tiley add bv sub regmark
  328.  
  329.     tilex bh sub 18 sub tiley bv sub 18 sub slurgauge
  330.     tilex tilew add bh add 18 add tiley tileh add bv add 18 add slurgauge
  331.  
  332.     tilename tilex bh sub 18 sub tiley 18 add label
  333.  
  334.     90 tilex tilew add bh add 18 add tiley 18 add colorstrip
  335.  
  336.     grestore
  337.   } if
  338.  
  339.   bleed {
  340.     tilex bh sub tiley bv sub moveto
  341.     tilex tilew add bh add tiley bv sub lineto
  342.     tilex tilew add bh add tiley tileh add bv add lineto
  343.     tilex bh sub tiley tileh add bv add lineto
  344.     clip
  345.   } if
  346.  
  347.   landscape {-90 rotate doch neg 0 translate} if
  348.   docscale 10000.0 div dup scale
  349.  
  350.   /cmatrix cmatrix currentmatrix def
  351.   /NwScrn false def
  352.  
  353. } bdef
  354.  
  355. %
  356. %
  357. %
  358. /endtile {
  359.   manual {statusdict /manualfeed known {statusdict /manualfeed false put}if } if
  360.   dmatrix setmatrix
  361. } bdef
  362.  
  363.  
  364. %
  365. % - patternpath -
  366. %
  367. /patternpath { %def
  368.   /mypatternfont findfont begin FontDict /ctm get setmatrix
  369.   currentdict setfont
  370.  
  371.   FontDict begin
  372.     FontMatrix concat
  373.     width 0 dtransform
  374.     round width div exch round width div exch
  375.     0 height dtransform
  376.     round height div exch
  377.     round height div exch
  378.     0 0 transform round exch round exch
  379.     ptm astore setmatrix
  380.     pathbbox
  381.     height div ceiling height mul 4 1 roll
  382.     width div ceiling width mul 4 1 roll
  383.     height div floor height mul 4 1 roll
  384.     width div floor width mul 4 1 roll
  385.     2 index sub height div ceiling cvi exch
  386.     3 index sub width div ceiling cvi exch
  387.     4 2 roll moveto
  388.     FontMatrix ptm invertmatrix pop
  389.     { %repeat
  390.       gsave
  391.       ptm concat
  392.       dup {str show} repeat
  393.       grestore
  394.       0 height rmoveto
  395.     } repeat
  396.     pop
  397.   end end
  398. } bdef
  399.  
  400. %
  401. % - patternfill -
  402. %
  403. /patternfill { %def
  404.  
  405.   gsave
  406.   1 setgray
  407.   fill
  408.   grestore
  409.  
  410.   gsave
  411.   clip patternpath
  412.   grestore
  413.   newpath
  414. } bdef
  415.  
  416. %
  417. % - patternfill -
  418. %
  419. /patterneofill { %def
  420.  
  421.   gsave
  422.   1 setgray
  423.   fill
  424.   grestore
  425.  
  426.   gsave
  427.   eoclip patternpath
  428.   grestore
  429.   newpath
  430. } bdef
  431.  
  432. /patternstroke {
  433.     strokepath patternfill
  434. } bdef
  435.  
  436.  
  437. %
  438. % ax ay string patternashow -
  439. %
  440. /patternashow {
  441.   (0) exch 
  442.   { %forall
  443.     2 copy 0 exch put pop dup
  444.     false charpath 
  445.     currentpoint
  446.     patternfill
  447.     moveto
  448.     3 copy pop rmoveto
  449.   } forall
  450.   pop pop pop
  451. } bdef
  452.  
  453. %
  454. % string patternshow -
  455. %
  456. /patternshow {
  457.   (0) exch 
  458.   { %forall
  459.     2 copy 0 exch put pop dup
  460.     false charpath 
  461.     currentpoint
  462.     patternfill
  463.     moveto
  464.   } forall
  465.   pop
  466. } bind def
  467.  
  468.  
  469. %
  470. % <pattern> shade PTRN -
  471. %
  472. /PTRN {
  473.   /shade xdef
  474.   /pattern xdef
  475.   /mypatternfont findfont begin
  476.   FontDict begin
  477.   true
  478.   1 1 patterncount {
  479.     dup patterns exch get pattern eq
  480.       {str exch 0 exch put pop false exit}
  481.     if
  482.     pop
  483.   }for
  484.   {
  485.     patterns patterncount pattern put
  486.     str 0 patterncount put
  487.     /patterncount patterncount 1 add def
  488.   }if
  489.   end
  490.   end
  491.  
  492.   /MF {gsave patterneofill grestore} bdef
  493.   /MS {gsave patternstroke grestore} bdef
  494.   /SW {patternshow} bdef
  495.  
  496.   1 shade 10000 div sub SG
  497. } bdef
  498.  
  499.  
  500.  
  501. %
  502. % shade SHADE -
  503. %
  504. /SHADE {
  505.   /shade xdef
  506.   NwScrn {
  507.     cfreq cangle /dproc load setscreen
  508.     /NwScrn false def
  509.   }if
  510.  
  511.   /MF {gsave eofill grestore} bdef
  512.   /MS {gsave stroke grestore} bdef
  513.   /SW /show ldef
  514.  
  515.   1 shade 10000 div sub SG
  516. } bdef
  517.  
  518.  
  519. %
  520. % <pattern> c m y k CMYKPTRN -
  521. %
  522. /CMYKPTRN {
  523.   /k xdef
  524.   /y xdef
  525.   /m xdef
  526.   /c xdef
  527.   /pattern xdef
  528.  
  529.   /mypatternfont findfont begin
  530.   FontDict begin
  531.   true
  532.   1 1 patterncount {
  533.     dup patterns exch get pattern eq
  534.       {str exch 0 exch put pop false exit}
  535.     if
  536.     pop
  537.   }for
  538.   {
  539.     patterns patterncount pattern put
  540.     str 0 patterncount put
  541.     /patterncount patterncount 1 add def
  542.   }if
  543.   end
  544.   end
  545.  
  546.   /MF {gsave patterneofill grestore} bdef
  547.   /MS {gsave patternstroke grestore} bdef
  548.   /SW {patternshow} bdef
  549.  
  550.   c 10000 div m 10000 div y 10000 div k 10000 div setcmykcolor
  551. } bdef
  552.  
  553.  
  554.  
  555. %
  556. % c m y k CMYK -
  557. %
  558. /CMYK {
  559.   /k xdef
  560.   /y xdef
  561.   /m xdef
  562.   /c xdef
  563.  
  564.   /MF {gsave eofill grestore} bdef
  565.   /MS {gsave stroke grestore} bdef
  566.   /SW /show ldef
  567.  
  568.   c 10000 div m 10000 div y 10000 div k 10000 div setcmykcolor
  569. } bdef
  570.  
  571.  
  572. %
  573. % pixelw pixelh bitsperpixel picx picy pfreq pangle PUTPIC savestate
  574. %
  575. /putpic {
  576.   /pangle xdef
  577.   /pfreq xdef
  578.   /ysize xdef
  579.   /xsize xdef
  580.   /bpp xdef
  581.   /h xdef
  582.   /w xdef
  583.  
  584.   pfreq 10000 lt {pfreq}{cfreq} ifelse
  585.   pangle 10000 lt {pangle}{cangle} ifelse
  586.   /dproc load setscreen
  587.   xsize 2 div neg ysize 2 div neg translate
  588.   xsize ysize scale
  589.   /NwScrn true def
  590.  
  591.   save
  592.   /picstr 8 bpp idiv dup w add 1 sub exch idiv string def
  593.   w h bpp [w 0 0 h neg 0 h] {currentfile picstr readhexstring pop}bind image
  594. } bdef
  595.  
  596. %
  597. % pixelw pixelh bitsperpixel picx picy pfreq pangle PUTRGBPIC savestate
  598. %
  599. /putrgbpic {
  600.   /pangle xdef
  601.   /pfreq xdef
  602.   /ysize xdef
  603.   /xsize xdef
  604.   /bpp xdef
  605.   /h xdef
  606.   /w xdef
  607.  
  608.   pfreq 10000 lt {pfreq}{cfreq} ifelse
  609.   pangle 10000 lt {pangle}{cangle} ifelse
  610.   /dproc load setscreen
  611.   xsize 2 div neg ysize 2 div neg translate
  612.   xsize ysize scale
  613.   /NwScrn true def
  614.  
  615.   save
  616.   /picstr 8 bpp idiv dup w add 1 sub exch idiv string def
  617.   w h bpp [w 0 0 h neg 0 h]  {currentfile picstr readhexstring pop}bind false 3 colorimage
  618. } bdef
  619.  
  620. %
  621. % savestate ENDPIC -
  622. %
  623. /endpic {
  624.   restore
  625. } bdef
  626.  
  627. %
  628. % newx newy origx origy llx lly urx ury BGNEPS -
  629. %
  630. /bgneps {
  631.   /ury xdef
  632.   /urx xdef
  633.   /lly xdef
  634.   /llx xdef
  635.   /origy xdef
  636.   /origx xdef
  637.   /newy xdef
  638.   /newx xdef
  639.   100 newx origx div mul 100 newy origy div mul scale
  640.   urx llx add -2 div ury lly add -2 div translate
  641.   /PgsEpsSave save def /showpage {} bdef
  642.   llx lly moveto llx ury lineto urx ury lineto urx lly lineto clip
  643.   newpath [] 0 setdash 1 setlinewidth 0 SG
  644. } bdef
  645.  
  646. %
  647. % - ENDEPS -
  648. %
  649. /endeps {PgsEpsSave restore} bdef
  650.  
  651.  
  652. %
  653. %
  654. %
  655. /doendstyle {
  656.   scl /taily exch def /tailx exch def
  657.   scl /tipy exch def /tipx exch def
  658.   gsave newpath 1 eq
  659.   {
  660.     /halfhead currentlinewidth dup 125 gt {1.5}{2} ifelse mul def
  661.     /headlength halfhead 5 mul def
  662.     /dx tipx tailx sub def
  663.     /dy tipy taily sub def
  664.     /arrowlength dx dx mul dy dy mul add sqrt def
  665.     /angle dy dx atan def
  666.     /base arrowlength headlength sub def
  667.     tailx taily translate
  668.     angle rotate
  669.     base halfhead neg moveto
  670.     arrowlength 0 lineto
  671.     base halfhead lineto
  672.     closepath fill
  673.     base 0 transform
  674.   }
  675.   {
  676.     tipx tipy currentlinewidth 2 div 0 360 arc fill
  677.     tipx tipy transform
  678.   } ifelse
  679.   grestore itransform} bdef
  680.   /BS {doendstyle moveto} bdef
  681.   /ES {doendstyle lineto MS} bdef
  682.  
  683.  
  684. %
  685. % font xpoint ypoint attribute SETFP
  686. %
  687. /sfpm [0 0 0 0 0 0] def
  688. /setfp {
  689.   /curattr xdef /curypoint xdef /curxpoint xdef /curfont xdef
  690.  
  691.   sfpm 0 curxpoint put
  692.   sfpm 3 curypoint put
  693.   curfont findfont sfpm
  694.   dup 2 0 put
  695.   2 curattr and 0 ne {dup 2 curypoint 3 div put} if
  696.   16 curattr and 0 ne {dup 2 curypoint 3 div neg put} if
  697.   128 curattr and 0 ne {dup 0 curxpoint neg put} if
  698.   256 curattr and 0 ne {dup 3 curypoint neg put} if
  699.   makefont setfont
  700. } bdef
  701.  
  702. %
  703. % - FONTSAVE -
  704. %
  705. /fontsave {
  706.   /PgsFontSave save def
  707. } bdef
  708.  
  709. %
  710. % - FONTRESTORE -
  711. %
  712. /fontrestore {
  713.   currentgray slant 100 mul twist 100 mul deltax neg deltay neg
  714.   PgsFontSave restore
  715.   setscl setgray
  716. } bdef
  717.  
  718. %
  719. % - PAGESAVE -
  720. %
  721. /pagesave {
  722.   /PgsPageSave save def
  723. } bdef
  724.  
  725. %
  726. % - PAGERESTORE -
  727. %
  728. /pagerestore {
  729.   PgsPageSave restore
  730. } bdef
  731.  
  732. %
  733. % cwidth A -
  734. %
  735. /a {/cwidth xdef
  736.  
  737. % reverse
  738.  64 curattr and 0 ne
  739.   {gsave 0 curypoint .75 mul rmoveto cwidth 0 rlineto
  740.    0 curypoint neg rlineto cwidth neg 0 rlineto closepath fill grestore
  741.    gsave 1 SG } if
  742.  
  743. % underline
  744.  512 curattr and 0 ne
  745.   {curypoint 40 div setlinewidth [] 0 setdash
  746.    gsave 0 curypoint .05 mul neg rmoveto
  747.    cwidth 0 rlineto stroke grestore} if
  748.  
  749. % double underline
  750.  4096 curattr and 0 ne
  751.   {curypoint 40 div setlinewidth [] 0 setdash
  752.    gsave 0 curypoint .05 mul neg rmoveto
  753.    cwidth 0 rlineto stroke grestore
  754.    gsave 0 curypoint .15 mul neg rmoveto
  755.    cwidth 0 rlineto stroke grestore} if
  756.  
  757. % strike through
  758.  8192 curattr and 0 ne
  759.   {curypoint 40 div setlinewidth [] 0 setdash
  760.    gsave 0 curypoint .3 mul rmoveto
  761.    cwidth 0 rlineto stroke grestore} if
  762. %
  763.  64 curattr and 0 ne
  764.    {grestore} if
  765.  
  766.  } bdef
  767.  
  768. %
  769. % cwidth newx newy B -
  770. %
  771. /b {newpath scl moveto a} bdef
  772.  
  773. %
  774. % cchar cwidth R -
  775. %
  776. /r {/cwidth xdef /cchar xdef
  777.  
  778. gsave
  779.  
  780. curattr 0 eq {cchar SW}
  781. {
  782. % reverse
  783.  64 curattr and 0 ne
  784.    {1 SG} if
  785.  
  786. % shadow
  787.  4 curattr and 0 ne
  788.   {curypoint 160 div setlinewidth [] 0 setdash
  789.    32 curattr and 0 ne
  790.   {64 curattr and 0 ne
  791.    {gsave .5 SG curxpoint 12 div curypoint 12 div neg rmoveto cchar SW grestore
  792.     gsave cchar SW grestore}
  793.    {gsave currentgray 1 add .5 mul SG curxpoint 12 div curypoint 12 div neg rmoveto cchar SW grestore
  794.     gsave cchar SW grestore} ifelse
  795.    }
  796.  
  797.   {64 curattr and 0 ne
  798.    {gsave curxpoint 12 div curypoint 12 div neg rmoveto cchar SW grestore
  799.     gsave 0 SG cchar SW grestore
  800.     gsave cchar true charpath stroke grestore}
  801.    {gsave curxpoint 12 div curypoint 12 div neg rmoveto cchar SW grestore
  802.     gsave 1 SG cchar SW grestore
  803.     gsave cchar true charpath stroke grestore} ifelse
  804.    } ifelse
  805.   } if
  806.  
  807. % outline
  808.  8 curattr and 0 ne
  809.   {curypoint 160 div setlinewidth [] 0 setdash
  810.    64 curattr and 0 eq {gsave 1 SG cchar SW grestore} if
  811.    gsave cchar true charpath stroke grestore} if
  812.  
  813. % light
  814.  32 curattr and 0 ne
  815.   {64 curattr and 0 ne {.5} {currentgray 1 add .5 mul} ifelse SG} if
  816.  
  817. % mirror
  818.  128 curattr and 0 ne
  819.   {cchar stringwidth pop neg 0 rmoveto} if
  820.  
  821. % upside down
  822.  256 curattr and 0 ne
  823.   {0 curypoint .6 mul rmoveto} if
  824.  
  825. %
  826.  curattr 12 and 0 eq
  827.   { curattr 1 and 0 ne
  828.     {curxpoint 48 div dup neg -10 exch
  829.       {gsave 0 rmoveto cchar SW grestore} for}
  830.     {cchar SW}ifelse
  831.   }if
  832. } ifelse
  833.  
  834.  grestore cwidth 0 rmoveto} bdef
  835.  
  836. %
  837. % cchar cwidth newx newy P -
  838. %
  839. /p {newpath scl moveto r} bdef
  840.  
  841.  
  842. end
  843. %%EndProlog
  844.