home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / bsd_srcs / usr.bin / groff / devices / devps / prologue < prev    next >
Encoding:
Text File  |  1991-04-30  |  3.0 KB  |  173 lines

  1. %!
  2. % If you add definitions here, be sure to check that MAX_PROLOGUE_DEFS
  3. % in ps.c is large enough.
  4.  
  5. % The ASCII code of the space character.
  6. /SC 32 def
  7.  
  8. /A /show load def
  9. /B { 0 SC 3 -1 roll widthshow } bind def
  10. /C { 0 exch ashow } bind def
  11. /D { 0 exch 0 SC 5 2 roll awidthshow } bind def
  12. /E { 0 rmoveto show } bind def
  13. /F { 0 rmoveto 0 SC 3 -1 roll widthshow } bind def
  14. /G { 0 rmoveto 0 exch ashow } bind def
  15. /H { 0 rmoveto 0 exch 0 SC 5 2 roll awidthshow } bind def
  16. /I { 0 exch rmoveto show } bind def
  17. /J { 0 exch rmoveto 0 SC 3 -1 roll widthshow } bind def
  18. /K { 0 exch rmoveto 0 exch ashow } bind def
  19. /L { 0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow } bind def
  20. /M { rmoveto show } bind def
  21. /N { rmoveto 0 SC 3 -1 roll widthshow } bind def
  22. /O { rmoveto 0 exch ashow } bind def
  23. /P { rmoveto 0 exch 0 SC 5 2 roll awidthshow } bind def
  24. /Q { moveto show } bind def 
  25. /R { moveto 0 SC 3 -1 roll widthshow } bind def
  26. /S { moveto 0 exch ashow } bind def
  27. /T { moveto 0 exch 0 SC 5 2 roll awidthshow } bind def
  28.  
  29. % name size font SF -
  30.  
  31. /SF {
  32.     findfont exch
  33.     [ exch dup 0 exch 0 exch neg 0 0 ] makefont
  34.     dup setfont
  35.     [ exch /setfont cvx ] cvx bind def
  36. } bind def
  37.  
  38. % name a c d font MF
  39.  
  40. /MF {
  41.     findfont
  42.     [ 5 2 roll
  43.     0 3 1 roll % b
  44.     neg 0 0 ] makefont
  45.     dup setfont
  46.     [ exch /setfont cvx ] cvx bind def
  47. } bind def
  48.  
  49.     
  50. % BP -
  51.  
  52. /BP {
  53.     /level0 save def
  54.     1 setlinecap
  55.     1 setlinejoin
  56.     72 RES div dup scale
  57.     LS {
  58.         90 rotate
  59.     } {
  60.         0 PL translate
  61.     } ifelse
  62.     1 -1 scale
  63. } bind def
  64.  
  65. /EP {
  66.     level0 restore
  67.     showpage
  68. } bind def
  69.  
  70.  
  71. % centerx centery radius startangle endangle DA -
  72.  
  73. /DA {
  74.     newpath arcn stroke
  75. } bind def
  76.  
  77. % x y SN - x' y'
  78. % round a position to nearest (pixel + (.25,.25))
  79.  
  80. /SN {
  81.     transform 
  82.     .25 sub exch .25 sub exch
  83.     round .25 add exch round .25 add exch
  84.     itransform
  85. } bind def
  86.     
  87. % endx endy startx starty DL -
  88. % we round the endpoints of the line, so that parallel horizontal
  89. % and vertical lines will appear even
  90.  
  91. /DL {
  92.     SN
  93.     moveto
  94.     SN
  95.     lineto stroke
  96. } bind def
  97.  
  98. % centerx centery radius DC -
  99.  
  100. /DC {
  101.     newpath 0 360 arc closepath
  102. } bind def
  103.  
  104.  
  105. /TM matrix def
  106.  
  107. %  width height centerx centery DE -
  108.  
  109. /DE {
  110.     TM currentmatrix pop
  111.     translate scale newpath 0 0 .5 0 360 arc closepath
  112.     TM setmatrix
  113. } bind def
  114.  
  115. % these are for splines
  116.  
  117. /RC /rcurveto load def
  118. /RL /rlineto load def
  119. /ST /stroke load def
  120. /MT /moveto load def
  121. /CL /closepath load def
  122.  
  123. % fill the last path
  124.  
  125. % amount FL -
  126.  
  127. /FL {
  128.     currentgray exch setgray fill setgray
  129. } bind def
  130.  
  131. % fill with the ``current color''
  132.  
  133. /BL /fill load def
  134.  
  135. /LW /setlinewidth load def
  136. % new_font_name encoding_vector old_font_name RE -
  137.  
  138. /RE {
  139.     findfont
  140.     dup maxlength dict begin
  141.     {
  142.         1 index /FID ne { def } { pop pop } ifelse
  143.     } forall
  144.     /Encoding exch def
  145.     dup /FontName exch def
  146.     currentdict end definefont pop
  147. } bind def
  148.  
  149. % hpos vpos EBEGIN -
  150.  
  151. /EBEGIN {
  152.     moveto
  153.     DEFS begin
  154. } bind def
  155.  
  156. /EEND /end load def
  157.  
  158. % llx lly newwid wid newht ht newllx newlly -
  159.  
  160. /PICTURE {
  161.     translate
  162.     div 3 1 roll div exch scale
  163.     neg exch neg exch translate
  164.     % set the graphics state to default values
  165.     0 setgray
  166.     0 setlinecap
  167.     1 setlinewidth
  168.     0 setlinejoin
  169.     10 setmiterlimit
  170.     [] 0 setdash
  171.     newpath
  172. } bind def
  173.