]> code.delx.au - gnu-emacs/blobdiff - etc/ps-prin1.ps
Remove the PS versions of the refcards.
[gnu-emacs] / etc / ps-prin1.ps
index d5e53e902c01719c7760576b9fe79387d4ebc95f..15fe022ed76aa3ce3e9c92541dcfbfad48a11e79 100644 (file)
@@ -1,13 +1,14 @@
 % === BEGIN ps-print prologue 1
-% version: 6.0
+% version: 6.1
 
-% Copyright (C) 2000, 2001  Free Software Foundation, Inc.
+% Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+%   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)
+% the Free Software Foundation; either version 3, or (at your option)
 % any later version.
 %
 % GNU Emacs is distributed in the hope that it will be useful,
 %
 % 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.
+% 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}{
@@ -348,7 +360,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      )}
@@ -418,14 +430,16 @@ StandardEncoding 46 82 getinterval aload pop
 % stack: --
 /printBackground{
   /BackgroundColor where{
+    /LHg LineHeight 0.65 mul def
+    /PHg PrintHeight LHg add def
     pop gsave BackgroundColor SetColor
     NumberOfColumns{
      gsave
-     0 LineHeight 0.65 mul rmoveto
+     0 LHg rmoveto
      PrintWidth 0 rlineto
-     0 PrintHeight neg rlineto
+     0 PHg neg rlineto
      PrintWidth neg 0 rlineto
-     0 PrintHeight rlineto
+     0 PHg rlineto
      fill
      grestore
      PrintWidth InterColumn add 0 rmoveto
@@ -507,11 +521,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
@@ -551,6 +568,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
@@ -605,14 +631,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
@@ -647,6 +673,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     |
 % |---------|
@@ -655,36 +690,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
@@ -694,6 +745,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
@@ -705,39 +768,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{