Debian Codegraph @

texk/xdvik/psheader.txt

raw
1 %% These are from tex.lpro
2 /TeXDict 250 dict def % define a working dictionary ( IBM: color - 200->250 )
3 TeXDict begin % start using it.
4 /N {def} def
5 /B {bind def} N
6 /S {exch} N
7 /X { S N } B
8 /TR {translate} N
9 /vsize 11 72 mul N
10 end % TeXDict
11
12 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13 %% header for the \special command
14 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
15 % The structure of the PostScript produced by dvips for \special is:
16 % @beginspecial
17 % - any number of @hsize, @hoffset, @hscale, etc., commands
18 % @setspecial
19 % - the user's file of PostScript commands
20 % @endspecial
21
22 TeXDict begin
23 /SDict 200 dict N
24 SDict begin
25
26 /@SpecialDefaults
27 { /hs 612 N
28 /vs 792 N
29 /ho 0 N
30 /vo 0 N
31 /hsc 1 N
32 /vsc 1 N
33 /ang 0 N
34 /CLIP 0 N
35 /rwiSeen false N
36 /rhiSeen false N
37 /letter {} N /note {} N /a4 {} N /legal {} N
38 } B
39
40 %
41 % The following definition sets up the units that hscale/vscale are in.
42 % For certain sites this might require change, but it is
43 % recommended instead that any macro packages that require
44 % hscale/vscale set the units appropriately via
45 %
46 % \special{! /@scaleunit 1 def }
47 %
48 % if global, or
49 %
50 % \special{" /@scaleunit 1 def }
51 %
52 % before each instance if multiple macro packages with
53 % different requirements are being used.
54 %
55 /@scaleunit 100 N
56 % s @hscale - set scale factor
57 /@hscale {@scaleunit div /hsc X} B
58 /@vscale {@scaleunit div /vsc X} B
59
60 % d @hsize - specify a horizontal clipping dimension
61 /@hsize {/hs X /CLIP 1 N} B
62 /@vsize {/vs X /CLIP 1 N} B
63
64 /@clip {/CLIP 2 N} B
65
66 % d @hoffset - specify a shift for the figure
67 /@hoffset {/ho X} B
68 /@voffset {/vo X} B
69
70 % a @angle - set rotation angle
71 /@angle {/ang X} B
72
73 %
74 % Here we handle bounding box calculations, if necessary.
75 %
76 /@rwi { 10 div /rwi X /rwiSeen true N } B % rwi will be real width after scaling
77 /@rhi { 10 div /rhi X /rhiSeen true N } B % rhi will be real height after scaling
78 /@llx { /llx X } B
79 /@lly { /lly X } B
80 /@urx { /urx X } B
81 /@ury { /ury X } B
82
83 /magscale true def
84
85 end % of SDict
86
87 /@MacSetUp
88 { userdict /md known % if md is defined
89 { userdict /md get type /dicttype eq % and if it is a dictionary
90 {
91 userdict begin % expand it if necessary
92 md length 10 add md maxlength ge
93 {/md md dup length 20 add dict copy def}if
94 end
95 md begin % then redefine some stuff
96 /letter {} N
97 /note {} N
98 /legal {} N
99 /od{txpose
100 1 0 mtx defaultmatrix dtransform S atan/pa X
101 newpath clippath mark
102 {transform{itransform moveto}}
103 {transform{itransform lineto}}
104 { 6 -2 roll transform
105 6 -2 roll transform
106 6 -2 roll transform
107 { itransform 6 2 roll
108 itransform 6 2 roll
109 itransform 6 2 roll
110 curveto
111 }
112 }
113 {{closepath}}
114 pathforall newpath counttomark array astore /gc xdf
115 pop ct 39 0 put
116 10 fz 0 fs 2 F/|______Courier fnt invertflag{PaintBlack}if
117 }N
118 /txpose{
119 pxs pys scale ppr aload pop
120 por {
121 noflips {
122 pop S neg S TR pop 1 -1 scale
123 }if
124 xflip yflip and {
125 pop S neg S TR 180 rotate 1 -1 scale
126 ppr 3 get ppr 1 get neg sub neg ppr 2 get
127 ppr 0 get neg sub neg TR
128 }if
129 xflip yflip not and {
130 pop S neg S TR pop 180 rotate
131 ppr 3 get ppr 1 get neg sub neg 0 TR
132 }if
133 yflip xflip not and {
134 ppr 1 get neg ppr 0 get neg TR
135 }if
136 }
137 {
138 noflips {
139 TR pop pop 270 rotate 1 -1 scale
140 }if
141 xflip yflip and {
142 TR pop pop 90 rotate 1 -1 scale
143 ppr 3 get ppr 1 get neg sub neg ppr 2 get
144 ppr 0 get neg sub neg TR
145 }if
146 xflip yflip not and {
147 TR pop pop 90 rotate ppr 3 get
148 ppr 1 get neg sub neg 0 TR
149 }if
150 yflip xflip not and {
151 TR pop pop 270 rotate ppr 2 get
152 ppr 0 get neg sub neg 0 S TR
153 }if
154 }ifelse
155 scaleby96 {
156 ppr aload pop 4 -1 roll add 2 div 3 1 roll add 2 div 2 copy
157 TR .96 dup scale neg S neg S TR
158 }if
159 }N
160 /cp {pop pop showpage pm restore}N
161 end
162 }if
163 } if
164 } N
165
166 %
167 % The following procedure brings us back to PostScript size. It takes
168 % into account the current global dvi magnification, so graphics
169 % scale with the document.
170 %
171 /normalscale {
172 Resolution 72 div VResolution 72 div neg scale
173 magscale { DVImag dup scale } if
174 0 setgray
175 } N
176 %
177 % this will be invoked as the result of a \special command (for the
178 % inclusion of PostScript graphics). The basic idea is to change all
179 % scaling and graphics back to defaults, but to shift the origin
180 % to the current position on the page.
181
182 /@beginspecial % - @beginspecial - -- enter special mode
183 {
184 /SpecialSave save N
185 SDict begin
186 gsave
187 normalscale
188 currentpoint TR %set the current point as the user's origin
189 @SpecialDefaults % setup default offsets, scales, sizes, and angle
190 count /ocount X /dcount countdictstack N
191 } N
192
193 /@setspecial % to setup user specified offsets, scales, sizes (for clipping)
194 {
195 CLIP 1 eq
196 { newpath 0 0 moveto hs 0 rlineto 0 vs rlineto hs neg 0 rlineto
197 closepath clip }
198 if
199 ho vo TR
200 hsc vsc scale
201 ang rotate
202 rwiSeen {
203 rwi urx llx sub div
204 rhiSeen { rhi ury lly sub div } { dup } ifelse
205 scale llx neg lly neg TR
206 } {
207 rhiSeen { rhi ury lly sub div dup scale llx neg lly neg TR } if
208 } ifelse
209 CLIP 2 eq
210 { newpath llx lly moveto urx lly lineto urx ury lineto llx ury lineto
211 closepath clip }
212 if
213 /showpage {} N
214 /erasepage {} N
215 /copypage {} N
216 /setpagedevice {pop} def
217 newpath
218 } N
219
220 /@endspecial % - @endspecial - -- leave special mode
221 { count ocount sub {pop} repeat
222 countdictstack dcount sub {end} repeat
223 grestore SpecialSave restore
224 end
225 } N
226
227 % xdvik special treatment for saving definitions made in SDict (while using
228 % the bang special; try to guarantee that the dictionary stack is ok!
229 % xdvik should not systematically bracket code within save/restore pairs,
230 % anyway: such bracketing breaks a lot of code (many packages do change
231 % TeXDict from with ps: specials for instance) and we should only guarantee
232 % that bracketing is done within @beginspecial and @endspecial. -- YA
233
234 /@xdvisavestate
235 {
236 userdict /xdvi$sav save put
237 } N
238
239 /@defspecial
240 {
241 SDict begin
242 } N
243 /@fedspecial
244 {
245 end
246 @xdvisavestate
247 } B
248 end % revert to previous dictionary