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 LinesPrinted def
338 NumberOfColumns
{LinesPerColumn doColumnZebra xiter
0 rmoveto
}repeat
342 % stack: lines-per-column |- --
346 ZebraFollow
1 and
0 ne
{
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
358 double
-zebra
mod dup 0 le
{pop}
359 {dup ZebraHeight gt ZebraFollow
2 and
0 ne or
{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 /LinesPrinted
exch def
460 % ---- when 1st column, print all background effects
462 0 PrintStartY moveto
% move to where printing will start
465 printGlobalBackground
469 PrintOnlyOneHeader
{ColumnIndex
1 eq
}{true}ifelse{
470 PrintHeaderFrame
{HeaderFrame
}if
474 0 PrintStartY moveto
% move to where printing will start
478 {/H PageNumber
1 sub NumberOfColumns
mul ColumnIndex
1 sub add
479 LinesPerColumn
mul ZebraHeight
mod def
480 /PLScounter H PrintLineStart ge
{0}{PrintLineStart H
sub}ifelse def
481 /PrintLineStep ZebraHeight H
sub def
}if}if
485 /EndPage
{bg
{eolbg
}if}def
488 ColumnIndex NumberOfColumns eq
{
489 % ---- restore the state of the page
495 {% ---- Next page on same row
496 /N
-Up
-Counter N
-Up
-Counter
1 sub def
497 N
-Up
-XColumn N
-Up
-YColumn
}
498 {% ---- Next page on next line
499 /N
-Up
-Counter N
-Up
-End
1 sub def
500 N
-Up
-XLine N
-Up
-YLine
}ifelse
504 % ---- restore the state of the current column
506 % ---- and translate to the next column
507 ColumnWidth
0 translate
508 /ColumnIndex ColumnIndex
1 add def
512 % stack: number-of-pages-per-sheet |- --
515 /pages
-per
-sheet
exch def
517 % ---- translate to bottom-right corner of Portrait page
519 LandscapePageHeight
0 translate
522 % ---- [jack] Kludge: my ghostscript window is 21x27.7 instead of 21x29.7
523 /JackGhostscript where
{pop 1 27.7 29.7 div scale
}if
524 UpsideDown
{PageWidth LandscapePageHeight translate
180 rotate
}if
529 PageWidth
0 translate
532 N
-Up
-Margin
dup translate
536 /WW LandscapePageHeight def
538 /HH LandscapePageHeight def
543 /ww WW WW
mul N
-Up
-Lines HH
mul div def
544 /cc HH N
-Up
-Columns N
-Up
-Missing add div def
545 ww cc gt
{/xx WW def
/WW cc ww div WW
mul def
/xx xx WW
sub def
}if
547 /hh HH N
-Up
-Columns N
-Up
-Missing add div def
548 /cc HH N
-Up
-Lines div def
549 hh cc gt
{/xx WW def
/WW cc hh div WW
mul def
/xx xx WW
sub def
}if
551 WW N
-Up
-Margin
sub N
-Up
-Margin
sub
554 {N
-Up
-Columns N
-Up
-Missing add div WW
}ifelse
556 LandscapeMode
{/yy
0 def
}{/yy xx def
/xx
0 def
}ifelse
557 xx N
-Up
-Repeat
1 sub LandscapePageHeight
mul yy add translate
558 % ---- go to start position in page matrix
559 N
-Up
-XStart N
-Up
-Missing
0.5 mul
561 {LandscapePageHeight
mul N
-Up
-YStart add
}
562 {PageWidth
mul add N
-Up
-YStart
}ifelse
565 % ---- translate to lower left corner of TEXT
566 LeftMargin BottomMargin translate
569 N
-Up
1 gt N
-Up
-Border and pages
-per
-sheet
0 gt and
{
573 LeftMargin neg BottomMargin neg moveto
578 0 LandscapePageHeight rlineto
579 PageWidth neg
0 rlineto
582 /pages
-per
-sheet pages
-per
-sheet
1 sub def
583 pages
-per
-sheet
0 le
{exit}if
584 N
-Up
-XColumn N
-Up
-YColumn rmoveto
586 pages
-per
-sheet
0 le
{exit}if
587 N
-Up
-XLine N
-Up
-XColumn
sub N
-Up
-YLine rmoveto
598 /SetHeaderLines
{ % nb-lines --
599 /HeaderLines
exch def
602 HeaderLines
1 sub HeaderLineHeight
mul add
603 HeaderTitleLineHeight add
605 /HeaderHeight
exch def
612 % |-+-------| <-- (x y)
616 % |-+-------| <-- (0 0)
621 /HeaderFrameStart
{0 PrintHeight HeaderOffset add
}def
624 PrintHeaderWidth
0 rlineto
625 0 HeaderHeight rlineto
626 PrintHeaderWidth neg
0 rlineto
627 0 HeaderHeight neg rlineto
633 % ---- fill a black rectangle (the shadow of the next one)
634 HeaderFrameStart moveto
638 % ---- do the next rectangle ...
639 HeaderFrameStart moveto
641 gsave
0.9 setgray fill grestore
% filled with grey
642 gsave
0 setgray stroke grestore
% drawn with black
648 exch HeaderPad add
exch % horizontal pad
650 HeaderPad add
% vertical pad
652 HeaderLineHeight HeaderLines
1 sub mul add
656 dup length
3 -1 roll dup length
dup 4 -1 roll add string
dup
657 0 5 -1 roll putinterval
658 dup 4 2 roll exch putinterval
662 PageNumber
32 string cvs
663 ShowNofN
{(/)strcat PageCount
32 string cvs strcat
}if
669 HeaderLinesRight HeaderLinesLeft
% -- rightLines leftLines
671 % ---- hack: `PN 1 and' == `PN 2 modulo'
673 % ---- if even page number and duplex, then exchange left and right
674 PageNumber
1 and
0 eq SwitchHeader and
{exch}if
676 { % ---- process the left lines
683 0 HeaderLineHeight neg rmoveto
688 { % ---- process the right lines
694 PrintHeaderWidth
exch sub HeaderPad
2 mul sub 0 rmoveto
697 0 HeaderLineHeight neg rmoveto
706 /sw
( )stringwidth
pop def
707 /aw
(01234567890abcdefghijklmnopqrstuvwxyz
)dup length
exch
708 stringwidth
pop exch div def
709 /t1
12/Helvetica
-Oblique DefFont
712 (languagelevel
= )show
713 languagelevel
32 string cvs show
715 0 FontHeight neg rmoveto
721 ( point
, the line height is
)show
722 lh
32 string cvs show
723 (, the space width is
)show
724 sw
32 string cvs show
727 0 FontHeight neg rmoveto
729 (and a crude estimate of average character width is
)show
730 aw
32 string cvs show
733 0 FontHeight neg rmoveto
737 /cm
{72 mul 2.54 div
}def
740 % key = font name value = font dictionary
741 FontDirectory
{pop 10 exch ReportFontInfo
}forall
744 % 3 cm 20 cm moveto 10/Courier ReportFontInfo showpage
745 % 3 cm 20 cm moveto ReportAllFontInfo showpage
747 % === END ps-print prologue 1