X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/b15a393be1b85b7208150cc0e68f7ad7f529fd88..cf14a51cd198957395aaa6aba818534d76b4181c:/etc/ps-prin1.ps diff --git a/etc/ps-prin1.ps b/etc/ps-prin1.ps index 9c9a6ac820..dd922b9338 100644 --- a/etc/ps-prin1.ps +++ b/etc/ps-prin1.ps @@ -1,7 +1,7 @@ % === BEGIN ps-print prologue 1 % version: 6.0 -% Copyright (C) 2000, 2001 Free Software Foundation, Inc. +% Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. % % This file is part of GNU Emacs. % @@ -20,6 +20,17 @@ % Free Software Foundation, Inc., 59 Temple Place - Suite 330, % Boston, MA 02111-1307, USA. +% As a special exception, the copyright holders of this module give +% you permission to include the module in a Postscript file generated +% by Emacs or other free software together with the result of +% converting text to be printed, regardless of the license terms of +% that text, and to use under terms of your choice the page images +% resulting from formatting said combination. If you modify this +% module, you may extend this exception to your version of the module +% but you are not obligated to do so. If you do not wish to do so, +% delete this exception statement from your version. + + % ISOLatin1Encoding stolen from ps_init.ps in GhostScript 2.6.1.4: /ISOLatin1Encoding where{pop}{ % -- The ISO Latin-1 encoding vector isn't known, so define it. @@ -187,12 +198,15 @@ StandardEncoding 46 82 getinterval aload pop dobackground }def -/PSL{bg{eolbg}if 0 currentpoint exch pop LineHeight sub moveto}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{PSL isLineStep pop}def % Soft Linefeed +/SL{LineHS PSL isLineStep pop}def % Soft Linefeed -/HL{PSL 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 @@ -207,36 +221,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{ + 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 |- -- @@ -330,7 +359,7 @@ StandardEncoding 46 82 getinterval aload pop 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 )} @@ -351,7 +380,7 @@ StandardEncoding 46 82 getinterval aload pop gsave 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 @@ -370,18 +399,23 @@ StandardEncoding 46 82 getinterval aload pop /lpc lpc ZebraHeight sub def H ZebraHeight add} {H}ifelse % "white" stripe - LineHeight mul neg 0 exch rmoveto + 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 ZebraFollow 2 and 0 ne or{pop ZebraHeight}if doZebra}ifelse + {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 @@ -484,11 +518,14 @@ StandardEncoding 46 82 getinterval aload pop 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 @@ -528,6 +565,15 @@ 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 @@ -582,14 +628,14 @@ StandardEncoding 46 82 getinterval aload pop translate }if % ---- translate to lower left corner of TEXT - LeftMargin BottomMargin translate + 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 @@ -624,6 +670,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 | % |---------| @@ -632,36 +687,52 @@ StandardEncoding 46 82 getinterval aload pop % | ho | % |---------| % | text | +% |---------| +% | fo | +% |---------| +% | footer | % |-+-------| <-- (0 0) % | bm | % |---------| % -- |- x y /HeaderFrameStart{0 PrintHeight HeaderOffset add}def - -/HeaderFramePath{ - PrintHeaderWidth 0 rlineto - 0 HeaderHeight rlineto - PrintHeaderWidth neg 0 rlineto - 0 HeaderHeight neg rlineto +/FooterFrameStart{0 FooterHeight FooterOffset add neg}def + +/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 @@ -671,6 +742,18 @@ 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 + +/HeaderClip{HeaderFrameStart moveto HeaderFramePath clip}def +/FooterClip{FooterFrameStart moveto FooterFramePath clip}def + /strcat{ dup length 3 -1 roll dup length dup 4 -1 roll add string dup 0 5 -1 roll putinterval @@ -682,39 +765,62 @@ StandardEncoding 46 82 getinterval aload pop 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 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{ + gsave HeaderClip + HeaderLinesRight HeaderLinesLeft + /HeaderStart HeaderLineHeight HeaderPad + HeaderFrameProperties 0 get + HeaderOrFooterText + grestore +}def + +/FooterText{ + gsave FooterClip + FooterLinesRight FooterLinesLeft + /FooterStart FooterLineHeight FooterPad + FooterFrameProperties 0 get + HeaderOrFooterText + grestore }def /ReportFontInfo{