Eliminated.
[bpt/emacs.git] / etc / ps-prin1.ps
CommitLineData
48441121 1% === BEGIN ps-print prologue 1
d30e4fd5 2% version: 5.2.2
48441121
KH
3
4% ISOLatin1Encoding stolen from ps_init.ps in GhostScript 2.6.1.4:
d30e4fd5 5/ISOLatin1Encoding where{pop}{
48441121
KH
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
10StandardEncoding 0 45 getinterval aload pop
11 /minus
12StandardEncoding 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)
d30e4fd5
GM
17 /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
18 /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
19 /dotlessi/grave/acute/circumflex/tilde/macron/breve/dotaccent
20 /dieresis/.notdef/ring/cedilla/.notdef/hungarumlaut/ogonek/caron
48441121 21% 0240 (160)
d30e4fd5
GM
22 /space/exclamdown/cent/sterling
23 /currency/yen/brokenbar/section
24 /dieresis/copyright/ordfeminine/guillemotleft
25 /logicalnot/hyphen/registered/macron
26 /degree/plusminus/twosuperior/threesuperior
27 /acute/mu/paragraph/periodcentered
28 /cedilla/onesuperior/ordmasculine/guillemotright
29 /onequarter/onehalf/threequarters/questiondown
48441121 30% 0300 (192)
d30e4fd5
GM
31 /Agrave/Aacute/Acircumflex/Atilde
32 /Adieresis/Aring/AE/Ccedilla
33 /Egrave/Eacute/Ecircumflex/Edieresis
34 /Igrave/Iacute/Icircumflex/Idieresis
35 /Eth/Ntilde/Ograve/Oacute
36 /Ocircumflex/Otilde/Odieresis/multiply
37 /Oslash/Ugrave/Uacute/Ucircumflex
38 /Udieresis/Yacute/Thorn/germandbls
48441121 39% 0340 (224)
d30e4fd5
GM
40 /agrave/aacute/acircumflex/atilde
41 /adieresis/aring/ae/ccedilla
42 /egrave/eacute/ecircumflex/edieresis
43 /igrave/iacute/icircumflex/idieresis
44 /eth/ntilde/ograve/oacute
45 /ocircumflex/otilde/odieresis/divide
46 /oslash/ugrave/uacute/ucircumflex
47 /udieresis/yacute/thorn/ydieresis
48441121
KH
48256 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
d30e4fd5
GM
58 % Copy each of the symbols from the old dictionary
59 % to the new one except for the font ID.
60 {1 index/FID ne{def}{pop pop}ifelse}forall
48441121 61
d30e4fd5
GM
62 % Override the encoding with the ISOLatin1 encoding.
63 currentdict/FontType get 0 ne{/Encoding ISOLatin1Encoding def}if
48441121
KH
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
d30e4fd5
GM
81 currentdict/FontType get 0 ne
82 {/FontBBox load aload pop % -- x1 y1 x2 y2
83 FontMatrix transform/Ascent exch def pop
84 FontMatrix transform/Descent exch def pop}
85 {/PrimaryFont FDepVector 0 get def
86 PrimaryFont/FontBBox get aload pop
87 PrimaryFont/FontMatrix get transform/Ascent exch def pop
88 PrimaryFont/FontMatrix get transform/Descent exch def pop}ifelse
48441121
KH
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
d30e4fd5
GM
110% Font definition
111/DefFont{findfont exch scalefont reencodeFontISO}def
48441121 112
d30e4fd5
GM
113% Font selection
114/F{
48441121 115 findfont
d30e4fd5
GM
116 dup/Ascent get/Ascent exch def
117 dup/Descent get/Descent exch def
118 dup/FontHeight get/FontHeight exch def
119 dup/UnderlinePosition get/UnderlinePosition exch def
120 dup/OverlinePosition get/OverlinePosition exch def
121 dup/StrikeoutPosition get/StrikeoutPosition exch def
122 dup/LineThickness get/LineThickness exch def
123 dup/Xshadow get/Xshadow exch def
124 dup/Yshadow get/Yshadow exch def
125 dup/SpaceBackground get/SpaceBackground exch def
126 dup/XBox get/XBox exch def
127 dup/YBox get/YBox exch def
48441121
KH
128 setfont
129}def
130
d30e4fd5 131/FG/setrgbcolor load def
48441121
KH
132
133/bg false def
134/BG{
d30e4fd5
GM
135 dup/bg exch def
136 {[4 1 roll]}
137 {[1.0 1.0 1.0]}
48441121
KH
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
8f4a5e99 160 FillBgColor
48441121
KH
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
c00e0292 171/PSL{bg{eolbg}if 0 currentpoint exch pop LineHeight sub moveto}def
48441121
KH
172/PLN{PrintLineNumber{doLineNumber}if}def
173
c00e0292 174/SL{PSL isLineStep pop}def % Soft Linefeed
48441121 175
c00e0292 176/HL{PSL PLN}def % Hard Linefeed
48441121
KH
177
178% Some debug
d30e4fd5
GM
179/dcp{currentpoint exch 40 string cvs print(, )print =}def
180/dp{print 2 copy exch 40 string cvs print(, )print =}def
48441121
KH
181
182/W{
d30e4fd5 183 ( )stringwidth % Get the width of a space in the current font.
48441121
KH
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{
d30e4fd5
GM
198 /xx currentpoint dup Descent add/yy exch def
199 Ascent add/YY exch def def
200 dup stringwidth pop xx add/XX exch def
48441121
KH
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
d30e4fd5
GM
257 {FillBgColor}
258 {LineThickness setlinewidth stroke}ifelse
48441121
KH
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
d30e4fd5 275 /-ox- currentpoint/-oy- exch def def
48441121
KH
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
d30e4fd5
GM
282 -oy- add/-oy- exch def
283 -ox- add/-ox- exch def
48441121
KH
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
d30e4fd5 293/L0 6/Times-Italic DefFont
48441121 294
c00e0292
GM
295% stack: -- |- boolean
296/isLineStep{
297 SyncLineZebra
f4fa5c85
GM
298 {PLScounter 0 gt % or zebra
299 {/PLScounter PLScounter 1 sub def PLScounter 0 eq}
300 {false}ifelse
301 PrintLineStep 1 gt
302 {/PrintLineStep PrintLineStep 1 sub def}
303 {/PrintLineStep ZebraHeight def
304 /PLScounter PrintLineStart def}ifelse}
305 {LineNumber PrintLineStart sub PrintLineStep mod 0 eq}ifelse % or line step
c00e0292
GM
306}def
307
48441121
KH
308% stack: --
309/doLineNumber{
310 /LineNumber where
c00e0292
GM
311 {pop
312 isLineStep % or line step
313 LineNumber Lines ge or % or last line
314 {currentfont
48441121
KH
315 gsave
316 0.0 0.0 0.0 setrgbcolor
317 /L0 findfont setfont
318 LineNumber Lines ge
c00e0292 319 {(end )}
d30e4fd5 320 {LineNumber 6 string cvs( )strcat}ifelse
48441121
KH
321 dup stringwidth pop neg 0 rmoveto
322 show
323 grestore
c00e0292 324 setfont}if
48441121
KH
325 /LineNumber LineNumber 1 add def
326 }if
327}def
328
8f4a5e99 329% stack: color-specifier |- --
d30e4fd5 330/SetColor{dup type/realtype eq{setgray}{aload pop setrgbcolor}ifelse}def
8f4a5e99 331
48441121
KH
332% stack: --
333/printZebra{
334 gsave
8f4a5e99 335 ZebraColor SetColor
48441121
KH
336 /double-zebra ZebraHeight ZebraHeight add def
337 /yiter double-zebra LineHeight mul neg def
338 /xiter PrintWidth InterColumn add def
d30e4fd5 339 /zebra-line PageNumber 1 sub NumberOfColumns mul LinesPerColumn mul def
48441121
KH
340 NumberOfColumns{LinesPerColumn doColumnZebra xiter 0 rmoveto}repeat
341 grestore
342}def
343
344% stack: lines-per-column |- --
345/doColumnZebra{
d30e4fd5 346 /lpc exch def
48441121 347 gsave
d30e4fd5
GM
348 ZebraFollow{
349 /H ZebraHeight zebra-line ZebraHeight mod sub def
350 /lpc lpc H sub def
351 zebra-line double-zebra mod ZebraHeight lt
352 {H doZebra % "black" stripe followed by a "white" stripe
353 /lpc lpc ZebraHeight sub def
354 H ZebraHeight add}
355 {H}ifelse % "white" stripe
356 LineHeight mul neg 0 exch rmoveto
357 /zebra-line zebra-line LinesPerColumn add def
358 }if
359 lpc dup double-zebra idiv{ZebraHeight doZebra 0 yiter rmoveto}repeat
48441121 360 double-zebra mod
d30e4fd5 361 dup 0 le{pop}{dup ZebraHeight gt{pop ZebraHeight}if doZebra}ifelse
48441121
KH
362 grestore
363}def
364
365% stack: zebra-height (in lines) |- --
366/doZebra{
367 /zh exch 0.05 sub LineHeight mul def
368 gsave
369 0 LineHeight 0.65 mul rmoveto
370 PrintWidth 0 rlineto
371 0 zh neg rlineto
372 PrintWidth neg 0 rlineto
373 0 zh rlineto
374 fill
375 grestore
376}def
377
8f4a5e99
GM
378% stack: --
379/printBackground{
380 /BackgroundColor where{
381 pop gsave BackgroundColor SetColor
382 NumberOfColumns{
383 gsave
384 0 LineHeight 0.65 mul rmoveto
385 PrintWidth 0 rlineto
386 0 PrintHeight neg rlineto
387 PrintWidth neg 0 rlineto
388 0 PrintHeight rlineto
389 fill
390 grestore
391 PrintWidth InterColumn add 0 rmoveto
392 }repeat
393 grestore
394 }if
395}def
396
48441121
KH
397% tx ty rotation xscale yscale xpos ypos BeginBackImage
398/BeginBackImage{
399 /-save-image- save def
400 /showpage{}def
401 translate
402 scale
403 rotate
404 translate
405}def
406
407/EndBackImage{-save-image- restore}def
408
409% string fontsize fontname rotation gray xpos ypos ShowBackText
410/ShowBackText{
411 gsave
412 translate
413 setgray
414 rotate
d30e4fd5 415 findfont exch dup/-offset- exch -0.25 mul def scalefont setfont
48441121
KH
416 0 -offset- moveto
417 /-saveLineThickness- LineThickness def
418 /LineThickness 1 def
419 false doOutline
420 /LineThickness -saveLineThickness- def
421 grestore
422}def
423
d30e4fd5
GM
424/SetPageSize{
425 BMark/PageSize[PageWidth LandscapePageHeight LandscapeMode{exch}if]EMark setpagedevice
426}def
427
48441121
KH
428/BeginDoc{
429 % ---- Remember space width of the normal text font `f0'.
d30e4fd5 430 /SpaceWidth/f0 findfont setfont( )stringwidth pop def
48441121
KH
431 % ---- save the state of the document (useful for ghostscript!)
432 /docState save def
433 % ---- [andrewi] set PageSize based on chosen dimensions
434 UseSetpagedevice{
d30e4fd5 435 WarnPaperSize{SetPageSize}{mark{SetPageSize}stopped cleartomark}ifelse
48441121
KH
436 }if
437 /ColumnWidth PrintWidth InterColumn add def
48441121
KH
438 % ---- define where printing will start
439 /f0 F % this installs Ascent
440 /PrintStartY PrintHeight Ascent sub def
441 /ColumnIndex 1 def
442 /N-Up-Counter N-Up-End 1 sub def
f4fa5c85 443 /PLScounter PrintLineStart def
48441121
KH
444}def
445
446/EndDoc{
447 % ---- restore the state of the document (useful for ghostscript!)
448 docState restore
449}def
450
451/BeginDSCPage{
452 % ---- when 1st column, save the state of the page
d30e4fd5 453 ColumnIndex 1 eq{/pageState save def}if
48441121
KH
454 % ---- save the state of the column
455 /columnState save def
456}def
457
458/PrintHeaderWidth PrintOnlyOneHeader{PrintPageWidth}{PrintWidth}ifelse def
459
460/BeginPage{
461 % ---- when 1st column, print all background effects
462 ColumnIndex 1 eq{
463 0 PrintStartY moveto % move to where printing will start
8f4a5e99 464 printBackground
d30e4fd5 465 Zebra{printZebra}if
48441121
KH
466 printGlobalBackground
467 printLocalBackground
468 }if
469 PrintHeader{
470 PrintOnlyOneHeader{ColumnIndex 1 eq}{true}ifelse{
471 PrintHeaderFrame{HeaderFrame}if
472 HeaderText
473 }if
474 }if
475 0 PrintStartY moveto % move to where printing will start
d30e4fd5
GM
476 /LineNumber where
477 {pop
478 SyncLineZebra
479 {/H PageNumber 1 sub NumberOfColumns mul ColumnIndex 1 sub add
480 LinesPerColumn mul ZebraHeight mod def
481 /PLScounter H PrintLineStart ge{0}{PrintLineStart H sub}ifelse def
482 /PrintLineStep ZebraHeight H sub def}if}if
48441121
KH
483 PLN
484}def
485
486/EndPage{bg{eolbg}if}def
487
488/EndDSCPage{
489 ColumnIndex NumberOfColumns eq{
490 % ---- restore the state of the page
491 pageState restore
492 /ColumnIndex 1 def
493 % ---- N-up printing
494 N-Up 1 gt{
d30e4fd5
GM
495 N-Up-Counter 0 gt
496 {% ---- Next page on same row
48441121 497 /N-Up-Counter N-Up-Counter 1 sub def
d30e4fd5
GM
498 N-Up-XColumn N-Up-YColumn}
499 {% ---- Next page on next line
48441121 500 /N-Up-Counter N-Up-End 1 sub def
d30e4fd5 501 N-Up-XLine N-Up-YLine}ifelse
48441121
KH
502 translate
503 }if
504 }{ % else
505 % ---- restore the state of the current column
506 columnState restore
507 % ---- and translate to the next column
508 ColumnWidth 0 translate
509 /ColumnIndex ColumnIndex 1 add def
510 }ifelse
511}def
512
513% stack: number-of-pages-per-sheet |- --
514/BeginSheet{
515 /sheetState save def
516 /pages-per-sheet exch def
f4fa5c85
GM
517
518 % ---- translate to bottom-right corner of Portrait page
519 LandscapeMode{
520 LandscapePageHeight 0 translate
521 90 rotate
522 }if
523 % ---- [jack] Kludge: my ghostscript window is 21x27.7 instead of 21x29.7
524 /JackGhostscript where{pop 1 27.7 29.7 div scale}if
525 UpsideDown{PageWidth LandscapePageHeight translate 180 rotate}if
526 % ---- N-Up printing
527 N-Up 1 gt{
528 % ---- landscape
529 N-Up-Landscape{
530 PageWidth 0 translate
531 90 rotate
532 }if
533 N-Up-Margin dup translate
534 % ---- scale
535 LandscapeMode{
536 /HH PageWidth def
537 /WW LandscapePageHeight def
538 }{
539 /HH LandscapePageHeight def
540 /WW PageWidth def
541 }ifelse
d30e4fd5
GM
542 /xx 0 def
543 N-Up-Landscape{
544 /ww WW WW mul N-Up-Lines HH mul div def
545 /cc HH N-Up-Columns N-Up-Missing add div def
546 ww cc gt{/xx WW def/WW cc ww div WW mul def/xx xx WW sub def}if
547 }{
548 /hh HH N-Up-Columns N-Up-Missing add div def
549 /cc HH N-Up-Lines div def
550 hh cc gt{/xx WW def/WW cc hh div WW mul def/xx xx WW sub def}if
551 }ifelse
f4fa5c85
GM
552 WW N-Up-Margin sub N-Up-Margin sub
553 N-Up-Landscape
d30e4fd5
GM
554 {N-Up-Lines div HH}
555 {N-Up-Columns N-Up-Missing add div WW}ifelse
f4fa5c85 556 div dup scale
d30e4fd5
GM
557 LandscapeMode{/yy 0 def}{/yy xx def/xx 0 def}ifelse
558 xx N-Up-Repeat 1 sub LandscapePageHeight mul yy add translate
f4fa5c85
GM
559 % ---- go to start position in page matrix
560 N-Up-XStart N-Up-Missing 0.5 mul
561 LandscapeMode
562 {LandscapePageHeight mul N-Up-YStart add}
563 {PageWidth mul add N-Up-YStart}ifelse
564 translate
565 }if
566 % ---- translate to lower left corner of TEXT
567 LeftMargin BottomMargin translate
568
48441121
KH
569 % ---- N-up printing
570 N-Up 1 gt N-Up-Border and pages-per-sheet 0 gt and{
571 % ---- page border
572 gsave
573 0 setgray
574 LeftMargin neg BottomMargin neg moveto
575 N-Up-Repeat
576 {N-Up-End
577 {gsave
578 PageWidth 0 rlineto
579 0 LandscapePageHeight rlineto
580 PageWidth neg 0 rlineto
581 closepath stroke
582 grestore
583 /pages-per-sheet pages-per-sheet 1 sub def
584 pages-per-sheet 0 le{exit}if
585 N-Up-XColumn N-Up-YColumn rmoveto
586 }repeat
587 pages-per-sheet 0 le{exit}if
588 N-Up-XLine N-Up-XColumn sub N-Up-YLine rmoveto
589 }repeat
590 grestore
591 }if
592}def
593
594/EndSheet{
595 showpage
596 sheetState restore
597}def
598
599/SetHeaderLines{ % nb-lines --
600 /HeaderLines exch def
601 % ---- bottom up
602 HeaderPad
603 HeaderLines 1 sub HeaderLineHeight mul add
604 HeaderTitleLineHeight add
605 HeaderPad add
606 /HeaderHeight exch def
607}def
608
609% |---------|
610% | tm |
611% |---------|
612% | header |
613% |-+-------| <-- (x y)
614% | ho |
615% |---------|
616% | text |
617% |-+-------| <-- (0 0)
618% | bm |
619% |---------|
620
d30e4fd5
GM
621% -- |- x y
622/HeaderFrameStart{0 PrintHeight HeaderOffset add}def
48441121
KH
623
624/HeaderFramePath{
625 PrintHeaderWidth 0 rlineto
626 0 HeaderHeight rlineto
627 PrintHeaderWidth neg 0 rlineto
628 0 HeaderHeight neg rlineto
629}def
630
631/HeaderFrame{
632 gsave
633 0.4 setlinewidth
634 % ---- fill a black rectangle (the shadow of the next one)
635 HeaderFrameStart moveto
636 1 -1 rmoveto
637 HeaderFramePath
638 0 setgray fill
639 % ---- do the next rectangle ...
640 HeaderFrameStart moveto
641 HeaderFramePath
642 gsave 0.9 setgray fill grestore % filled with grey
643 gsave 0 setgray stroke grestore % drawn with black
644 grestore
645}def
646
647/HeaderStart{
648 HeaderFrameStart
649 exch HeaderPad add exch % horizontal pad
650 % ---- bottom up
651 HeaderPad add % vertical pad
652 HeaderDescent sub
653 HeaderLineHeight HeaderLines 1 sub mul add
654}def
655
656/strcat{
657 dup length 3 -1 roll dup length dup 4 -1 roll add string dup
658 0 5 -1 roll putinterval
659 dup 4 2 roll exch putinterval
660}def
661
662/pagenumberstring{
663 PageNumber 32 string cvs
d30e4fd5 664 ShowNofN{(/)strcat PageCount 32 string cvs strcat}if
48441121
KH
665}def
666
667/HeaderText{
668 HeaderStart moveto
669
670 HeaderLinesRight HeaderLinesLeft % -- rightLines leftLines
671
672 % ---- hack: `PN 1 and' == `PN 2 modulo'
673
674 % ---- if even page number and duplex, then exchange left and right
d30e4fd5 675 PageNumber 1 and 0 eq SwitchHeader and{exch}if
48441121
KH
676
677 { % ---- process the left lines
678 aload pop
679 exch F
680 gsave
681 dup xcheck{exec}if
682 show
683 grestore
684 0 HeaderLineHeight neg rmoveto
685 }forall
686
687 HeaderStart moveto
688
689 { % ---- process the right lines
690 aload pop
691 exch F
692 gsave
693 dup xcheck{exec}if
694 dup stringwidth pop
695 PrintHeaderWidth exch sub HeaderPad 2 mul sub 0 rmoveto
696 show
697 grestore
698 0 HeaderLineHeight neg rmoveto
699 }forall
700}def
701
702/ReportFontInfo{
703 2 copy
704 /t0 3 1 roll DefFont
705 /t0 F
706 /lh FontHeight def
d30e4fd5
GM
707 /sw( )stringwidth pop def
708 /aw(01234567890abcdefghijklmnopqrstuvwxyz)dup length exch
48441121 709 stringwidth pop exch div def
d30e4fd5 710 /t1 12/Helvetica-Oblique DefFont
48441121
KH
711 /t1 F
712 gsave
d30e4fd5 713 (languagelevel = )show
8f4a5e99 714 languagelevel 32 string cvs show
48441121
KH
715 grestore
716 0 FontHeight neg rmoveto
717 gsave
d30e4fd5 718 (For )show
48441121 719 128 string cvs show
d30e4fd5 720 ( )show
48441121 721 32 string cvs show
d30e4fd5 722 ( point, the line height is )show
48441121 723 lh 32 string cvs show
d30e4fd5 724 (, the space width is )show
48441121 725 sw 32 string cvs show
d30e4fd5 726 (,)show
48441121
KH
727 grestore
728 0 FontHeight neg rmoveto
729 gsave
d30e4fd5 730 (and a crude estimate of average character width is )show
48441121 731 aw 32 string cvs show
d30e4fd5 732 (.)show
48441121
KH
733 grestore
734 0 FontHeight neg rmoveto
735}def
736
d30e4fd5
GM
737% cm to point
738/cm{72 mul 2.54 div}def
48441121
KH
739
740/ReportAllFontInfo{
d30e4fd5
GM
741 % key = font name value = font dictionary
742 FontDirectory{pop 10 exch ReportFontInfo}forall
48441121
KH
743}def
744
d30e4fd5
GM
745% 3 cm 20 cm moveto 10/Courier ReportFontInfo showpage
746% 3 cm 20 cm moveto ReportAllFontInfo showpage
48441121 747
48441121 748% === END ps-print prologue 1