]> code.delx.au - gnu-emacs/blobdiff - etc/ps-prin1.ps
Fix typos.
[gnu-emacs] / etc / ps-prin1.ps
index 904c6031616eb4e31384ad3b27112c66755c50df..118133ba73b273d84b1973288b8317538cdf0865 100644 (file)
@@ -1,5 +1,35 @@
 % === BEGIN ps-print prologue 1
-% version: 5.2.2
+% version: 6.0
+
+% Copyright (C) 2000, 2001, 2002, 2003, 2004  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., 51 Franklin Street, Fifth Floor,
+% Boston, MA 02110-1301, 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}{
@@ -168,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
@@ -188,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  |-  --
@@ -290,8 +338,6 @@ StandardEncoding 46 82 getinterval aload pop
 % stack:  --
 /FillBgColor{bgcolor aload pop setrgbcolor fill}bind def
 
-/L0 6/Times-Italic DefFont
-
 % stack:  -- |- boolean
 /isLineStep{
   SyncLineZebra
@@ -313,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      )}
@@ -334,9 +380,9 @@ 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 PageNumber 1 sub NumberOfColumns mul LinesPerColumn mul def
+  /zebra-line LinesPrinted def
   NumberOfColumns{LinesPerColumn doColumnZebra xiter 0 rmoveto}repeat
   grestore
 }def
@@ -345,7 +391,7 @@ StandardEncoding 46 82 getinterval aload pop
 /doColumnZebra{
   /lpc exch def
   gsave
-  ZebraFollow{
+  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
@@ -353,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{pop ZebraHeight}if doZebra}ifelse
+  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
@@ -458,6 +509,7 @@ 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
@@ -466,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
@@ -510,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
@@ -564,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
@@ -606,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     |
 % |---------|
@@ -614,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
@@ -653,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
@@ -664,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{