groff before CVS: release 1.05
[s-roff.git] / ps / devps / prologue
blobff067bb0c0746b15c38d663fdec61477bdc42b49
1 %!PS-Adobe-3.0 Resource-ProcSet
3 /setpacking where {
4         pop
5         currentpacking
6         true setpacking
7 } if
9 /grops 120 dict dup begin 
11 % The ASCII code of the space character.
12 /SC 32 def
14 /A /show load def
15 /B { 0 SC 3 -1 roll widthshow } bind def
16 /C { 0 exch ashow } bind def
17 /D { 0 exch 0 SC 5 2 roll awidthshow } bind def
18 /E { 0 rmoveto show } bind def
19 /F { 0 rmoveto 0 SC 3 -1 roll widthshow } bind def
20 /G { 0 rmoveto 0 exch ashow } bind def
21 /H { 0 rmoveto 0 exch 0 SC 5 2 roll awidthshow } bind def
22 /I { 0 exch rmoveto show } bind def
23 /J { 0 exch rmoveto 0 SC 3 -1 roll widthshow } bind def
24 /K { 0 exch rmoveto 0 exch ashow } bind def
25 /L { 0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow } bind def
26 /M { rmoveto show } bind def
27 /N { rmoveto 0 SC 3 -1 roll widthshow } bind def
28 /O { rmoveto 0 exch ashow } bind def
29 /P { rmoveto 0 exch 0 SC 5 2 roll awidthshow } bind def
30 /Q { moveto show } bind def 
31 /R { moveto 0 SC 3 -1 roll widthshow } bind def
32 /S { moveto 0 exch ashow } bind def
33 /T { moveto 0 exch 0 SC 5 2 roll awidthshow } bind def
35 % name size font SF -
37 /SF {
38         findfont exch
39         [ exch dup 0 exch 0 exch neg 0 0 ] makefont
40         dup setfont
41         [ exch /setfont cvx ] cvx bind def
42 } bind def
44 % name a c d font MF -
46 /MF {
47         findfont
48         [ 5 2 roll
49         0 3 1 roll % b
50         neg 0 0 ] makefont
51         dup setfont
52         [ exch /setfont cvx ] cvx bind def
53 } bind def
55 /level0 0 def
56 /RES 0 def
57 /PL 0 def
58 /LS 0 def
60 % BP -
62 /BP {
63         /level0 save def
64         1 setlinecap
65         1 setlinejoin
66         72 RES div dup scale
67         LS {
68                 90 rotate
69         } {
70                 0 PL translate
71         } ifelse
72         1 -1 scale
73 } bind def
75 /EP {
76         level0 restore
77         showpage
78 } bind def
81 % centerx centery radius startangle endangle DA -
83 /DA {
84         newpath arcn stroke
85 } bind def
87 % x y SN - x' y'
88 % round a position to nearest (pixel + (.25,.25))
90 /SN {
91         transform 
92         .25 sub exch .25 sub exch
93         round .25 add exch round .25 add exch
94         itransform
95 } bind def
96         
97 % endx endy startx starty DL -
98 % we round the endpoints of the line, so that parallel horizontal
99 % and vertical lines will appear even
101 /DL {
102         SN
103         moveto
104         SN
105         lineto stroke
106 } bind def
108 % centerx centery radius DC -
110 /DC {
111         newpath 0 360 arc closepath
112 } bind def
115 /TM matrix def
117 %  width height centerx centery DE -
119 /DE {
120         TM currentmatrix pop
121         translate scale newpath 0 0 .5 0 360 arc closepath
122         TM setmatrix
123 } bind def
125 % these are for splines
127 /RC /rcurveto load def
128 /RL /rlineto load def
129 /ST /stroke load def
130 /MT /moveto load def
131 /CL /closepath load def
133 % fill the last path
135 % amount FL -
137 /FL {
138         currentgray exch setgray fill setgray
139 } bind def
141 % fill with the ``current color''
143 /BL /fill load def
145 /LW /setlinewidth load def
146 % new_font_name encoding_vector old_font_name RE -
148 /RE {
149         findfont
150         dup maxlength dict begin
151         {
152                 1 index /FID ne { def } { pop pop } ifelse
153         } forall
154         /Encoding exch def
155         dup /FontName exch def
156         currentdict end definefont pop
157 } bind def
159 /DEFS 0 def
161 % hpos vpos EBEGIN -
163 /EBEGIN {
164         moveto
165         DEFS begin
166 } bind def
168 /EEND /end load def
170 /CNT 0 def
171 /level1 0 def
173 % llx lly newwid wid newht ht newllx newlly PBEGIN -
175 /PBEGIN {
176         /level1 save def
177         translate
178         div 3 1 roll div exch scale
179         neg exch neg exch translate
180         % set the graphics state to default values
181         0 setgray
182         0 setlinecap
183         1 setlinewidth
184         0 setlinejoin
185         10 setmiterlimit
186         [] 0 setdash
187         /setstrokeadjust where {
188                 pop
189                 false setstrokeadjust
190         } if
191         /setoverprint where {
192                 pop
193                 false setoverprint
194         } if
195         newpath
196         /CNT countdictstack def
197         userdict begin
198         /showpage {} def
199 } bind def
201 /PEND {
202         clear
203         countdictstack CNT sub { end } repeat
204         level1 restore
205 } bind def
207 end def
209 /setpacking where {
210         pop
211         setpacking
212 } if