X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/48441121b2aa1e626c7423b6fc6f4d37973e6a4e..cfc335593c77ba2e41370fb34ff3dbd45be16175:/etc/ps-prin1.ps diff --git a/etc/ps-prin1.ps b/etc/ps-prin1.ps index e3401b1d2b..32e2529f57 100644 --- a/etc/ps-prin1.ps +++ b/etc/ps-prin1.ps @@ -1,7 +1,27 @@ % === BEGIN ps-print prologue 1 +% version: 6.0 + +% Copyright (C) 2000, 2001 Free Software Foundation, Inc. +% +% This file is part of GNU Emacs. +% +% GNU Emacs is free software; you can redistribute it and/or modify +% it under the terms of the GNU General Public License as published by +% the Free Software Foundation; either version 2, or (at your option) +% any later version. +% +% GNU Emacs is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with GNU Emacs; see the file COPYING. If not, write to the +% Free Software Foundation, Inc., 59 Temple Place - Suite 330, +% Boston, MA 02111-1307, USA. % ISOLatin1Encoding stolen from ps_init.ps in GhostScript 2.6.1.4: -/ISOLatin1Encoding where {pop}{ +/ISOLatin1Encoding where{pop}{ % -- The ISO Latin-1 encoding vector isn't known, so define it. % -- The first half is the same as the standard encoding, % -- except for minus instead of hyphen at code 055. @@ -13,37 +33,37 @@ StandardEncoding 46 82 getinterval aload pop %*** but appear in the displayed table: %*** macron at 0225, dieresis at 0230, cedilla at 0233, space at 0240. % 0200 (128) - /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef - /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef - /dotlessi /grave /acute /circumflex /tilde /macron /breve /dotaccent - /dieresis /.notdef /ring /cedilla /.notdef /hungarumlaut /ogonek /caron + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /dotlessi/grave/acute/circumflex/tilde/macron/breve/dotaccent + /dieresis/.notdef/ring/cedilla/.notdef/hungarumlaut/ogonek/caron % 0240 (160) - /space /exclamdown /cent /sterling - /currency /yen /brokenbar /section - /dieresis /copyright /ordfeminine /guillemotleft - /logicalnot /hyphen /registered /macron - /degree /plusminus /twosuperior /threesuperior - /acute /mu /paragraph /periodcentered - /cedilla /onesuperior /ordmasculine /guillemotright - /onequarter /onehalf /threequarters /questiondown + /space/exclamdown/cent/sterling + /currency/yen/brokenbar/section + /dieresis/copyright/ordfeminine/guillemotleft + /logicalnot/hyphen/registered/macron + /degree/plusminus/twosuperior/threesuperior + /acute/mu/paragraph/periodcentered + /cedilla/onesuperior/ordmasculine/guillemotright + /onequarter/onehalf/threequarters/questiondown % 0300 (192) - /Agrave /Aacute /Acircumflex /Atilde - /Adieresis /Aring /AE /Ccedilla - /Egrave /Eacute /Ecircumflex /Edieresis - /Igrave /Iacute /Icircumflex /Idieresis - /Eth /Ntilde /Ograve /Oacute - /Ocircumflex /Otilde /Odieresis /multiply - /Oslash /Ugrave /Uacute /Ucircumflex - /Udieresis /Yacute /Thorn /germandbls + /Agrave/Aacute/Acircumflex/Atilde + /Adieresis/Aring/AE/Ccedilla + /Egrave/Eacute/Ecircumflex/Edieresis + /Igrave/Iacute/Icircumflex/Idieresis + /Eth/Ntilde/Ograve/Oacute + /Ocircumflex/Otilde/Odieresis/multiply + /Oslash/Ugrave/Uacute/Ucircumflex + /Udieresis/Yacute/Thorn/germandbls % 0340 (224) - /agrave /aacute /acircumflex /atilde - /adieresis /aring /ae /ccedilla - /egrave /eacute /ecircumflex /edieresis - /igrave /iacute /icircumflex /idieresis - /eth /ntilde /ograve /oacute - /ocircumflex /otilde /odieresis /divide - /oslash /ugrave /uacute /ucircumflex - /udieresis /yacute /thorn /ydieresis + /agrave/aacute/acircumflex/atilde + /adieresis/aring/ae/ccedilla + /egrave/eacute/ecircumflex/edieresis + /igrave/iacute/icircumflex/idieresis + /eth/ntilde/ograve/oacute + /ocircumflex/otilde/odieresis/divide + /oslash/ugrave/uacute/ucircumflex + /udieresis/yacute/thorn/ydieresis 256 packedarray def }ifelse @@ -54,16 +74,12 @@ StandardEncoding 46 82 getinterval aload pop begin % Make the new font the current dictionary. + % Copy each of the symbols from the old dictionary + % to the new one except for the font ID. + {1 index/FID ne{def}{pop pop}ifelse}forall - {1 index /FID ne - {def}{pop pop}ifelse - }forall % Copy each of the symbols from the old dictionary - % to the new one except for the font ID. - - currentdict /FontType get 0 ne{ - /Encoding ISOLatin1Encoding def % Override the encoding with - % the ISOLatin1 encoding. - }if + % Override the encoding with the ISOLatin1 encoding. + currentdict/FontType get 0 ne{/Encoding ISOLatin1Encoding def}if % Use the font's bounding box to determine the ascent, descent, % and overall height; don't forget that these values have to be @@ -81,16 +97,14 @@ StandardEncoding 46 82 getinterval aload pop % | | v Descent (usually < 0) % (x1 y1) --> +----+ - - - currentdict /FontType get 0 ne{ - /FontBBox load aload pop % -- x1 y1 x2 y2 - FontMatrix transform /Ascent exch def pop - FontMatrix transform /Descent exch def pop - }{ - /PrimaryFont FDepVector 0 get def - PrimaryFont /FontBBox get aload pop - PrimaryFont /FontMatrix get transform /Ascent exch def pop - PrimaryFont /FontMatrix get transform /Descent exch def pop - }ifelse + currentdict/FontType get 0 ne + {/FontBBox load aload pop % -- x1 y1 x2 y2 + FontMatrix transform/Ascent exch def pop + FontMatrix transform/Descent exch def pop} + {/PrimaryFont FDepVector 0 get def + PrimaryFont/FontBBox get aload pop + PrimaryFont/FontMatrix get transform/Ascent exch def pop + PrimaryFont/FontMatrix get transform/Descent exch def pop}ifelse /FontHeight Ascent Descent sub def % use `sub' because descent < 0 @@ -112,34 +126,34 @@ StandardEncoding 46 82 getinterval aload pop pop % Discard the returned font. }bind def -/DefFont{ % Font definition - findfont exch scalefont reencodeFontISO -}def +% Font definition +/DefFont{findfont exch scalefont reencodeFontISO}def -/F{ % Font selection +% Font selection +/F{ findfont - dup /Ascent get /Ascent exch def - dup /Descent get /Descent exch def - dup /FontHeight get /FontHeight exch def - dup /UnderlinePosition get /UnderlinePosition exch def - dup /OverlinePosition get /OverlinePosition exch def - dup /StrikeoutPosition get /StrikeoutPosition exch def - dup /LineThickness get /LineThickness exch def - dup /Xshadow get /Xshadow exch def - dup /Yshadow get /Yshadow exch def - dup /SpaceBackground get /SpaceBackground exch def - dup /XBox get /XBox exch def - dup /YBox get /YBox exch def + dup/Ascent get/Ascent exch def + dup/Descent get/Descent exch def + dup/FontHeight get/FontHeight exch def + dup/UnderlinePosition get/UnderlinePosition exch def + dup/OverlinePosition get/OverlinePosition exch def + dup/StrikeoutPosition get/StrikeoutPosition exch def + dup/LineThickness get/LineThickness exch def + dup/Xshadow get/Xshadow exch def + dup/Yshadow get/Yshadow exch def + dup/SpaceBackground get/SpaceBackground exch def + dup/XBox get/XBox exch def + dup/YBox get/YBox exch def setfont }def -/FG /setrgbcolor load def +/FG/setrgbcolor load def /bg false def /BG{ - dup /bg exch def - {mark 4 1 roll ]} - {[ 1.0 1.0 1.0 ]} + dup/bg exch def + {[4 1 roll]} + {[1.0 1.0 1.0]} ifelse /bgcolor exch def }def @@ -162,8 +176,7 @@ StandardEncoding 46 82 getinterval aload pop 0 Descent Ascent sub rlineto % D neg 0 rlineto % E closepath - bgcolor aload pop setrgbcolor - fill + FillBgColor grestore }def @@ -174,21 +187,22 @@ StandardEncoding 46 82 getinterval aload pop dobackground }def +/LineHS LineHeight LineSpacing add def +/ParagraphHS LineHeight ParagraphSpacing add def +/PSL{/h exch def bg{eolbg}if 0 currentpoint exch pop h sub moveto}def /PLN{PrintLineNumber{doLineNumber}if}def -/SL{ % Soft Linefeed - bg{eolbg}if - 0 currentpoint exch pop LineHeight sub moveto -}def +/SL{LineHS PSL isLineStep pop}def % Soft Linefeed -/HL{SL PLN}def % Hard Linefeed +/PHL{ParagraphHS PSL PLN}def % Paragraph Hard Linefeed +/LHL{LineHS PSL PLN}def % Hard Linefeed % Some debug -/dcp{currentpoint exch 40 string cvs print (, ) print =}def -/dp{print 2 copy exch 40 string cvs print (, ) print =}def +/dcp{currentpoint exch 40 string cvs print(, )print =}def +/dp{print 2 copy exch 40 string cvs print(, )print =}def /W{ - ( ) stringwidth % Get the width of a space in the current font. + ( )stringwidth % Get the width of a space in the current font. pop % Discard the Y component. mul % Multiply the width of a space % by the number of spaces to plot @@ -196,36 +210,51 @@ StandardEncoding 46 82 getinterval aload pop 0 rmoveto }def -/Effect 0 def -/EF{/Effect exch def}def +/Effect 0 def +/EffectUnderline false def +/EffectStrikeout false def +/EffectOverline false def +/EffectShadow false def +/EffectBox false def +/EffectOutline false def -% stack: string |- -- % effect: 1 - underline 2 - strikeout 4 - overline % 8 - shadow 16 - box 32 - outline +/EF{ + /Effect exch def + /EffectUnderline Effect 1 and 0 ne def + /EffectStrikeout Effect 2 and 0 ne def + /EffectOverline Effect 4 and 0 ne def + /EffectShadow Effect 8 and 0 ne def + /EffectBox Effect 16 and 0 ne def + /EffectOutline Effect 32 and 0 ne def +}def + +% stack: string |- -- /S{ - /xx currentpoint dup Descent add /yy exch def - Ascent add /YY exch def def - dup stringwidth pop xx add /XX exch def - Effect 8 and 0 ne{ + /xx currentpoint dup Descent add/yy exch def + Ascent add/YY exch def def + dup stringwidth pop xx add/XX exch def + EffectShadow{ /yy yy Yshadow add def /XX XX Xshadow add def }if bg{ true - Effect 16 and 0 ne + EffectBox {SpaceBackground doBox} {xx yy XX YY doRect} ifelse }if % background - Effect 16 and 0 ne{false 0 doBox}if % box - Effect 8 and 0 ne{dup doShadow}if % shadow - Effect 32 and 0 ne + EffectBox {false 0 doBox}if % box + EffectShadow {dup doShadow}if % shadow + EffectOutline {true doOutline} % outline {show} % normal text ifelse - Effect 1 and 0 ne{UnderlinePosition Hline}if % underline - Effect 2 and 0 ne{StrikeoutPosition Hline}if % strikeout - Effect 4 and 0 ne{OverlinePosition Hline}if % overline + EffectUnderline{UnderlinePosition Hline}if % underline + EffectStrikeout{StrikeoutPosition Hline}if % strikeout + EffectOverline {OverlinePosition Hline}if % overline }bind def % stack: position |- -- @@ -262,9 +291,8 @@ StandardEncoding 46 82 getinterval aload pop rXX ryy lineto closepath % top of stack: fill-or-not - {FillBgColor} - {LineThickness setlinewidth stroke} - ifelse + {FillBgColor} + {LineThickness setlinewidth stroke}ifelse grestore }bind def @@ -281,15 +309,15 @@ StandardEncoding 46 82 getinterval aload pop % stack: string fill-or-not |- -- /doOutline{ /-fillp- exch def - /-ox- currentpoint /-oy- exch def def + /-ox- currentpoint/-oy- exch def def gsave LineThickness setlinewidth {st 0 3 -1 roll put st dup true charpath -fillp- {gsave FillBgColor grestore}if stroke stringwidth - -oy- add /-oy- exch def - -ox- add /-ox- exch def + -oy- add/-oy- exch def + -ox- add/-ox- exch def -ox- -oy- moveto }forall grestore @@ -299,52 +327,84 @@ StandardEncoding 46 82 getinterval aload pop % stack: -- /FillBgColor{bgcolor aload pop setrgbcolor fill}bind def -/L0 6 /Times-Italic DefFont +% stack: -- |- boolean +/isLineStep{ + SyncLineZebra + {PLScounter 0 gt % or zebra + {/PLScounter PLScounter 1 sub def PLScounter 0 eq} + {false}ifelse + PrintLineStep 1 gt + {/PrintLineStep PrintLineStep 1 sub def} + {/PrintLineStep ZebraHeight def + /PLScounter PrintLineStart def}ifelse} + {LineNumber PrintLineStart sub PrintLineStep mod 0 eq}ifelse % or line step +}def % stack: -- /doLineNumber{ /LineNumber where - { - pop - currentfont + {pop + isLineStep % or line step + LineNumber Lines ge or % or last line + {currentfont gsave - 0.0 0.0 0.0 setrgbcolor + LineNumberColor SetColor /L0 findfont setfont LineNumber Lines ge - {(end )} - {LineNumber 6 string cvs ( ) strcat} - ifelse + {(end )} + {LineNumber 6 string cvs( )strcat}ifelse dup stringwidth pop neg 0 rmoveto show grestore - setfont + setfont}if /LineNumber LineNumber 1 add def }if }def +% stack: color-specifier |- -- +/SetColor{dup type/realtype eq{setgray}{aload pop setrgbcolor}ifelse}def + % stack: -- /printZebra{ gsave - ZebraGray setgray + ZebraColor SetColor /double-zebra ZebraHeight ZebraHeight add def - /yiter double-zebra LineHeight mul neg def + /yiter double-zebra LineHS mul neg def /xiter PrintWidth InterColumn add def + /zebra-line LinesPrinted def NumberOfColumns{LinesPerColumn doColumnZebra xiter 0 rmoveto}repeat grestore }def % stack: lines-per-column |- -- /doColumnZebra{ + /lpc exch def gsave - dup double-zebra idiv{ZebraHeight doZebra 0 yiter rmoveto}repeat - double-zebra mod - dup 0 le{pop}{dup ZebraHeight gt {pop ZebraHeight}if doZebra}ifelse + ZebraFollow 1 and 0 ne{ + /H ZebraHeight zebra-line ZebraHeight mod sub def + /lpc lpc H sub def + zebra-line double-zebra mod ZebraHeight lt + {H doZebra % "black" stripe followed by a "white" stripe + /lpc lpc ZebraHeight sub def + H ZebraHeight add} + {H}ifelse % "white" stripe + LineHS mul neg 0 exch rmoveto + /zebra-line zebra-line LinesPerColumn add def + }if + /zspacing 0 def + lpc dup double-zebra idiv{ZebraHeight doZebra 0 yiter rmoveto}repeat + double-zebra mod dup 0 le{pop} + {dup ZebraHeight gt + {pop ZebraHeight} + {/zspacing LineSpacing def + ZebraFollow 2 and 0 ne{pop ZebraHeight}if}ifelse + doZebra}ifelse grestore }def % stack: zebra-height (in lines) |- -- /doZebra{ - /zh exch 0.05 sub LineHeight mul def + /zh exch 0.05 sub LineHS mul zspacing sub def gsave 0 LineHeight 0.65 mul rmoveto PrintWidth 0 rlineto @@ -355,6 +415,25 @@ StandardEncoding 46 82 getinterval aload pop grestore }def +% stack: -- +/printBackground{ + /BackgroundColor where{ + pop gsave BackgroundColor SetColor + NumberOfColumns{ + gsave + 0 LineHeight 0.65 mul rmoveto + PrintWidth 0 rlineto + 0 PrintHeight neg rlineto + PrintWidth neg 0 rlineto + 0 PrintHeight rlineto + fill + grestore + PrintWidth InterColumn add 0 rmoveto + }repeat + grestore + }if +}def + % tx ty rotation xscale yscale xpos ypos BeginBackImage /BeginBackImage{ /-save-image- save def @@ -373,7 +452,7 @@ StandardEncoding 46 82 getinterval aload pop translate setgray rotate - findfont exch dup /-offset- exch -0.25 mul def scalefont setfont + findfont exch dup/-offset- exch -0.25 mul def scalefont setfont 0 -offset- moveto /-saveLineThickness- LineThickness def /LineThickness 1 def @@ -382,64 +461,26 @@ StandardEncoding 46 82 getinterval aload pop grestore }def +/SetPageSize{ + BMark/PageSize[PageWidth LandscapePageHeight LandscapeMode{exch}if]EMark setpagedevice +}def + /BeginDoc{ % ---- Remember space width of the normal text font `f0'. - /SpaceWidth /f0 findfont setfont ( ) stringwidth pop def + /SpaceWidth/f0 findfont setfont( )stringwidth pop def % ---- save the state of the document (useful for ghostscript!) /docState save def % ---- [andrewi] set PageSize based on chosen dimensions UseSetpagedevice{ - 0 - {<< /PageSize [PageWidth LandscapePageHeight] >> setpagedevice} - CheckConfig - }{ - LandscapeMode{ - % ---- translate to bottom-right corner of Portrait page - LandscapePageHeight 0 translate - 90 rotate - }if - }ifelse - % ---- [jack] Kludge: my ghostscript window is 21x27.7 instead of 21x29.7 - /JackGhostscript where{pop 1 27.7 29.7 div scale}if - % ---- N-Up printing - N-Up 1 gt{ - % ---- landscape - N-Up-Landscape{ - PageWidth 0 translate - 90 rotate - }if - N-Up-Margin dup translate - % ---- scale - LandscapeMode{ - /HH PageWidth def - /WW LandscapePageHeight def - }{ - /HH LandscapePageHeight def - /WW PageWidth def - }ifelse - WW N-Up-Margin sub N-Up-Margin sub - N-Up-Landscape - {N-Up-Lines div HH}{N-Up-Columns N-Up-Missing add div WW}ifelse - div dup scale - 0 N-Up-Repeat 1 sub LandscapePageHeight mul translate - % ---- go to start position in page matrix - N-Up-XStart N-Up-Missing 0.5 mul - LandscapeMode{ - LandscapePageHeight mul N-Up-YStart add - }{ - PageWidth mul add N-Up-YStart - }ifelse - translate + WarnPaperSize{SetPageSize}{mark{SetPageSize}stopped cleartomark}ifelse }if /ColumnWidth PrintWidth InterColumn add def - % ---- translate to lower left corner of TEXT - LeftMargin BottomMargin translate % ---- define where printing will start /f0 F % this installs Ascent /PrintStartY PrintHeight Ascent sub def /ColumnIndex 1 def /N-Up-Counter N-Up-End 1 sub def - SkipFirstPage{save showpage restore}if + /PLScounter PrintLineStart def }def /EndDoc{ @@ -449,9 +490,7 @@ StandardEncoding 46 82 getinterval aload pop /BeginDSCPage{ % ---- when 1st column, save the state of the page - ColumnIndex 1 eq{ - /pageState save def - }if + ColumnIndex 1 eq{/pageState save def}if % ---- save the state of the column /columnState save def }def @@ -459,20 +498,32 @@ StandardEncoding 46 82 getinterval aload pop /PrintHeaderWidth PrintOnlyOneHeader{PrintPageWidth}{PrintWidth}ifelse def /BeginPage{ + /LinesPrinted exch def % ---- when 1st column, print all background effects ColumnIndex 1 eq{ 0 PrintStartY moveto % move to where printing will start - Zebra {printZebra}if + printBackground + Zebra{printZebra}if printGlobalBackground printLocalBackground }if - PrintHeader{ - PrintOnlyOneHeader{ColumnIndex 1 eq}{true}ifelse{ - PrintHeaderFrame{HeaderFrame}if - HeaderText - }if + PrintOnlyOneHeader{ColumnIndex 1 eq}{true}ifelse + dup PrintHeader and{ + PrintHeaderFrame{HeaderFrame}if + HeaderText + }if + PrintFooter and{ + PrintFooterFrame{FooterFrame}if + FooterText }if 0 PrintStartY moveto % move to where printing will start + /LineNumber where + {pop + SyncLineZebra + {/H PageNumber 1 sub NumberOfColumns mul ColumnIndex 1 sub add + LinesPerColumn mul ZebraHeight mod def + /PLScounter H PrintLineStart ge{0}{PrintLineStart H sub}ifelse def + /PrintLineStep ZebraHeight H sub def}if}if PLN }def @@ -485,15 +536,13 @@ StandardEncoding 46 82 getinterval aload pop /ColumnIndex 1 def % ---- N-up printing N-Up 1 gt{ - N-Up-Counter 0 gt{ - % ---- Next page on same row + N-Up-Counter 0 gt + {% ---- Next page on same row /N-Up-Counter N-Up-Counter 1 sub def - N-Up-XColumn N-Up-YColumn - }{ - % ---- Next page on next line + N-Up-XColumn N-Up-YColumn} + {% ---- Next page on next line /N-Up-Counter N-Up-End 1 sub def - N-Up-XLine N-Up-YLine - }ifelse + N-Up-XLine N-Up-YLine}ifelse translate }if }{ % else @@ -505,16 +554,77 @@ StandardEncoding 46 82 getinterval aload pop }ifelse }def +/TextStart{ + LeftMargin BottomMargin + PrintFooter{ + FooterPad add + FooterLines FooterLineHeight mul add + FooterPad add + FooterOffset add}if +}def + % stack: number-of-pages-per-sheet |- -- /BeginSheet{ /sheetState save def /pages-per-sheet exch def + + % ---- translate to bottom-right corner of Portrait page + LandscapeMode{ + LandscapePageHeight 0 translate + 90 rotate + }if + % ---- [jack] Kludge: my ghostscript window is 21x27.7 instead of 21x29.7 + /JackGhostscript where{pop 1 27.7 29.7 div scale}if + UpsideDown{PageWidth LandscapePageHeight translate 180 rotate}if + % ---- N-Up printing + N-Up 1 gt{ + % ---- landscape + N-Up-Landscape{ + PageWidth 0 translate + 90 rotate + }if + N-Up-Margin dup translate + % ---- scale + LandscapeMode{ + /HH PageWidth def + /WW LandscapePageHeight def + }{ + /HH LandscapePageHeight def + /WW PageWidth def + }ifelse + /xx 0 def + N-Up-Landscape{ + /ww WW WW mul N-Up-Lines HH mul div def + /cc HH N-Up-Columns N-Up-Missing add div def + ww cc gt{/xx WW def/WW cc ww div WW mul def/xx xx WW sub def}if + }{ + /hh HH N-Up-Columns N-Up-Missing add div def + /cc HH N-Up-Lines div def + hh cc gt{/xx WW def/WW cc hh div WW mul def/xx xx WW sub def}if + }ifelse + WW N-Up-Margin sub N-Up-Margin sub + N-Up-Landscape + {N-Up-Lines div HH} + {N-Up-Columns N-Up-Missing add div WW}ifelse + div dup scale + LandscapeMode{/yy 0 def}{/yy xx def/xx 0 def}ifelse + xx N-Up-Repeat 1 sub LandscapePageHeight mul yy add translate + % ---- go to start position in page matrix + N-Up-XStart N-Up-Missing 0.5 mul + LandscapeMode + {LandscapePageHeight mul N-Up-YStart add} + {PageWidth mul add N-Up-YStart}ifelse + translate + }if + % ---- translate to lower left corner of TEXT + TextStart translate + % ---- N-up printing N-Up 1 gt N-Up-Border and pages-per-sheet 0 gt and{ % ---- page border gsave 0 setgray - LeftMargin neg BottomMargin neg moveto + TextStart exch neg exch neg moveto N-Up-Repeat {N-Up-End {gsave @@ -549,6 +659,15 @@ StandardEncoding 46 82 getinterval aload pop /HeaderHeight exch def }def +/SetFooterLines{ % nb-lines -- + /FooterLines exch def + % ---- bottom up + FooterPad + FooterLines FooterLineHeight mul add + FooterPad add + /FooterHeight exch def +}def + % |---------| % | tm | % |---------| @@ -557,37 +676,52 @@ StandardEncoding 46 82 getinterval aload pop % | ho | % |---------| % | text | +% |---------| +% | fo | +% |---------| +% | footer | % |-+-------| <-- (0 0) % | bm | % |---------| -/HeaderFrameStart{ % -- x y - 0 PrintHeight HeaderOffset add -}def +% -- |- x y +/HeaderFrameStart{0 PrintHeight HeaderOffset add}def +/FooterFrameStart{0 FooterHeight FooterOffset add neg}def -/HeaderFramePath{ - PrintHeaderWidth 0 rlineto - 0 HeaderHeight rlineto - PrintHeaderWidth neg 0 rlineto - 0 HeaderHeight neg rlineto +/doFramePath{ + /h exch def + PrintHeaderWidth 0 rlineto + 0 h rlineto + PrintHeaderWidth neg 0 rlineto + 0 h neg rlineto }def -/HeaderFrame{ +/HeaderFramePath{HeaderHeight doFramePath}def +/FooterFramePath{FooterHeight doFramePath}def + +% /path-fun /start-fun vector-property doFrame +/doFrame{ + /vecFrame exch def + /startFrame exch load def + /pathFrame exch load def gsave - 0.4 setlinewidth - % ---- fill a black rectangle (the shadow of the next one) - HeaderFrameStart moveto + vecFrame 2 get setlinewidth % frame border width + % ---- do the shadow of the next rectangle + startFrame moveto 1 -1 rmoveto - HeaderFramePath - 0 setgray fill + pathFrame + vecFrame 4 get SetColor fill % frame shadow color % ---- do the next rectangle ... - HeaderFrameStart moveto - HeaderFramePath - gsave 0.9 setgray fill grestore % filled with grey - gsave 0 setgray stroke grestore % drawn with black + startFrame moveto + pathFrame + gsave vecFrame 1 get SetColor fill grestore % frame background + gsave vecFrame 3 get SetColor stroke grestore % frame border color grestore }def +/HeaderFrame{/HeaderFramePath /HeaderFrameStart HeaderFrameProperties doFrame}def +/FooterFrame{/FooterFramePath /FooterFrameStart FooterFrameProperties doFrame}def + /HeaderStart{ HeaderFrameStart exch HeaderPad add exch % horizontal pad @@ -597,6 +731,15 @@ StandardEncoding 46 82 getinterval aload pop HeaderLineHeight HeaderLines 1 sub mul add }def +/FooterStart{ + FooterFrameStart + exch FooterPad add exch % horizontal pad + % ---- bottom up + FooterPad add % vertical pad + FooterDescent sub + FooterLineHeight FooterLines 1 sub mul add +}def + /strcat{ dup length 3 -1 roll dup length dup 4 -1 roll add string dup 0 5 -1 roll putinterval @@ -605,45 +748,61 @@ StandardEncoding 46 82 getinterval aload pop /pagenumberstring{ PageNumber 32 string cvs - ShowNofN{ - (/) strcat - PageCount 32 string cvs strcat - }if + ShowNofN{(/)strcat PageCount 32 string cvs strcat}if }def -/HeaderText{ - HeaderStart moveto +% lines is-right HeaderOrFooterTextLines +/HeaderOrFooterTextLines{ + /is_right exch def + HFStart moveto + { % ---- process the lines + aload pop + exch F + gsave + dup xcheck{exec}if + is_right{ + dup stringwidth pop + PrintHeaderWidth exch sub HFPad HFPad add sub 0 rmoveto + }if + HFColor SetColor + show + grestore + 0 HFLineHeight neg rmoveto + }forall +}def - HeaderLinesRight HeaderLinesLeft % -- rightLines leftLines +% right-lines left-lines /start lineheight pad fore-color HeaderOrFooterText +/HeaderOrFooterText{ + /HFColor exch def + /HFPad exch def + /HFLineHeight exch def + /HFStart exch load def - % ---- hack: `PN 1 and' == `PN 2 modulo' + % -- rightLines leftLines -- at stack + % ---- hack: `PN 1 and' == `PN 2 modulo' % ---- if even page number and duplex, then exchange left and right - PageNumber 1 and 0 eq DuplexValue and{exch}if + PageNumber 1 and 0 eq SwitchHeader and{exch}if - { % ---- process the left lines - aload pop - exch F - gsave - dup xcheck{exec}if - show - grestore - 0 HeaderLineHeight neg rmoveto - }forall + % ---- process the left lines + false HeaderOrFooterTextLines - HeaderStart moveto + % ---- process the right lines + true HeaderOrFooterTextLines +}def - { % ---- process the right lines - aload pop - exch F - gsave - dup xcheck{exec}if - dup stringwidth pop - PrintHeaderWidth exch sub HeaderPad 2 mul sub 0 rmoveto - show - grestore - 0 HeaderLineHeight neg rmoveto - }forall +/HeaderText{ + HeaderLinesRight HeaderLinesLeft + /HeaderStart HeaderLineHeight HeaderPad + HeaderFrameProperties 0 get + HeaderOrFooterText +}def + +/FooterText{ + FooterLinesRight FooterLinesLeft + /FooterStart FooterLineHeight FooterPad + FooterFrameProperties 0 get + HeaderOrFooterText }def /ReportFontInfo{ @@ -651,68 +810,45 @@ StandardEncoding 46 82 getinterval aload pop /t0 3 1 roll DefFont /t0 F /lh FontHeight def - /sw ( ) stringwidth pop def - /aw (01234567890abcdefghijklmnopqrstuvwxyz) dup length exch + /sw( )stringwidth pop def + /aw(01234567890abcdefghijklmnopqrstuvwxyz)dup length exch stringwidth pop exch div def - /t1 12 /Helvetica-Oblique DefFont + /t1 12/Helvetica-Oblique DefFont /t1 F gsave - (languagelevel = ) show - gs_languagelevel 32 string cvs show + (languagelevel = )show + languagelevel 32 string cvs show grestore 0 FontHeight neg rmoveto gsave - (For ) show + (For )show 128 string cvs show - ( ) show + ( )show 32 string cvs show - ( point, the line height is ) show + ( point, the line height is )show lh 32 string cvs show - (, the space width is ) show + (, the space width is )show sw 32 string cvs show - (,) show + (,)show grestore 0 FontHeight neg rmoveto gsave - (and a crude estimate of average character width is ) show + (and a crude estimate of average character width is )show aw 32 string cvs show - (.) show + (.)show grestore 0 FontHeight neg rmoveto }def -/cm{ % cm to point - 72 mul 2.54 div -}def +% cm to point +/cm{72 mul 2.54 div}def /ReportAllFontInfo{ - FontDirectory - { % key = font name value = font dictionary - pop 10 exch ReportFontInfo - }forall + % key = font name value = font dictionary + FontDirectory{pop 10 exch ReportFontInfo}forall }def -% 3 cm 20 cm moveto 10 /Courier ReportFontInfo showpage -% 3 cm 20 cm moveto ReportAllFontInfo showpage - -/ErrorMessages - [(This PostScript printer is not configured with this document page size.) - (Duplex printing is not supported on this PostScript printer.)]def - -% stack: error-index proc |- -- -/CheckConfig{ - stopped{ - 1 cm LandscapePageHeight 0.5 mul moveto - /Courier findfont 10 scalefont setfont - gsave - (ps-print error:) show - grestore - 0 -10 rmoveto - ErrorMessages exch get show - showpage - $error /newerror false put - stop - }if -}bind def +% 3 cm 20 cm moveto 10/Courier ReportFontInfo showpage +% 3 cm 20 cm moveto ReportAllFontInfo showpage % === END ps-print prologue 1