Mercurial > emacs
annotate etc/ps-prin1.ps @ 34581:709f07c104ed
*** empty log message ***
author | Miles Bader <miles@gnu.org> |
---|---|
date | Fri, 15 Dec 2000 01:12:29 +0000 |
parents | 24d09129cd5c |
children | 3256440cb4bf |
rev | line source |
---|---|
27165 | 1 % === BEGIN ps-print prologue 1 |
31252
cdd489417ae4
Changed comment version (6.0).
Gerd Moellmann <gerd@gnu.org>
parents:
29495
diff
changeset
|
2 % version: 6.0 |
27165 | 3 |
4 % ISOLatin1Encoding stolen from ps_init.ps in GhostScript 2.6.1.4: | |
29495
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
5 /ISOLatin1Encoding where{pop}{ |
27165 | 6 % -- The ISO Latin-1 encoding vector isn't known, so define it. |
7 % -- The first half is the same as the standard encoding, | |
8 % -- except for minus instead of hyphen at code 055. | |
9 /ISOLatin1Encoding | |
10 StandardEncoding 0 45 getinterval aload pop | |
11 /minus | |
12 StandardEncoding 46 82 getinterval aload pop | |
13 %*** NOTE: the following are missing in the Adobe documentation, | |
14 %*** but appear in the displayed table: | |
15 %*** macron at 0225, dieresis at 0230, cedilla at 0233, space at 0240. | |
16 % 0200 (128) | |
29495
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
17 /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
18 /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
19 /dotlessi/grave/acute/circumflex/tilde/macron/breve/dotaccent |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
20 /dieresis/.notdef/ring/cedilla/.notdef/hungarumlaut/ogonek/caron |
27165 | 21 % 0240 (160) |
29495
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
22 /space/exclamdown/cent/sterling |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
23 /currency/yen/brokenbar/section |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
24 /dieresis/copyright/ordfeminine/guillemotleft |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
25 /logicalnot/hyphen/registered/macron |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
26 /degree/plusminus/twosuperior/threesuperior |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
27 /acute/mu/paragraph/periodcentered |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
28 /cedilla/onesuperior/ordmasculine/guillemotright |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
29 /onequarter/onehalf/threequarters/questiondown |
27165 | 30 % 0300 (192) |
29495
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
31 /Agrave/Aacute/Acircumflex/Atilde |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
32 /Adieresis/Aring/AE/Ccedilla |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
33 /Egrave/Eacute/Ecircumflex/Edieresis |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
34 /Igrave/Iacute/Icircumflex/Idieresis |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
35 /Eth/Ntilde/Ograve/Oacute |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
36 /Ocircumflex/Otilde/Odieresis/multiply |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
37 /Oslash/Ugrave/Uacute/Ucircumflex |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
38 /Udieresis/Yacute/Thorn/germandbls |
27165 | 39 % 0340 (224) |
29495
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
40 /agrave/aacute/acircumflex/atilde |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
41 /adieresis/aring/ae/ccedilla |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
42 /egrave/eacute/ecircumflex/edieresis |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
43 /igrave/iacute/icircumflex/idieresis |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
44 /eth/ntilde/ograve/oacute |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
45 /ocircumflex/otilde/odieresis/divide |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
46 /oslash/ugrave/uacute/ucircumflex |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
47 /udieresis/yacute/thorn/ydieresis |
27165 | 48 256 packedarray def |
49 }ifelse | |
50 | |
51 /reencodeFontISO{ %def | |
52 dup | |
53 length 12 add dict % Make a new font (a new dict the same size | |
54 % as the old one) with room for our new symbols. | |
55 | |
56 begin % Make the new font the current dictionary. | |
57 | |
29495
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
58 % Copy each of the symbols from the old dictionary |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
59 % to the new one except for the font ID. |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
60 {1 index/FID ne{def}{pop pop}ifelse}forall |
27165 | 61 |
29495
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
62 % Override the encoding with the ISOLatin1 encoding. |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
63 currentdict/FontType get 0 ne{/Encoding ISOLatin1Encoding def}if |
27165 | 64 |
65 % Use the font's bounding box to determine the ascent, descent, | |
66 % and overall height; don't forget that these values have to be | |
67 % transformed using the font's matrix. | |
68 | |
69 % ^ (x2 y2) | |
70 % | | | |
71 % | v | |
72 % | +----+ - - | |
73 % | | | ^ | |
74 % | | | | Ascent (usually > 0) | |
75 % | | | | | |
76 % (0 0) -> +--+----+--------> | |
77 % | | | | |
78 % | | v Descent (usually < 0) | |
79 % (x1 y1) --> +----+ - - | |
80 | |
29495
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
81 currentdict/FontType get 0 ne |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
82 {/FontBBox load aload pop % -- x1 y1 x2 y2 |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
83 FontMatrix transform/Ascent exch def pop |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
84 FontMatrix transform/Descent exch def pop} |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
85 {/PrimaryFont FDepVector 0 get def |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
86 PrimaryFont/FontBBox get aload pop |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
87 PrimaryFont/FontMatrix get transform/Ascent exch def pop |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
88 PrimaryFont/FontMatrix get transform/Descent exch def pop}ifelse |
27165 | 89 |
90 /FontHeight Ascent Descent sub def % use `sub' because descent < 0 | |
91 | |
92 % Define these in case they're not in the FontInfo | |
93 % (also, here they're easier to get to). | |
94 /UnderlinePosition Descent 0.70 mul def | |
95 /OverlinePosition Descent UnderlinePosition sub Ascent add def | |
96 /StrikeoutPosition Ascent 0.30 mul def | |
97 /LineThickness FontHeight 0.05 mul def | |
98 /Xshadow FontHeight 0.08 mul def | |
99 /Yshadow FontHeight -0.09 mul def | |
100 /SpaceBackground Descent neg UnderlinePosition add def | |
101 /XBox Descent neg def | |
102 /YBox LineThickness 0.7 mul def | |
103 | |
104 currentdict % Leave the new font on the stack | |
105 end % Stop using the font as the current dictionary. | |
106 definefont % Put the font into the font dictionary | |
107 pop % Discard the returned font. | |
108 }bind def | |
109 | |
29495
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
110 % Font definition |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
111 /DefFont{findfont exch scalefont reencodeFontISO}def |
27165 | 112 |
29495
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
113 % Font selection |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
114 /F{ |
27165 | 115 findfont |
29495
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
116 dup/Ascent get/Ascent exch def |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
117 dup/Descent get/Descent exch def |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
118 dup/FontHeight get/FontHeight exch def |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
119 dup/UnderlinePosition get/UnderlinePosition exch def |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
120 dup/OverlinePosition get/OverlinePosition exch def |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
121 dup/StrikeoutPosition get/StrikeoutPosition exch def |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
122 dup/LineThickness get/LineThickness exch def |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
123 dup/Xshadow get/Xshadow exch def |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
124 dup/Yshadow get/Yshadow exch def |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
125 dup/SpaceBackground get/SpaceBackground exch def |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
126 dup/XBox get/XBox exch def |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
127 dup/YBox get/YBox exch def |
27165 | 128 setfont |
129 }def | |
130 | |
29495
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
131 /FG/setrgbcolor load def |
27165 | 132 |
133 /bg false def | |
134 /BG{ | |
29495
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
135 dup/bg exch def |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
136 {[4 1 roll]} |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
137 {[1.0 1.0 1.0]} |
27165 | 138 ifelse |
139 /bgcolor exch def | |
140 }def | |
141 | |
142 % B width C | |
143 % +-----------+ | |
144 % | Ascent (usually > 0) | |
145 % A + + | |
146 % | Descent (usually < 0) | |
147 % +-----------+ | |
148 % E width D | |
149 | |
150 /dobackground{ % width -- | |
151 currentpoint % -- width x y | |
152 gsave | |
153 newpath | |
154 moveto % A (x y) | |
155 0 Ascent rmoveto % B | |
156 dup 0 rlineto % C | |
157 0 Descent Ascent sub rlineto % D | |
158 neg 0 rlineto % E | |
159 closepath | |
28428
b2d43a699564
Replace gs_languagelevel by languagelevel.
Gerd Moellmann <gerd@gnu.org>
parents:
28284
diff
changeset
|
160 FillBgColor |
27165 | 161 grestore |
162 }def | |
163 | |
164 /eolbg{ % dobackground until right margin | |
165 PrintWidth % -- x-eol | |
166 currentpoint pop % -- cur-x | |
167 sub % -- width until eol | |
168 dobackground | |
169 }def | |
170 | |
28762
8e8534ef4b0a
PostScript level 1 compatibility, Upside-down
Gerd Moellmann <gerd@gnu.org>
parents:
28428
diff
changeset
|
171 /PSL{bg{eolbg}if 0 currentpoint exch pop LineHeight sub moveto}def |
27165 | 172 /PLN{PrintLineNumber{doLineNumber}if}def |
173 | |
28762
8e8534ef4b0a
PostScript level 1 compatibility, Upside-down
Gerd Moellmann <gerd@gnu.org>
parents:
28428
diff
changeset
|
174 /SL{PSL isLineStep pop}def % Soft Linefeed |
27165 | 175 |
28762
8e8534ef4b0a
PostScript level 1 compatibility, Upside-down
Gerd Moellmann <gerd@gnu.org>
parents:
28428
diff
changeset
|
176 /HL{PSL PLN}def % Hard Linefeed |
27165 | 177 |
178 % Some debug | |
29495
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
179 /dcp{currentpoint exch 40 string cvs print(, )print =}def |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
180 /dp{print 2 copy exch 40 string cvs print(, )print =}def |
27165 | 181 |
182 /W{ | |
29495
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
183 ( )stringwidth % Get the width of a space in the current font. |
27165 | 184 pop % Discard the Y component. |
185 mul % Multiply the width of a space | |
186 % by the number of spaces to plot | |
187 bg{dup dobackground}if | |
188 0 rmoveto | |
189 }def | |
190 | |
191 /Effect 0 def | |
192 /EF{/Effect exch def}def | |
193 | |
194 % stack: string |- -- | |
195 % effect: 1 - underline 2 - strikeout 4 - overline | |
196 % 8 - shadow 16 - box 32 - outline | |
197 /S{ | |
29495
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
198 /xx currentpoint dup Descent add/yy exch def |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
199 Ascent add/YY exch def def |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
200 dup stringwidth pop xx add/XX exch def |
27165 | 201 Effect 8 and 0 ne{ |
202 /yy yy Yshadow add def | |
203 /XX XX Xshadow add def | |
204 }if | |
205 bg{ | |
206 true | |
207 Effect 16 and 0 ne | |
208 {SpaceBackground doBox} | |
209 {xx yy XX YY doRect} | |
210 ifelse | |
211 }if % background | |
212 Effect 16 and 0 ne{false 0 doBox}if % box | |
213 Effect 8 and 0 ne{dup doShadow}if % shadow | |
214 Effect 32 and 0 ne | |
215 {true doOutline} % outline | |
216 {show} % normal text | |
217 ifelse | |
218 Effect 1 and 0 ne{UnderlinePosition Hline}if % underline | |
219 Effect 2 and 0 ne{StrikeoutPosition Hline}if % strikeout | |
220 Effect 4 and 0 ne{OverlinePosition Hline}if % overline | |
221 }bind def | |
222 | |
223 % stack: position |- -- | |
224 /Hline{ | |
225 currentpoint exch pop add dup | |
226 gsave | |
227 newpath | |
228 xx exch moveto | |
229 XX exch lineto | |
230 closepath | |
231 LineThickness setlinewidth stroke | |
232 grestore | |
233 }bind def | |
234 | |
235 % stack: fill-or-not delta |- -- | |
236 /doBox{ | |
237 /dd exch def | |
238 xx XBox sub dd sub yy YBox sub dd sub | |
239 XX XBox add dd add YY YBox add dd add | |
240 doRect | |
241 }bind def | |
242 | |
243 % stack: fill-or-not lower-x lower-y upper-x upper-y |- -- | |
244 /doRect{ | |
245 /rYY exch def | |
246 /rXX exch def | |
247 /ryy exch def | |
248 /rxx exch def | |
249 gsave | |
250 newpath | |
251 rXX rYY moveto | |
252 rxx rYY lineto | |
253 rxx ryy lineto | |
254 rXX ryy lineto | |
255 closepath | |
256 % top of stack: fill-or-not | |
29495
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
257 {FillBgColor} |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
258 {LineThickness setlinewidth stroke}ifelse |
27165 | 259 grestore |
260 }bind def | |
261 | |
262 % stack: string |- -- | |
263 /doShadow{ | |
264 gsave | |
265 Xshadow Yshadow rmoveto | |
266 false doOutline | |
267 grestore | |
268 }bind def | |
269 | |
270 /st 1 string def | |
271 | |
272 % stack: string fill-or-not |- -- | |
273 /doOutline{ | |
274 /-fillp- exch def | |
29495
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
275 /-ox- currentpoint/-oy- exch def def |
27165 | 276 gsave |
277 LineThickness setlinewidth | |
278 {st 0 3 -1 roll put | |
279 st dup true charpath | |
280 -fillp- {gsave FillBgColor grestore}if | |
281 stroke stringwidth | |
29495
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
282 -oy- add/-oy- exch def |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
283 -ox- add/-ox- exch def |
27165 | 284 -ox- -oy- moveto |
285 }forall | |
286 grestore | |
287 -ox- -oy- moveto | |
288 }bind def | |
289 | |
290 % stack: -- | |
291 /FillBgColor{bgcolor aload pop setrgbcolor fill}bind def | |
292 | |
28762
8e8534ef4b0a
PostScript level 1 compatibility, Upside-down
Gerd Moellmann <gerd@gnu.org>
parents:
28428
diff
changeset
|
293 % stack: -- |- boolean |
8e8534ef4b0a
PostScript level 1 compatibility, Upside-down
Gerd Moellmann <gerd@gnu.org>
parents:
28428
diff
changeset
|
294 /isLineStep{ |
8e8534ef4b0a
PostScript level 1 compatibility, Upside-down
Gerd Moellmann <gerd@gnu.org>
parents:
28428
diff
changeset
|
295 SyncLineZebra |
28980
66e571cf74c6
PostScript code compatibility with other utilities
Gerd Moellmann <gerd@gnu.org>
parents:
28762
diff
changeset
|
296 {PLScounter 0 gt % or zebra |
66e571cf74c6
PostScript code compatibility with other utilities
Gerd Moellmann <gerd@gnu.org>
parents:
28762
diff
changeset
|
297 {/PLScounter PLScounter 1 sub def PLScounter 0 eq} |
66e571cf74c6
PostScript code compatibility with other utilities
Gerd Moellmann <gerd@gnu.org>
parents:
28762
diff
changeset
|
298 {false}ifelse |
66e571cf74c6
PostScript code compatibility with other utilities
Gerd Moellmann <gerd@gnu.org>
parents:
28762
diff
changeset
|
299 PrintLineStep 1 gt |
66e571cf74c6
PostScript code compatibility with other utilities
Gerd Moellmann <gerd@gnu.org>
parents:
28762
diff
changeset
|
300 {/PrintLineStep PrintLineStep 1 sub def} |
66e571cf74c6
PostScript code compatibility with other utilities
Gerd Moellmann <gerd@gnu.org>
parents:
28762
diff
changeset
|
301 {/PrintLineStep ZebraHeight def |
66e571cf74c6
PostScript code compatibility with other utilities
Gerd Moellmann <gerd@gnu.org>
parents:
28762
diff
changeset
|
302 /PLScounter PrintLineStart def}ifelse} |
66e571cf74c6
PostScript code compatibility with other utilities
Gerd Moellmann <gerd@gnu.org>
parents:
28762
diff
changeset
|
303 {LineNumber PrintLineStart sub PrintLineStep mod 0 eq}ifelse % or line step |
28762
8e8534ef4b0a
PostScript level 1 compatibility, Upside-down
Gerd Moellmann <gerd@gnu.org>
parents:
28428
diff
changeset
|
304 }def |
8e8534ef4b0a
PostScript level 1 compatibility, Upside-down
Gerd Moellmann <gerd@gnu.org>
parents:
28428
diff
changeset
|
305 |
27165 | 306 % stack: -- |
307 /doLineNumber{ | |
308 /LineNumber where | |
28762
8e8534ef4b0a
PostScript level 1 compatibility, Upside-down
Gerd Moellmann <gerd@gnu.org>
parents:
28428
diff
changeset
|
309 {pop |
8e8534ef4b0a
PostScript level 1 compatibility, Upside-down
Gerd Moellmann <gerd@gnu.org>
parents:
28428
diff
changeset
|
310 isLineStep % or line step |
8e8534ef4b0a
PostScript level 1 compatibility, Upside-down
Gerd Moellmann <gerd@gnu.org>
parents:
28428
diff
changeset
|
311 LineNumber Lines ge or % or last line |
8e8534ef4b0a
PostScript level 1 compatibility, Upside-down
Gerd Moellmann <gerd@gnu.org>
parents:
28428
diff
changeset
|
312 {currentfont |
27165 | 313 gsave |
314 0.0 0.0 0.0 setrgbcolor | |
315 /L0 findfont setfont | |
316 LineNumber Lines ge | |
28762
8e8534ef4b0a
PostScript level 1 compatibility, Upside-down
Gerd Moellmann <gerd@gnu.org>
parents:
28428
diff
changeset
|
317 {(end )} |
29495
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
318 {LineNumber 6 string cvs( )strcat}ifelse |
27165 | 319 dup stringwidth pop neg 0 rmoveto |
320 show | |
321 grestore | |
28762
8e8534ef4b0a
PostScript level 1 compatibility, Upside-down
Gerd Moellmann <gerd@gnu.org>
parents:
28428
diff
changeset
|
322 setfont}if |
27165 | 323 /LineNumber LineNumber 1 add def |
324 }if | |
325 }def | |
326 | |
28428
b2d43a699564
Replace gs_languagelevel by languagelevel.
Gerd Moellmann <gerd@gnu.org>
parents:
28284
diff
changeset
|
327 % stack: color-specifier |- -- |
29495
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
328 /SetColor{dup type/realtype eq{setgray}{aload pop setrgbcolor}ifelse}def |
28428
b2d43a699564
Replace gs_languagelevel by languagelevel.
Gerd Moellmann <gerd@gnu.org>
parents:
28284
diff
changeset
|
329 |
27165 | 330 % stack: -- |
331 /printZebra{ | |
332 gsave | |
28428
b2d43a699564
Replace gs_languagelevel by languagelevel.
Gerd Moellmann <gerd@gnu.org>
parents:
28284
diff
changeset
|
333 ZebraColor SetColor |
27165 | 334 /double-zebra ZebraHeight ZebraHeight add def |
335 /yiter double-zebra LineHeight mul neg def | |
336 /xiter PrintWidth InterColumn add def | |
29495
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
337 /zebra-line PageNumber 1 sub NumberOfColumns mul LinesPerColumn mul def |
27165 | 338 NumberOfColumns{LinesPerColumn doColumnZebra xiter 0 rmoveto}repeat |
339 grestore | |
340 }def | |
341 | |
342 % stack: lines-per-column |- -- | |
343 /doColumnZebra{ | |
29495
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
344 /lpc exch def |
27165 | 345 gsave |
29495
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
346 ZebraFollow{ |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
347 /H ZebraHeight zebra-line ZebraHeight mod sub def |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
348 /lpc lpc H sub def |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
349 zebra-line double-zebra mod ZebraHeight lt |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
350 {H doZebra % "black" stripe followed by a "white" stripe |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
351 /lpc lpc ZebraHeight sub def |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
352 H ZebraHeight add} |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
353 {H}ifelse % "white" stripe |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
354 LineHeight mul neg 0 exch rmoveto |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
355 /zebra-line zebra-line LinesPerColumn add def |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
356 }if |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
357 lpc dup double-zebra idiv{ZebraHeight doZebra 0 yiter rmoveto}repeat |
27165 | 358 double-zebra mod |
29495
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
359 dup 0 le{pop}{dup ZebraHeight gt{pop ZebraHeight}if doZebra}ifelse |
27165 | 360 grestore |
361 }def | |
362 | |
363 % stack: zebra-height (in lines) |- -- | |
364 /doZebra{ | |
365 /zh exch 0.05 sub LineHeight mul def | |
366 gsave | |
367 0 LineHeight 0.65 mul rmoveto | |
368 PrintWidth 0 rlineto | |
369 0 zh neg rlineto | |
370 PrintWidth neg 0 rlineto | |
371 0 zh rlineto | |
372 fill | |
373 grestore | |
374 }def | |
375 | |
28428
b2d43a699564
Replace gs_languagelevel by languagelevel.
Gerd Moellmann <gerd@gnu.org>
parents:
28284
diff
changeset
|
376 % stack: -- |
b2d43a699564
Replace gs_languagelevel by languagelevel.
Gerd Moellmann <gerd@gnu.org>
parents:
28284
diff
changeset
|
377 /printBackground{ |
b2d43a699564
Replace gs_languagelevel by languagelevel.
Gerd Moellmann <gerd@gnu.org>
parents:
28284
diff
changeset
|
378 /BackgroundColor where{ |
b2d43a699564
Replace gs_languagelevel by languagelevel.
Gerd Moellmann <gerd@gnu.org>
parents:
28284
diff
changeset
|
379 pop gsave BackgroundColor SetColor |
b2d43a699564
Replace gs_languagelevel by languagelevel.
Gerd Moellmann <gerd@gnu.org>
parents:
28284
diff
changeset
|
380 NumberOfColumns{ |
b2d43a699564
Replace gs_languagelevel by languagelevel.
Gerd Moellmann <gerd@gnu.org>
parents:
28284
diff
changeset
|
381 gsave |
b2d43a699564
Replace gs_languagelevel by languagelevel.
Gerd Moellmann <gerd@gnu.org>
parents:
28284
diff
changeset
|
382 0 LineHeight 0.65 mul rmoveto |
b2d43a699564
Replace gs_languagelevel by languagelevel.
Gerd Moellmann <gerd@gnu.org>
parents:
28284
diff
changeset
|
383 PrintWidth 0 rlineto |
b2d43a699564
Replace gs_languagelevel by languagelevel.
Gerd Moellmann <gerd@gnu.org>
parents:
28284
diff
changeset
|
384 0 PrintHeight neg rlineto |
b2d43a699564
Replace gs_languagelevel by languagelevel.
Gerd Moellmann <gerd@gnu.org>
parents:
28284
diff
changeset
|
385 PrintWidth neg 0 rlineto |
b2d43a699564
Replace gs_languagelevel by languagelevel.
Gerd Moellmann <gerd@gnu.org>
parents:
28284
diff
changeset
|
386 0 PrintHeight rlineto |
b2d43a699564
Replace gs_languagelevel by languagelevel.
Gerd Moellmann <gerd@gnu.org>
parents:
28284
diff
changeset
|
387 fill |
b2d43a699564
Replace gs_languagelevel by languagelevel.
Gerd Moellmann <gerd@gnu.org>
parents:
28284
diff
changeset
|
388 grestore |
b2d43a699564
Replace gs_languagelevel by languagelevel.
Gerd Moellmann <gerd@gnu.org>
parents:
28284
diff
changeset
|
389 PrintWidth InterColumn add 0 rmoveto |
b2d43a699564
Replace gs_languagelevel by languagelevel.
Gerd Moellmann <gerd@gnu.org>
parents:
28284
diff
changeset
|
390 }repeat |
b2d43a699564
Replace gs_languagelevel by languagelevel.
Gerd Moellmann <gerd@gnu.org>
parents:
28284
diff
changeset
|
391 grestore |
b2d43a699564
Replace gs_languagelevel by languagelevel.
Gerd Moellmann <gerd@gnu.org>
parents:
28284
diff
changeset
|
392 }if |
b2d43a699564
Replace gs_languagelevel by languagelevel.
Gerd Moellmann <gerd@gnu.org>
parents:
28284
diff
changeset
|
393 }def |
b2d43a699564
Replace gs_languagelevel by languagelevel.
Gerd Moellmann <gerd@gnu.org>
parents:
28284
diff
changeset
|
394 |
27165 | 395 % tx ty rotation xscale yscale xpos ypos BeginBackImage |
396 /BeginBackImage{ | |
397 /-save-image- save def | |
398 /showpage{}def | |
399 translate | |
400 scale | |
401 rotate | |
402 translate | |
403 }def | |
404 | |
405 /EndBackImage{-save-image- restore}def | |
406 | |
407 % string fontsize fontname rotation gray xpos ypos ShowBackText | |
408 /ShowBackText{ | |
409 gsave | |
410 translate | |
411 setgray | |
412 rotate | |
29495
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
413 findfont exch dup/-offset- exch -0.25 mul def scalefont setfont |
27165 | 414 0 -offset- moveto |
415 /-saveLineThickness- LineThickness def | |
416 /LineThickness 1 def | |
417 false doOutline | |
418 /LineThickness -saveLineThickness- def | |
419 grestore | |
420 }def | |
421 | |
29495
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
422 /SetPageSize{ |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
423 BMark/PageSize[PageWidth LandscapePageHeight LandscapeMode{exch}if]EMark setpagedevice |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
424 }def |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
425 |
27165 | 426 /BeginDoc{ |
427 % ---- Remember space width of the normal text font `f0'. | |
29495
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
428 /SpaceWidth/f0 findfont setfont( )stringwidth pop def |
27165 | 429 % ---- save the state of the document (useful for ghostscript!) |
430 /docState save def | |
431 % ---- [andrewi] set PageSize based on chosen dimensions | |
432 UseSetpagedevice{ | |
29495
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
433 WarnPaperSize{SetPageSize}{mark{SetPageSize}stopped cleartomark}ifelse |
27165 | 434 }if |
435 /ColumnWidth PrintWidth InterColumn add def | |
436 % ---- define where printing will start | |
437 /f0 F % this installs Ascent | |
438 /PrintStartY PrintHeight Ascent sub def | |
439 /ColumnIndex 1 def | |
440 /N-Up-Counter N-Up-End 1 sub def | |
28980
66e571cf74c6
PostScript code compatibility with other utilities
Gerd Moellmann <gerd@gnu.org>
parents:
28762
diff
changeset
|
441 /PLScounter PrintLineStart def |
27165 | 442 }def |
443 | |
444 /EndDoc{ | |
445 % ---- restore the state of the document (useful for ghostscript!) | |
446 docState restore | |
447 }def | |
448 | |
449 /BeginDSCPage{ | |
450 % ---- when 1st column, save the state of the page | |
29495
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
451 ColumnIndex 1 eq{/pageState save def}if |
27165 | 452 % ---- save the state of the column |
453 /columnState save def | |
454 }def | |
455 | |
456 /PrintHeaderWidth PrintOnlyOneHeader{PrintPageWidth}{PrintWidth}ifelse def | |
457 | |
458 /BeginPage{ | |
459 % ---- when 1st column, print all background effects | |
460 ColumnIndex 1 eq{ | |
461 0 PrintStartY moveto % move to where printing will start | |
28428
b2d43a699564
Replace gs_languagelevel by languagelevel.
Gerd Moellmann <gerd@gnu.org>
parents:
28284
diff
changeset
|
462 printBackground |
29495
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
463 Zebra{printZebra}if |
27165 | 464 printGlobalBackground |
465 printLocalBackground | |
466 }if | |
467 PrintHeader{ | |
468 PrintOnlyOneHeader{ColumnIndex 1 eq}{true}ifelse{ | |
469 PrintHeaderFrame{HeaderFrame}if | |
470 HeaderText | |
471 }if | |
472 }if | |
473 0 PrintStartY moveto % move to where printing will start | |
29495
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
474 /LineNumber where |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
475 {pop |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
476 SyncLineZebra |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
477 {/H PageNumber 1 sub NumberOfColumns mul ColumnIndex 1 sub add |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
478 LinesPerColumn mul ZebraHeight mod def |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
479 /PLScounter H PrintLineStart ge{0}{PrintLineStart H sub}ifelse def |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
480 /PrintLineStep ZebraHeight H sub def}if}if |
27165 | 481 PLN |
482 }def | |
483 | |
484 /EndPage{bg{eolbg}if}def | |
485 | |
486 /EndDSCPage{ | |
487 ColumnIndex NumberOfColumns eq{ | |
488 % ---- restore the state of the page | |
489 pageState restore | |
490 /ColumnIndex 1 def | |
491 % ---- N-up printing | |
492 N-Up 1 gt{ | |
29495
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
493 N-Up-Counter 0 gt |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
494 {% ---- Next page on same row |
27165 | 495 /N-Up-Counter N-Up-Counter 1 sub def |
29495
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
496 N-Up-XColumn N-Up-YColumn} |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
497 {% ---- Next page on next line |
27165 | 498 /N-Up-Counter N-Up-End 1 sub def |
29495
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
499 N-Up-XLine N-Up-YLine}ifelse |
27165 | 500 translate |
501 }if | |
502 }{ % else | |
503 % ---- restore the state of the current column | |
504 columnState restore | |
505 % ---- and translate to the next column | |
506 ColumnWidth 0 translate | |
507 /ColumnIndex ColumnIndex 1 add def | |
508 }ifelse | |
509 }def | |
510 | |
511 % stack: number-of-pages-per-sheet |- -- | |
512 /BeginSheet{ | |
513 /sheetState save def | |
514 /pages-per-sheet exch def | |
28980
66e571cf74c6
PostScript code compatibility with other utilities
Gerd Moellmann <gerd@gnu.org>
parents:
28762
diff
changeset
|
515 |
66e571cf74c6
PostScript code compatibility with other utilities
Gerd Moellmann <gerd@gnu.org>
parents:
28762
diff
changeset
|
516 % ---- translate to bottom-right corner of Portrait page |
66e571cf74c6
PostScript code compatibility with other utilities
Gerd Moellmann <gerd@gnu.org>
parents:
28762
diff
changeset
|
517 LandscapeMode{ |
66e571cf74c6
PostScript code compatibility with other utilities
Gerd Moellmann <gerd@gnu.org>
parents:
28762
diff
changeset
|
518 LandscapePageHeight 0 translate |
66e571cf74c6
PostScript code compatibility with other utilities
Gerd Moellmann <gerd@gnu.org>
parents:
28762
diff
changeset
|
519 90 rotate |
66e571cf74c6
PostScript code compatibility with other utilities
Gerd Moellmann <gerd@gnu.org>
parents:
28762
diff
changeset
|
520 }if |
66e571cf74c6
PostScript code compatibility with other utilities
Gerd Moellmann <gerd@gnu.org>
parents:
28762
diff
changeset
|
521 % ---- [jack] Kludge: my ghostscript window is 21x27.7 instead of 21x29.7 |
66e571cf74c6
PostScript code compatibility with other utilities
Gerd Moellmann <gerd@gnu.org>
parents:
28762
diff
changeset
|
522 /JackGhostscript where{pop 1 27.7 29.7 div scale}if |
66e571cf74c6
PostScript code compatibility with other utilities
Gerd Moellmann <gerd@gnu.org>
parents:
28762
diff
changeset
|
523 UpsideDown{PageWidth LandscapePageHeight translate 180 rotate}if |
66e571cf74c6
PostScript code compatibility with other utilities
Gerd Moellmann <gerd@gnu.org>
parents:
28762
diff
changeset
|
524 % ---- N-Up printing |
66e571cf74c6
PostScript code compatibility with other utilities
Gerd Moellmann <gerd@gnu.org>
parents:
28762
diff
changeset
|
525 N-Up 1 gt{ |
66e571cf74c6
PostScript code compatibility with other utilities
Gerd Moellmann <gerd@gnu.org>
parents:
28762
diff
changeset
|
526 % ---- landscape |
66e571cf74c6
PostScript code compatibility with other utilities
Gerd Moellmann <gerd@gnu.org>
parents:
28762
diff
changeset
|
527 N-Up-Landscape{ |
66e571cf74c6
PostScript code compatibility with other utilities
Gerd Moellmann <gerd@gnu.org>
parents:
28762
diff
changeset
|
528 PageWidth 0 translate |
66e571cf74c6
PostScript code compatibility with other utilities
Gerd Moellmann <gerd@gnu.org>
parents:
28762
diff
changeset
|
529 90 rotate |
66e571cf74c6
PostScript code compatibility with other utilities
Gerd Moellmann <gerd@gnu.org>
parents:
28762
diff
changeset
|
530 }if |
66e571cf74c6
PostScript code compatibility with other utilities
Gerd Moellmann <gerd@gnu.org>
parents:
28762
diff
changeset
|
531 N-Up-Margin dup translate |
66e571cf74c6
PostScript code compatibility with other utilities
Gerd Moellmann <gerd@gnu.org>
parents:
28762
diff
changeset
|
532 % ---- scale |
66e571cf74c6
PostScript code compatibility with other utilities
Gerd Moellmann <gerd@gnu.org>
parents:
28762
diff
changeset
|
533 LandscapeMode{ |
66e571cf74c6
PostScript code compatibility with other utilities
Gerd Moellmann <gerd@gnu.org>
parents:
28762
diff
changeset
|
534 /HH PageWidth def |
66e571cf74c6
PostScript code compatibility with other utilities
Gerd Moellmann <gerd@gnu.org>
parents:
28762
diff
changeset
|
535 /WW LandscapePageHeight def |
66e571cf74c6
PostScript code compatibility with other utilities
Gerd Moellmann <gerd@gnu.org>
parents:
28762
diff
changeset
|
536 }{ |
66e571cf74c6
PostScript code compatibility with other utilities
Gerd Moellmann <gerd@gnu.org>
parents:
28762
diff
changeset
|
537 /HH LandscapePageHeight def |
66e571cf74c6
PostScript code compatibility with other utilities
Gerd Moellmann <gerd@gnu.org>
parents:
28762
diff
changeset
|
538 /WW PageWidth def |
66e571cf74c6
PostScript code compatibility with other utilities
Gerd Moellmann <gerd@gnu.org>
parents:
28762
diff
changeset
|
539 }ifelse |
29495
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
540 /xx 0 def |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
541 N-Up-Landscape{ |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
542 /ww WW WW mul N-Up-Lines HH mul div def |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
543 /cc HH N-Up-Columns N-Up-Missing add div def |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
544 ww cc gt{/xx WW def/WW cc ww div WW mul def/xx xx WW sub def}if |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
545 }{ |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
546 /hh HH N-Up-Columns N-Up-Missing add div def |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
547 /cc HH N-Up-Lines div def |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
548 hh cc gt{/xx WW def/WW cc hh div WW mul def/xx xx WW sub def}if |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
549 }ifelse |
28980
66e571cf74c6
PostScript code compatibility with other utilities
Gerd Moellmann <gerd@gnu.org>
parents:
28762
diff
changeset
|
550 WW N-Up-Margin sub N-Up-Margin sub |
66e571cf74c6
PostScript code compatibility with other utilities
Gerd Moellmann <gerd@gnu.org>
parents:
28762
diff
changeset
|
551 N-Up-Landscape |
29495
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
552 {N-Up-Lines div HH} |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
553 {N-Up-Columns N-Up-Missing add div WW}ifelse |
28980
66e571cf74c6
PostScript code compatibility with other utilities
Gerd Moellmann <gerd@gnu.org>
parents:
28762
diff
changeset
|
554 div dup scale |
29495
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
555 LandscapeMode{/yy 0 def}{/yy xx def/xx 0 def}ifelse |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
556 xx N-Up-Repeat 1 sub LandscapePageHeight mul yy add translate |
28980
66e571cf74c6
PostScript code compatibility with other utilities
Gerd Moellmann <gerd@gnu.org>
parents:
28762
diff
changeset
|
557 % ---- go to start position in page matrix |
66e571cf74c6
PostScript code compatibility with other utilities
Gerd Moellmann <gerd@gnu.org>
parents:
28762
diff
changeset
|
558 N-Up-XStart N-Up-Missing 0.5 mul |
66e571cf74c6
PostScript code compatibility with other utilities
Gerd Moellmann <gerd@gnu.org>
parents:
28762
diff
changeset
|
559 LandscapeMode |
66e571cf74c6
PostScript code compatibility with other utilities
Gerd Moellmann <gerd@gnu.org>
parents:
28762
diff
changeset
|
560 {LandscapePageHeight mul N-Up-YStart add} |
66e571cf74c6
PostScript code compatibility with other utilities
Gerd Moellmann <gerd@gnu.org>
parents:
28762
diff
changeset
|
561 {PageWidth mul add N-Up-YStart}ifelse |
66e571cf74c6
PostScript code compatibility with other utilities
Gerd Moellmann <gerd@gnu.org>
parents:
28762
diff
changeset
|
562 translate |
66e571cf74c6
PostScript code compatibility with other utilities
Gerd Moellmann <gerd@gnu.org>
parents:
28762
diff
changeset
|
563 }if |
66e571cf74c6
PostScript code compatibility with other utilities
Gerd Moellmann <gerd@gnu.org>
parents:
28762
diff
changeset
|
564 % ---- translate to lower left corner of TEXT |
66e571cf74c6
PostScript code compatibility with other utilities
Gerd Moellmann <gerd@gnu.org>
parents:
28762
diff
changeset
|
565 LeftMargin BottomMargin translate |
66e571cf74c6
PostScript code compatibility with other utilities
Gerd Moellmann <gerd@gnu.org>
parents:
28762
diff
changeset
|
566 |
27165 | 567 % ---- N-up printing |
568 N-Up 1 gt N-Up-Border and pages-per-sheet 0 gt and{ | |
569 % ---- page border | |
570 gsave | |
571 0 setgray | |
572 LeftMargin neg BottomMargin neg moveto | |
573 N-Up-Repeat | |
574 {N-Up-End | |
575 {gsave | |
576 PageWidth 0 rlineto | |
577 0 LandscapePageHeight rlineto | |
578 PageWidth neg 0 rlineto | |
579 closepath stroke | |
580 grestore | |
581 /pages-per-sheet pages-per-sheet 1 sub def | |
582 pages-per-sheet 0 le{exit}if | |
583 N-Up-XColumn N-Up-YColumn rmoveto | |
584 }repeat | |
585 pages-per-sheet 0 le{exit}if | |
586 N-Up-XLine N-Up-XColumn sub N-Up-YLine rmoveto | |
587 }repeat | |
588 grestore | |
589 }if | |
590 }def | |
591 | |
592 /EndSheet{ | |
593 showpage | |
594 sheetState restore | |
595 }def | |
596 | |
597 /SetHeaderLines{ % nb-lines -- | |
598 /HeaderLines exch def | |
599 % ---- bottom up | |
600 HeaderPad | |
601 HeaderLines 1 sub HeaderLineHeight mul add | |
602 HeaderTitleLineHeight add | |
603 HeaderPad add | |
604 /HeaderHeight exch def | |
605 }def | |
606 | |
607 % |---------| | |
608 % | tm | | |
609 % |---------| | |
610 % | header | | |
611 % |-+-------| <-- (x y) | |
612 % | ho | | |
613 % |---------| | |
614 % | text | | |
615 % |-+-------| <-- (0 0) | |
616 % | bm | | |
617 % |---------| | |
618 | |
29495
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
619 % -- |- x y |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
620 /HeaderFrameStart{0 PrintHeight HeaderOffset add}def |
27165 | 621 |
622 /HeaderFramePath{ | |
623 PrintHeaderWidth 0 rlineto | |
624 0 HeaderHeight rlineto | |
625 PrintHeaderWidth neg 0 rlineto | |
626 0 HeaderHeight neg rlineto | |
627 }def | |
628 | |
629 /HeaderFrame{ | |
630 gsave | |
631 0.4 setlinewidth | |
632 % ---- fill a black rectangle (the shadow of the next one) | |
633 HeaderFrameStart moveto | |
634 1 -1 rmoveto | |
635 HeaderFramePath | |
636 0 setgray fill | |
637 % ---- do the next rectangle ... | |
638 HeaderFrameStart moveto | |
639 HeaderFramePath | |
640 gsave 0.9 setgray fill grestore % filled with grey | |
641 gsave 0 setgray stroke grestore % drawn with black | |
642 grestore | |
643 }def | |
644 | |
645 /HeaderStart{ | |
646 HeaderFrameStart | |
647 exch HeaderPad add exch % horizontal pad | |
648 % ---- bottom up | |
649 HeaderPad add % vertical pad | |
650 HeaderDescent sub | |
651 HeaderLineHeight HeaderLines 1 sub mul add | |
652 }def | |
653 | |
654 /strcat{ | |
655 dup length 3 -1 roll dup length dup 4 -1 roll add string dup | |
656 0 5 -1 roll putinterval | |
657 dup 4 2 roll exch putinterval | |
658 }def | |
659 | |
660 /pagenumberstring{ | |
661 PageNumber 32 string cvs | |
29495
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
662 ShowNofN{(/)strcat PageCount 32 string cvs strcat}if |
27165 | 663 }def |
664 | |
665 /HeaderText{ | |
666 HeaderStart moveto | |
667 | |
668 HeaderLinesRight HeaderLinesLeft % -- rightLines leftLines | |
669 | |
670 % ---- hack: `PN 1 and' == `PN 2 modulo' | |
671 | |
672 % ---- if even page number and duplex, then exchange left and right | |
29495
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
673 PageNumber 1 and 0 eq SwitchHeader and{exch}if |
27165 | 674 |
675 { % ---- process the left lines | |
676 aload pop | |
677 exch F | |
678 gsave | |
679 dup xcheck{exec}if | |
680 show | |
681 grestore | |
682 0 HeaderLineHeight neg rmoveto | |
683 }forall | |
684 | |
685 HeaderStart moveto | |
686 | |
687 { % ---- process the right lines | |
688 aload pop | |
689 exch F | |
690 gsave | |
691 dup xcheck{exec}if | |
692 dup stringwidth pop | |
693 PrintHeaderWidth exch sub HeaderPad 2 mul sub 0 rmoveto | |
694 show | |
695 grestore | |
696 0 HeaderLineHeight neg rmoveto | |
697 }forall | |
698 }def | |
699 | |
700 /ReportFontInfo{ | |
701 2 copy | |
702 /t0 3 1 roll DefFont | |
703 /t0 F | |
704 /lh FontHeight def | |
29495
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
705 /sw( )stringwidth pop def |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
706 /aw(01234567890abcdefghijklmnopqrstuvwxyz)dup length exch |
27165 | 707 stringwidth pop exch div def |
29495
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
708 /t1 12/Helvetica-Oblique DefFont |
27165 | 709 /t1 F |
710 gsave | |
29495
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
711 (languagelevel = )show |
28428
b2d43a699564
Replace gs_languagelevel by languagelevel.
Gerd Moellmann <gerd@gnu.org>
parents:
28284
diff
changeset
|
712 languagelevel 32 string cvs show |
27165 | 713 grestore |
714 0 FontHeight neg rmoveto | |
715 gsave | |
29495
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
716 (For )show |
27165 | 717 128 string cvs show |
29495
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
718 ( )show |
27165 | 719 32 string cvs show |
29495
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
720 ( point, the line height is )show |
27165 | 721 lh 32 string cvs show |
29495
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
722 (, the space width is )show |
27165 | 723 sw 32 string cvs show |
29495
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
724 (,)show |
27165 | 725 grestore |
726 0 FontHeight neg rmoveto | |
727 gsave | |
29495
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
728 (and a crude estimate of average character width is )show |
27165 | 729 aw 32 string cvs show |
29495
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
730 (.)show |
27165 | 731 grestore |
732 0 FontHeight neg rmoveto | |
733 }def | |
734 | |
29495
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
735 % cm to point |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
736 /cm{72 mul 2.54 div}def |
27165 | 737 |
738 /ReportAllFontInfo{ | |
29495
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
739 % key = font name value = font dictionary |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
740 FontDirectory{pop 10 exch ReportFontInfo}forall |
27165 | 741 }def |
742 | |
29495
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
743 % 3 cm 20 cm moveto 10/Courier ReportFontInfo showpage |
a6ce0d37c2cf
Insert a version number comment (5.2.2). Can
Gerd Moellmann <gerd@gnu.org>
parents:
28980
diff
changeset
|
744 % 3 cm 20 cm moveto ReportAllFontInfo showpage |
27165 | 745 |
746 % === END ps-print prologue 1 |