groff before CVS: release 1.06
[s-roff.git] / devps / prologue
blobf64554b995a7865eb9d7974f2b634d99f36b3b43
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 % Guess the page length.
61 % This assumes that the imageable area is vertically centered on the page.
62 % PLG - length
64 /PLG {
65         gsave newpath clippath pathbbox grestore
66         exch pop add exch pop
67 } bind def
69 % BP -
71 /BP {
72         /level0 save def
73         1 setlinecap
74         1 setlinejoin
75         72 RES div dup scale
76         LS {
77                 90 rotate
78         } {
79                 0 PL translate
80         } ifelse
81         1 -1 scale
82 } bind def
84 /EP {
85         level0 restore
86         showpage
87 } bind def
90 % centerx centery radius startangle endangle DA -
92 /DA {
93         newpath arcn stroke
94 } bind def
96 % x y SN - x' y'
97 % round a position to nearest (pixel + (.25,.25))
99 /SN {
100         transform 
101         .25 sub exch .25 sub exch
102         round .25 add exch round .25 add exch
103         itransform
104 } bind def
105         
106 % endx endy startx starty DL -
107 % we round the endpoints of the line, so that parallel horizontal
108 % and vertical lines will appear even
110 /DL {
111         SN
112         moveto
113         SN
114         lineto stroke
115 } bind def
117 % centerx centery radius DC -
119 /DC {
120         newpath 0 360 arc closepath
121 } bind def
124 /TM matrix def
126 %  width height centerx centery DE -
128 /DE {
129         TM currentmatrix pop
130         translate scale newpath 0 0 .5 0 360 arc closepath
131         TM setmatrix
132 } bind def
134 % these are for splines
136 /RC /rcurveto load def
137 /RL /rlineto load def
138 /ST /stroke load def
139 /MT /moveto load def
140 /CL /closepath load def
142 % fill the last path
144 % amount FL -
146 /FL {
147         currentgray exch setgray fill setgray
148 } bind def
150 % fill with the ``current color''
152 /BL /fill load def
154 /LW /setlinewidth load def
155 % new_font_name encoding_vector old_font_name RE -
157 /RE {
158         findfont
159         dup maxlength dict begin
160         {
161                 1 index /FID ne { def } { pop pop } ifelse
162         } forall
163         /Encoding exch def
164         dup /FontName exch def
165         currentdict end definefont pop
166 } bind def
168 /DEFS 0 def
170 % hpos vpos EBEGIN -
172 /EBEGIN {
173         moveto
174         DEFS begin
175 } bind def
177 /EEND /end load def
179 /CNT 0 def
180 /level1 0 def
182 % llx lly newwid wid newht ht newllx newlly PBEGIN -
184 /PBEGIN {
185         /level1 save def
186         translate
187         div 3 1 roll div exch scale
188         neg exch neg exch translate
189         % set the graphics state to default values
190         0 setgray
191         0 setlinecap
192         1 setlinewidth
193         0 setlinejoin
194         10 setmiterlimit
195         [] 0 setdash
196         /setstrokeadjust where {
197                 pop
198                 false setstrokeadjust
199         } if
200         /setoverprint where {
201                 pop
202                 false setoverprint
203         } if
204         newpath
205         /CNT countdictstack def
206         userdict begin
207         /showpage {} def
208 } bind def
210 /PEND {
211         clear
212         countdictstack CNT sub { end } repeat
213         level1 restore
214 } bind def
216 end def
218 /setpacking where {
219         pop
220         setpacking
221 } if