1 % === BEGIN ps-print prologue 1
3 % ISOLatin1Encoding stolen from ps_init.ps in GhostScript 2.6.1.4:
4 /ISOLatin1Encoding where {pop}{
5 % -- The ISO Latin-1 encoding vector isn't known, so define it.
6 % -- The first half is the same as the standard encoding,
7 % -- except for minus instead of hyphen at code 055.
9 StandardEncoding 0 45 getinterval aload pop
11 StandardEncoding 46 82 getinterval aload pop
12 %*** NOTE: the following are missing in the Adobe documentation,
13 %*** but appear in the displayed table:
14 %*** macron at 0225, dieresis at 0230, cedilla at 0233, space at 0240.
16 /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
17 /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
18 /dotlessi /grave /acute /circumflex /tilde /macron /breve /dotaccent
19 /dieresis /.notdef /ring /cedilla /.notdef /hungarumlaut /ogonek /caron
21 /space /exclamdown /cent /sterling
22 /currency /yen /brokenbar /section
23 /dieresis /copyright /ordfeminine /guillemotleft
24 /logicalnot /hyphen /registered /macron
25 /degree /plusminus /twosuperior /threesuperior
26 /acute /mu /paragraph /periodcentered
27 /cedilla /onesuperior /ordmasculine /guillemotright
28 /onequarter /onehalf /threequarters /questiondown
30 /Agrave /Aacute /Acircumflex /Atilde
31 /Adieresis /Aring /AE /Ccedilla
32 /Egrave /Eacute /Ecircumflex /Edieresis
33 /Igrave /Iacute /Icircumflex /Idieresis
34 /Eth /Ntilde /Ograve /Oacute
35 /Ocircumflex /Otilde /Odieresis /multiply
36 /Oslash /Ugrave /Uacute /Ucircumflex
37 /Udieresis /Yacute /Thorn /germandbls
39 /agrave /aacute /acircumflex /atilde
40 /adieresis /aring /ae /ccedilla
41 /egrave /eacute /ecircumflex /edieresis
42 /igrave /iacute /icircumflex /idieresis
43 /eth /ntilde /ograve /oacute
44 /ocircumflex /otilde /odieresis /divide
45 /oslash /ugrave /uacute /ucircumflex
46 /udieresis /yacute /thorn /ydieresis
50 /reencodeFontISO{ %def
52 length 12 add dict % Make a new font (a new dict the same size
53 % as the old one) with room for our new symbols.
55 begin % Make the new font the current dictionary.
60 }forall % Copy each of the symbols from the old dictionary
61 % to the new one except for the font ID.
63 currentdict /FontType get 0 ne{
64 /Encoding ISOLatin1Encoding def % Override the encoding with
65 % the ISOLatin1 encoding.
68 % Use the font's bounding box to determine the ascent, descent,
69 % and overall height; don't forget that these values have to be
70 % transformed using the font's matrix.
77 % | | | | Ascent (usually > 0)
79 % (0 0) -> +--+----+-------->
81 % | | v Descent (usually < 0)
82 % (x1 y1) --> +----+ - -
84 currentdict /FontType get 0 ne{
85 /FontBBox load aload pop % -- x1 y1 x2 y2
86 FontMatrix transform /Ascent exch def pop
87 FontMatrix transform /Descent exch def pop
89 /PrimaryFont FDepVector 0 get def
90 PrimaryFont /FontBBox get aload pop
91 PrimaryFont /FontMatrix get transform /Ascent exch def pop
92 PrimaryFont /FontMatrix get transform /Descent exch def pop
95 /FontHeight Ascent Descent sub def % use `sub' because descent < 0
97 % Define these in case they're not in the FontInfo
98 % (also, here they're easier to get to).
99 /UnderlinePosition Descent 0.70 mul def
100 /OverlinePosition Descent UnderlinePosition sub Ascent add def
101 /StrikeoutPosition Ascent 0.30 mul def
102 /LineThickness FontHeight 0.05 mul def
103 /Xshadow FontHeight 0.08 mul def
104 /Yshadow FontHeight -0.09 mul def
105 /SpaceBackground Descent neg UnderlinePosition add def
106 /XBox Descent neg def
107 /YBox LineThickness 0.7 mul def
109 currentdict % Leave the new font on the stack
110 end % Stop using the font as the current dictionary.
111 definefont % Put the font into the font dictionary
112 pop % Discard the returned font.
115 /DefFont{ % Font definition
116 findfont exch scalefont reencodeFontISO
121 dup /Ascent get /Ascent exch def
122 dup /Descent get /Descent exch def
123 dup /FontHeight get /FontHeight exch def
124 dup /UnderlinePosition get /UnderlinePosition exch def
125 dup /OverlinePosition get /OverlinePosition exch def
126 dup /StrikeoutPosition get /StrikeoutPosition exch def
127 dup /LineThickness get /LineThickness exch def
128 dup /Xshadow get /Xshadow exch def
129 dup /Yshadow get /Yshadow exch def
130 dup /SpaceBackground get /SpaceBackground exch def
131 dup /XBox get /XBox exch def
132 dup /YBox get /YBox exch def
136 /FG /setrgbcolor load def
149 % | Ascent (usually > 0)
151 % | Descent (usually < 0)
155 /dobackground{ % width --
156 currentpoint % -- width x y
162 0 Descent Ascent sub rlineto % D
169 /eolbg{ % dobackground until right margin
170 PrintWidth % -- x-eol
171 currentpoint pop % -- cur-x
172 sub % -- width until eol
176 /PSL{bg{eolbg}if 0 currentpoint exch pop LineHeight sub moveto}def
177 /PLN{PrintLineNumber{doLineNumber}if}def
179 /SL{PSL isLineStep pop}def % Soft Linefeed
181 /HL{PSL PLN}def % Hard Linefeed
184 /dcp{currentpoint exch 40 string cvs print (, ) print =}def
185 /dp{print 2 copy exch 40 string cvs print (, ) print =}def
188 ( ) stringwidth % Get the width of a space in the current font.
189 pop % Discard the Y component.
190 mul % Multiply the width of a space
191 % by the number of spaces to plot
192 bg{dup dobackground}if
197 /EF{/Effect exch def}def
199 % stack: string |- --
200 % effect: 1 - underline 2 - strikeout 4 - overline
201 % 8 - shadow 16 - box 32 - outline
203 /xx currentpoint dup Descent add /yy exch def
204 Ascent add /YY exch def def
205 dup stringwidth pop xx add /XX exch def
207 /yy yy Yshadow add def
208 /XX XX Xshadow add def
213 {SpaceBackground doBox}
217 Effect 16 and 0 ne{false 0 doBox}if % box
218 Effect 8 and 0 ne{dup doShadow}if % shadow
220 {true doOutline} % outline
223 Effect 1 and 0 ne{UnderlinePosition Hline}if % underline
224 Effect 2 and 0 ne{StrikeoutPosition Hline}if % strikeout
225 Effect 4 and 0 ne{OverlinePosition Hline}if % overline
228 % stack: position |- --
230 currentpoint exch pop add dup
236 LineThickness setlinewidth stroke
240 % stack: fill-or-not delta |- --
243 xx XBox sub dd sub yy YBox sub dd sub
244 XX XBox add dd add YY YBox add dd add
248 % stack: fill-or-not lower-x lower-y upper-x upper-y |- --
261 % top of stack: fill-or-not
263 {LineThickness setlinewidth stroke}
268 % stack: string |- --
271 Xshadow Yshadow rmoveto
278 % stack: string fill-or-not |- --
281 /-ox- currentpoint /-oy- exch def def
283 LineThickness setlinewidth
286 -fillp- {gsave FillBgColor grestore}if
288 -oy- add /-oy- exch def
289 -ox- add /-ox- exch def
297 /FillBgColor{bgcolor aload pop setrgbcolor fill}bind def
299 /L0 6 /Times-Italic DefFont
301 % stack: -- |- boolean
304 {PLScounter 0 gt % or zebra
305 {/PLScounter PLScounter 1 sub def PLScounter 0 eq}
308 {/PrintLineStep PrintLineStep 1 sub def}
309 {/PrintLineStep ZebraHeight def
310 /PLScounter PrintLineStart def}ifelse}
311 {LineNumber PrintLineStart sub PrintLineStep mod 0 eq}ifelse % or line step
318 isLineStep % or line step
319 LineNumber Lines ge or % or last line
322 0.0 0.0 0.0 setrgbcolor
326 {LineNumber 6 string cvs ( ) strcat}ifelse
327 dup stringwidth pop neg 0 rmoveto
331 /LineNumber LineNumber 1 add def
335 % stack: color-specifier |- --
336 /SetColor{dup type /realtype eq{setgray}{aload pop setrgbcolor}ifelse}def
342 /double-zebra ZebraHeight ZebraHeight add def
343 /yiter double-zebra LineHeight mul neg def
344 /xiter PrintWidth InterColumn add def
345 NumberOfColumns{LinesPerColumn doColumnZebra xiter 0 rmoveto}repeat
349 % stack: lines-per-column |- --
352 dup double-zebra idiv{ZebraHeight doZebra 0 yiter rmoveto}repeat
354 dup 0 le{pop}{dup ZebraHeight gt {pop ZebraHeight}if doZebra}ifelse
358 % stack: zebra-height (in lines) |- --
360 /zh exch 0.05 sub LineHeight mul def
362 0 LineHeight 0.65 mul rmoveto
365 PrintWidth neg 0 rlineto
373 /BackgroundColor where{
374 pop gsave BackgroundColor SetColor
377 0 LineHeight 0.65 mul rmoveto
379 0 PrintHeight neg rlineto
380 PrintWidth neg 0 rlineto
381 0 PrintHeight rlineto
384 PrintWidth InterColumn add 0 rmoveto
390 % tx ty rotation xscale yscale xpos ypos BeginBackImage
392 /-save-image- save def
400 /EndBackImage{-save-image- restore}def
402 % string fontsize fontname rotation gray xpos ypos ShowBackText
408 findfont exch dup /-offset- exch -0.25 mul def scalefont setfont
410 /-saveLineThickness- LineThickness def
413 /LineThickness -saveLineThickness- def
418 % ---- Remember space width of the normal text font `f0'.
419 /SpaceWidth /f0 findfont setfont ( ) stringwidth pop def
420 % ---- save the state of the document (useful for ghostscript!)
422 % ---- [andrewi] set PageSize based on chosen dimensions
424 BMark/PageSize[PageWidth LandscapePageHeight LandscapeMode{exch}if]EMark setpagedevice
426 /ColumnWidth PrintWidth InterColumn add def
427 % ---- define where printing will start
428 /f0 F % this installs Ascent
429 /PrintStartY PrintHeight Ascent sub def
431 /N-Up-Counter N-Up-End 1 sub def
432 /PLScounter PrintLineStart def
436 % ---- restore the state of the document (useful for ghostscript!)
441 % ---- when 1st column, save the state of the page
445 % ---- save the state of the column
446 /columnState save def
449 /PrintHeaderWidth PrintOnlyOneHeader{PrintPageWidth}{PrintWidth}ifelse def
452 % ---- when 1st column, print all background effects
454 0 PrintStartY moveto % move to where printing will start
457 printGlobalBackground
461 PrintOnlyOneHeader{ColumnIndex 1 eq}{true}ifelse{
462 PrintHeaderFrame{HeaderFrame}if
466 0 PrintStartY moveto % move to where printing will start
470 /EndPage{bg{eolbg}if}def
473 ColumnIndex NumberOfColumns eq{
474 % ---- restore the state of the page
480 % ---- Next page on same row
481 /N-Up-Counter N-Up-Counter 1 sub def
482 N-Up-XColumn N-Up-YColumn
484 % ---- Next page on next line
485 /N-Up-Counter N-Up-End 1 sub def
486 N-Up-XLine N-Up-YLine
491 % ---- restore the state of the current column
493 % ---- and translate to the next column
494 ColumnWidth 0 translate
495 /ColumnIndex ColumnIndex 1 add def
499 % stack: number-of-pages-per-sheet |- --
502 /pages-per-sheet exch def
504 % ---- translate to bottom-right corner of Portrait page
506 LandscapePageHeight 0 translate
509 % ---- [jack] Kludge: my ghostscript window is 21x27.7 instead of 21x29.7
510 /JackGhostscript where{pop 1 27.7 29.7 div scale}if
511 UpsideDown{PageWidth LandscapePageHeight translate 180 rotate}if
516 PageWidth 0 translate
519 N-Up-Margin dup translate
523 /WW LandscapePageHeight def
525 /HH LandscapePageHeight def
528 WW N-Up-Margin sub N-Up-Margin sub
530 {N-Up-Lines div HH}{N-Up-Columns N-Up-Missing add div WW}ifelse
532 0 N-Up-Repeat 1 sub LandscapePageHeight mul translate
533 % ---- go to start position in page matrix
534 N-Up-XStart N-Up-Missing 0.5 mul
536 {LandscapePageHeight mul N-Up-YStart add}
537 {PageWidth mul add N-Up-YStart}ifelse
540 % ---- translate to lower left corner of TEXT
541 LeftMargin BottomMargin translate
544 N-Up 1 gt N-Up-Border and pages-per-sheet 0 gt and{
548 LeftMargin neg BottomMargin neg moveto
553 0 LandscapePageHeight rlineto
554 PageWidth neg 0 rlineto
557 /pages-per-sheet pages-per-sheet 1 sub def
558 pages-per-sheet 0 le{exit}if
559 N-Up-XColumn N-Up-YColumn rmoveto
561 pages-per-sheet 0 le{exit}if
562 N-Up-XLine N-Up-XColumn sub N-Up-YLine rmoveto
573 /SetHeaderLines{ % nb-lines --
574 /HeaderLines exch def
577 HeaderLines 1 sub HeaderLineHeight mul add
578 HeaderTitleLineHeight add
580 /HeaderHeight exch def
587 % |-+-------| <-- (x y)
591 % |-+-------| <-- (0 0)
595 /HeaderFrameStart{ % -- x y
596 0 PrintHeight HeaderOffset add
600 PrintHeaderWidth 0 rlineto
601 0 HeaderHeight rlineto
602 PrintHeaderWidth neg 0 rlineto
603 0 HeaderHeight neg rlineto
609 % ---- fill a black rectangle (the shadow of the next one)
610 HeaderFrameStart moveto
614 % ---- do the next rectangle ...
615 HeaderFrameStart moveto
617 gsave 0.9 setgray fill grestore % filled with grey
618 gsave 0 setgray stroke grestore % drawn with black
624 exch HeaderPad add exch % horizontal pad
626 HeaderPad add % vertical pad
628 HeaderLineHeight HeaderLines 1 sub mul add
632 dup length 3 -1 roll dup length dup 4 -1 roll add string dup
633 0 5 -1 roll putinterval
634 dup 4 2 roll exch putinterval
638 PageNumber 32 string cvs
641 PageCount 32 string cvs strcat
648 HeaderLinesRight HeaderLinesLeft % -- rightLines leftLines
650 % ---- hack: `PN 1 and' == `PN 2 modulo'
652 % ---- if even page number and duplex, then exchange left and right
653 PageNumber 1 and 0 eq DuplexValue and{exch}if
655 { % ---- process the left lines
662 0 HeaderLineHeight neg rmoveto
667 { % ---- process the right lines
673 PrintHeaderWidth exch sub HeaderPad 2 mul sub 0 rmoveto
676 0 HeaderLineHeight neg rmoveto
685 /sw ( ) stringwidth pop def
686 /aw (01234567890abcdefghijklmnopqrstuvwxyz) dup length exch
687 stringwidth pop exch div def
688 /t1 12 /Helvetica-Oblique DefFont
691 (languagelevel = ) show
692 languagelevel 32 string cvs show
694 0 FontHeight neg rmoveto
700 ( point, the line height is ) show
701 lh 32 string cvs show
702 (, the space width is ) show
703 sw 32 string cvs show
706 0 FontHeight neg rmoveto
708 (and a crude estimate of average character width is ) show
709 aw 32 string cvs show
712 0 FontHeight neg rmoveto
721 { % key = font name value = font dictionary
722 pop 10 exch ReportFontInfo
726 % 3 cm 20 cm moveto 10 /Courier ReportFontInfo showpage
727 % 3 cm 20 cm moveto ReportAllFontInfo showpage
729 % === END ps-print prologue 1