1 % === BEGIN ps-print prologue 1
4 % ISOLatin1Encoding stolen from ps_init.ps in GhostScript 2.6.1.4:
5 /ISOLatin1Encoding where{pop}{
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.
10 StandardEncoding 0 45 getinterval aload pop
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.
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
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
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
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
51 /reencodeFontISO{ %def
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.
56 begin % Make the new font the current dictionary.
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
62 % Override the encoding with the ISOLatin1 encoding.
63 currentdict/FontType get 0 ne{/Encoding ISOLatin1Encoding def}if
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.
74 % | | | | Ascent (usually > 0)
76 % (0 0) -> +--+----+-------->
78 % | | v Descent (usually < 0)
79 % (x1 y1) --> +----+ - -
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
90 /FontHeight Ascent Descent sub def % use `sub' because descent < 0
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
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.
111 /DefFont{findfont exch scalefont reencodeFontISO}def
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
131 /FG/setrgbcolor load def
144 % | Ascent (usually > 0)
146 % | Descent (usually < 0)
150 /dobackground{ % width --
151 currentpoint % -- width x y
157 0 Descent Ascent sub rlineto % D
164 /eolbg{ % dobackground until right margin
165 PrintWidth % -- x-eol
166 currentpoint pop % -- cur-x
167 sub % -- width until eol
171 /PSL{bg{eolbg}if 0 currentpoint exch pop LineHeight sub moveto}def
172 /PLN{PrintLineNumber{doLineNumber}if}def
174 /SL{PSL isLineStep pop}def % Soft Linefeed
176 /HL{PSL PLN}def % Hard Linefeed
179 /dcp{currentpoint exch 40 string cvs print(, )print =}def
180 /dp{print 2 copy exch 40 string cvs print(, )print =}def
183 ( )stringwidth % Get the width of a space in the current font.
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
192 /EF{/Effect exch def}def
194 % stack: string |- --
195 % effect: 1 - underline 2 - strikeout 4 - overline
196 % 8 - shadow 16 - box 32 - outline
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
202 /yy yy Yshadow add def
203 /XX XX Xshadow add def
208 {SpaceBackground doBox}
212 Effect 16 and 0 ne{false 0 doBox}if % box
213 Effect 8 and 0 ne{dup doShadow}if % shadow
215 {true doOutline} % outline
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
223 % stack: position |- --
225 currentpoint exch pop add dup
231 LineThickness setlinewidth stroke
235 % stack: fill-or-not delta |- --
238 xx XBox sub dd sub yy YBox sub dd sub
239 XX XBox add dd add YY YBox add dd add
243 % stack: fill-or-not lower-x lower-y upper-x upper-y |- --
256 % top of stack: fill-or-not
258 {LineThickness setlinewidth stroke}ifelse
262 % stack: string |- --
265 Xshadow Yshadow rmoveto
272 % stack: string fill-or-not |- --
275 /-ox- currentpoint/-oy- exch def def
277 LineThickness setlinewidth
280 -fillp- {gsave FillBgColor grestore}if
282 -oy- add/-oy- exch def
283 -ox- add/-ox- exch def
291 /FillBgColor{bgcolor aload pop setrgbcolor fill}bind def
293 % stack: -- |- boolean
296 {PLScounter 0 gt % or zebra
297 {/PLScounter PLScounter 1 sub def PLScounter 0 eq}
300 {/PrintLineStep PrintLineStep 1 sub def}
301 {/PrintLineStep ZebraHeight def
302 /PLScounter PrintLineStart def}ifelse}
303 {LineNumber PrintLineStart sub PrintLineStep mod 0 eq}ifelse % or line step
310 isLineStep % or line step
311 LineNumber Lines ge or % or last line
314 0.0 0.0 0.0 setrgbcolor
318 {LineNumber 6 string cvs( )strcat}ifelse
319 dup stringwidth pop neg 0 rmoveto
323 /LineNumber LineNumber 1 add def
327 % stack: color-specifier |- --
328 /SetColor{dup type/realtype eq{setgray}{aload pop setrgbcolor}ifelse}def
334 /double-zebra ZebraHeight ZebraHeight add def
335 /yiter double-zebra LineHeight mul neg def
336 /xiter PrintWidth InterColumn add def
337 /zebra-line PageNumber 1 sub NumberOfColumns mul LinesPerColumn mul def
338 NumberOfColumns{LinesPerColumn doColumnZebra xiter 0 rmoveto}repeat
342 % stack: lines-per-column |- --
347 /H ZebraHeight zebra-line ZebraHeight mod sub def
349 zebra-line double-zebra mod ZebraHeight lt
350 {H doZebra % "black" stripe followed by a "white" stripe
351 /lpc lpc ZebraHeight sub def
353 {H}ifelse % "white" stripe
354 LineHeight mul neg 0 exch rmoveto
355 /zebra-line zebra-line LinesPerColumn add def
357 lpc dup double-zebra idiv{ZebraHeight doZebra 0 yiter rmoveto}repeat
359 dup 0 le{pop}{dup ZebraHeight gt{pop ZebraHeight}if doZebra}ifelse
363 % stack: zebra-height (in lines) |- --
365 /zh exch 0.05 sub LineHeight mul def
367 0 LineHeight 0.65 mul rmoveto
370 PrintWidth neg 0 rlineto
378 /BackgroundColor where{
379 pop gsave BackgroundColor SetColor
382 0 LineHeight 0.65 mul rmoveto
384 0 PrintHeight neg rlineto
385 PrintWidth neg 0 rlineto
386 0 PrintHeight rlineto
389 PrintWidth InterColumn add 0 rmoveto
395 % tx ty rotation xscale yscale xpos ypos BeginBackImage
397 /-save-image- save def
405 /EndBackImage{-save-image- restore}def
407 % string fontsize fontname rotation gray xpos ypos ShowBackText
413 findfont exch dup/-offset- exch -0.25 mul def scalefont setfont
415 /-saveLineThickness- LineThickness def
418 /LineThickness -saveLineThickness- def
423 BMark/PageSize[PageWidth LandscapePageHeight LandscapeMode{exch}if]EMark setpagedevice
427 % ---- Remember space width of the normal text font `f0'.
428 /SpaceWidth/f0 findfont setfont( )stringwidth pop def
429 % ---- save the state of the document (useful for ghostscript!)
431 % ---- [andrewi] set PageSize based on chosen dimensions
433 WarnPaperSize{SetPageSize}{mark{SetPageSize}stopped cleartomark}ifelse
435 /ColumnWidth PrintWidth InterColumn add def
436 % ---- define where printing will start
437 /f0 F % this installs Ascent
438 /PrintStartY PrintHeight Ascent sub def
440 /N-Up-Counter N-Up-End 1 sub def
441 /PLScounter PrintLineStart def
445 % ---- restore the state of the document (useful for ghostscript!)
450 % ---- when 1st column, save the state of the page
451 ColumnIndex 1 eq{/pageState save def}if
452 % ---- save the state of the column
453 /columnState save def
456 /PrintHeaderWidth PrintOnlyOneHeader{PrintPageWidth}{PrintWidth}ifelse def
459 % ---- when 1st column, print all background effects
461 0 PrintStartY moveto % move to where printing will start
464 printGlobalBackground
468 PrintOnlyOneHeader{ColumnIndex 1 eq}{true}ifelse{
469 PrintHeaderFrame{HeaderFrame}if
473 0 PrintStartY moveto % move to where printing will start
477 {/H PageNumber 1 sub NumberOfColumns mul ColumnIndex 1 sub add
478 LinesPerColumn mul ZebraHeight mod def
479 /PLScounter H PrintLineStart ge{0}{PrintLineStart H sub}ifelse def
480 /PrintLineStep ZebraHeight H sub def}if}if
484 /EndPage{bg{eolbg}if}def
487 ColumnIndex NumberOfColumns eq{
488 % ---- restore the state of the page
494 {% ---- Next page on same row
495 /N-Up-Counter N-Up-Counter 1 sub def
496 N-Up-XColumn N-Up-YColumn}
497 {% ---- Next page on next line
498 /N-Up-Counter N-Up-End 1 sub def
499 N-Up-XLine N-Up-YLine}ifelse
503 % ---- restore the state of the current column
505 % ---- and translate to the next column
506 ColumnWidth 0 translate
507 /ColumnIndex ColumnIndex 1 add def
511 % stack: number-of-pages-per-sheet |- --
514 /pages-per-sheet exch def
516 % ---- translate to bottom-right corner of Portrait page
518 LandscapePageHeight 0 translate
521 % ---- [jack] Kludge: my ghostscript window is 21x27.7 instead of 21x29.7
522 /JackGhostscript where{pop 1 27.7 29.7 div scale}if
523 UpsideDown{PageWidth LandscapePageHeight translate 180 rotate}if
528 PageWidth 0 translate
531 N-Up-Margin dup translate
535 /WW LandscapePageHeight def
537 /HH LandscapePageHeight def
542 /ww WW WW mul N-Up-Lines HH mul div def
543 /cc HH N-Up-Columns N-Up-Missing add div def
544 ww cc gt{/xx WW def/WW cc ww div WW mul def/xx xx WW sub def}if
546 /hh HH N-Up-Columns N-Up-Missing add div def
547 /cc HH N-Up-Lines div def
548 hh cc gt{/xx WW def/WW cc hh div WW mul def/xx xx WW sub def}if
550 WW N-Up-Margin sub N-Up-Margin sub
553 {N-Up-Columns N-Up-Missing add div WW}ifelse
555 LandscapeMode{/yy 0 def}{/yy xx def/xx 0 def}ifelse
556 xx N-Up-Repeat 1 sub LandscapePageHeight mul yy add translate
557 % ---- go to start position in page matrix
558 N-Up-XStart N-Up-Missing 0.5 mul
560 {LandscapePageHeight mul N-Up-YStart add}
561 {PageWidth mul add N-Up-YStart}ifelse
564 % ---- translate to lower left corner of TEXT
565 LeftMargin BottomMargin translate
568 N-Up 1 gt N-Up-Border and pages-per-sheet 0 gt and{
572 LeftMargin neg BottomMargin neg moveto
577 0 LandscapePageHeight rlineto
578 PageWidth neg 0 rlineto
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
585 pages-per-sheet 0 le{exit}if
586 N-Up-XLine N-Up-XColumn sub N-Up-YLine rmoveto
597 /SetHeaderLines{ % nb-lines --
598 /HeaderLines exch def
601 HeaderLines 1 sub HeaderLineHeight mul add
602 HeaderTitleLineHeight add
604 /HeaderHeight exch def
611 % |-+-------| <-- (x y)
615 % |-+-------| <-- (0 0)
620 /HeaderFrameStart{0 PrintHeight HeaderOffset add}def
623 PrintHeaderWidth 0 rlineto
624 0 HeaderHeight rlineto
625 PrintHeaderWidth neg 0 rlineto
626 0 HeaderHeight neg rlineto
632 % ---- fill a black rectangle (the shadow of the next one)
633 HeaderFrameStart moveto
637 % ---- do the next rectangle ...
638 HeaderFrameStart moveto
640 gsave 0.9 setgray fill grestore % filled with grey
641 gsave 0 setgray stroke grestore % drawn with black
647 exch HeaderPad add exch % horizontal pad
649 HeaderPad add % vertical pad
651 HeaderLineHeight HeaderLines 1 sub mul add
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
661 PageNumber 32 string cvs
662 ShowNofN{(/)strcat PageCount 32 string cvs strcat}if
668 HeaderLinesRight HeaderLinesLeft % -- rightLines leftLines
670 % ---- hack: `PN 1 and' == `PN 2 modulo'
672 % ---- if even page number and duplex, then exchange left and right
673 PageNumber 1 and 0 eq SwitchHeader and{exch}if
675 { % ---- process the left lines
682 0 HeaderLineHeight neg rmoveto
687 { % ---- process the right lines
693 PrintHeaderWidth exch sub HeaderPad 2 mul sub 0 rmoveto
696 0 HeaderLineHeight neg rmoveto
705 /sw( )stringwidth pop def
706 /aw(01234567890abcdefghijklmnopqrstuvwxyz)dup length exch
707 stringwidth pop exch div def
708 /t1 12/Helvetica-Oblique DefFont
711 (languagelevel = )show
712 languagelevel 32 string cvs show
714 0 FontHeight neg rmoveto
720 ( point, the line height is )show
721 lh 32 string cvs show
722 (, the space width is )show
723 sw 32 string cvs show
726 0 FontHeight neg rmoveto
728 (and a crude estimate of average character width is )show
729 aw 32 string cvs show
732 0 FontHeight neg rmoveto
736 /cm{72 mul 2.54 div}def
739 % key = font name value = font dictionary
740 FontDirectory{pop 10 exch ReportFontInfo}forall
743 % 3 cm 20 cm moveto 10/Courier ReportFontInfo showpage
744 % 3 cm 20 cm moveto ReportAllFontInfo showpage
746 % === END ps-print prologue 1