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 /L0 6/Times-Italic DefFont
295 % stack: -- |- boolean
298 {PLScounter 0 gt % or zebra
299 {/PLScounter PLScounter 1 sub def PLScounter 0 eq}
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
312 isLineStep % or line step
313 LineNumber Lines ge or % or last line
316 0.0 0.0 0.0 setrgbcolor
320 {LineNumber 6 string cvs( )strcat}ifelse
321 dup stringwidth pop neg 0 rmoveto
325 /LineNumber LineNumber 1 add def
329 % stack: color-specifier |- --
330 /SetColor{dup type/realtype eq{setgray}{aload pop setrgbcolor}ifelse}def
336 /double-zebra ZebraHeight ZebraHeight add def
337 /yiter double-zebra LineHeight mul neg def
338 /xiter PrintWidth InterColumn add def
339 /zebra-line PageNumber 1 sub NumberOfColumns mul LinesPerColumn mul def
340 NumberOfColumns{LinesPerColumn doColumnZebra xiter 0 rmoveto}repeat
344 % stack: lines-per-column |- --
349 /H ZebraHeight zebra-line ZebraHeight mod 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
355 {H}ifelse % "white" stripe
356 LineHeight mul neg 0 exch rmoveto
357 /zebra-line zebra-line LinesPerColumn add def
359 lpc dup double-zebra idiv{ZebraHeight doZebra 0 yiter rmoveto}repeat
361 dup 0 le{pop}{dup ZebraHeight gt{pop ZebraHeight}if doZebra}ifelse
365 % stack: zebra-height (in lines) |- --
367 /zh exch 0.05 sub LineHeight mul def
369 0 LineHeight 0.65 mul rmoveto
372 PrintWidth neg 0 rlineto
380 /BackgroundColor where{
381 pop gsave BackgroundColor SetColor
384 0 LineHeight 0.65 mul rmoveto
386 0 PrintHeight neg rlineto
387 PrintWidth neg 0 rlineto
388 0 PrintHeight rlineto
391 PrintWidth InterColumn add 0 rmoveto
397 % tx ty rotation xscale yscale xpos ypos BeginBackImage
399 /-save-image- save def
407 /EndBackImage{-save-image- restore}def
409 % string fontsize fontname rotation gray xpos ypos ShowBackText
415 findfont exch dup/-offset- exch -0.25 mul def scalefont setfont
417 /-saveLineThickness- LineThickness def
420 /LineThickness -saveLineThickness- def
425 BMark/PageSize[PageWidth LandscapePageHeight LandscapeMode{exch}if]EMark setpagedevice
429 % ---- Remember space width of the normal text font `f0'.
430 /SpaceWidth/f0 findfont setfont( )stringwidth pop def
431 % ---- save the state of the document (useful for ghostscript!)
433 % ---- [andrewi] set PageSize based on chosen dimensions
435 WarnPaperSize{SetPageSize}{mark{SetPageSize}stopped cleartomark}ifelse
437 /ColumnWidth PrintWidth InterColumn add def
438 % ---- define where printing will start
439 /f0 F % this installs Ascent
440 /PrintStartY PrintHeight Ascent sub def
442 /N-Up-Counter N-Up-End 1 sub def
443 /PLScounter PrintLineStart def
447 % ---- restore the state of the document (useful for ghostscript!)
452 % ---- when 1st column, save the state of the page
453 ColumnIndex 1 eq{/pageState save def}if
454 % ---- save the state of the column
455 /columnState save def
458 /PrintHeaderWidth PrintOnlyOneHeader{PrintPageWidth}{PrintWidth}ifelse def
461 % ---- when 1st column, print all background effects
463 0 PrintStartY moveto % move to where printing will start
466 printGlobalBackground
470 PrintOnlyOneHeader{ColumnIndex 1 eq}{true}ifelse{
471 PrintHeaderFrame{HeaderFrame}if
475 0 PrintStartY moveto % move to where printing will start
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
486 /EndPage{bg{eolbg}if}def
489 ColumnIndex NumberOfColumns eq{
490 % ---- restore the state of the page
496 {% ---- Next page on same row
497 /N-Up-Counter N-Up-Counter 1 sub def
498 N-Up-XColumn N-Up-YColumn}
499 {% ---- Next page on next line
500 /N-Up-Counter N-Up-End 1 sub def
501 N-Up-XLine N-Up-YLine}ifelse
505 % ---- restore the state of the current column
507 % ---- and translate to the next column
508 ColumnWidth 0 translate
509 /ColumnIndex ColumnIndex 1 add def
513 % stack: number-of-pages-per-sheet |- --
516 /pages-per-sheet exch def
518 % ---- translate to bottom-right corner of Portrait page
520 LandscapePageHeight 0 translate
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
530 PageWidth 0 translate
533 N-Up-Margin dup translate
537 /WW LandscapePageHeight def
539 /HH LandscapePageHeight def
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
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
552 WW N-Up-Margin sub N-Up-Margin sub
555 {N-Up-Columns N-Up-Missing add div WW}ifelse
557 LandscapeMode{/yy 0 def}{/yy xx def/xx 0 def}ifelse
558 xx N-Up-Repeat 1 sub LandscapePageHeight mul yy add translate
559 % ---- go to start position in page matrix
560 N-Up-XStart N-Up-Missing 0.5 mul
562 {LandscapePageHeight mul N-Up-YStart add}
563 {PageWidth mul add N-Up-YStart}ifelse
566 % ---- translate to lower left corner of TEXT
567 LeftMargin BottomMargin translate
570 N-Up 1 gt N-Up-Border and pages-per-sheet 0 gt and{
574 LeftMargin neg BottomMargin neg moveto
579 0 LandscapePageHeight rlineto
580 PageWidth neg 0 rlineto
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
587 pages-per-sheet 0 le{exit}if
588 N-Up-XLine N-Up-XColumn sub N-Up-YLine rmoveto
599 /SetHeaderLines{ % nb-lines --
600 /HeaderLines exch def
603 HeaderLines 1 sub HeaderLineHeight mul add
604 HeaderTitleLineHeight add
606 /HeaderHeight exch def
613 % |-+-------| <-- (x y)
617 % |-+-------| <-- (0 0)
622 /HeaderFrameStart{0 PrintHeight HeaderOffset add}def
625 PrintHeaderWidth 0 rlineto
626 0 HeaderHeight rlineto
627 PrintHeaderWidth neg 0 rlineto
628 0 HeaderHeight neg rlineto
634 % ---- fill a black rectangle (the shadow of the next one)
635 HeaderFrameStart moveto
639 % ---- do the next rectangle ...
640 HeaderFrameStart moveto
642 gsave 0.9 setgray fill grestore % filled with grey
643 gsave 0 setgray stroke grestore % drawn with black
649 exch HeaderPad add exch % horizontal pad
651 HeaderPad add % vertical pad
653 HeaderLineHeight HeaderLines 1 sub mul add
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
663 PageNumber 32 string cvs
664 ShowNofN{(/)strcat PageCount 32 string cvs strcat}if
670 HeaderLinesRight HeaderLinesLeft % -- rightLines leftLines
672 % ---- hack: `PN 1 and' == `PN 2 modulo'
674 % ---- if even page number and duplex, then exchange left and right
675 PageNumber 1 and 0 eq SwitchHeader and{exch}if
677 { % ---- process the left lines
684 0 HeaderLineHeight neg rmoveto
689 { % ---- process the right lines
695 PrintHeaderWidth exch sub HeaderPad 2 mul sub 0 rmoveto
698 0 HeaderLineHeight neg rmoveto
707 /sw( )stringwidth pop def
708 /aw(01234567890abcdefghijklmnopqrstuvwxyz)dup length exch
709 stringwidth pop exch div def
710 /t1 12/Helvetica-Oblique DefFont
713 (languagelevel = )show
714 languagelevel 32 string cvs show
716 0 FontHeight neg rmoveto
722 ( point, the line height is )show
723 lh 32 string cvs show
724 (, the space width is )show
725 sw 32 string cvs show
728 0 FontHeight neg rmoveto
730 (and a crude estimate of average character width is )show
731 aw 32 string cvs show
734 0 FontHeight neg rmoveto
738 /cm{72 mul 2.54 div}def
741 % key = font name value = font dictionary
742 FontDirectory{pop 10 exch ReportFontInfo}forall
745 % 3 cm 20 cm moveto 10/Courier ReportFontInfo showpage
746 % 3 cm 20 cm moveto ReportAllFontInfo showpage
748 % === END ps-print prologue 1