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