(file) Return to enscript-color.hdr CVS log (file) (dir) Up to [RizwankCVS] / testProject / share / enscript

  1 rizwank 1.1 %
  2             % Enscript styled header for color printers
  3             % Copyright (c) 1995 Markku Rossi.
  4             % Copyright (C) 1998 Stig Hackvän <stig@hackvan.com>
  5             % Original Author: Markku Rossi <mtr@iki.fi>
  6             % Author: Stig Hackvän <stig@hackvan.com>
  7             %
  8             
  9             %
 10             % This file is part of GNU enscript.
 11             %
 12             % This program is free software; you can redistribute it and/or modify
 13             % it under the terms of the GNU General Public License as published by
 14             % the Free Software Foundation; either version 2, or (at your option)
 15             % any later version.
 16             %
 17             % This program is distributed in the hope that it will be useful,
 18             % but WITHOUT ANY WARRANTY; without even the implied warranty of
 19             % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 20             % GNU General Public License for more details.
 21             %
 22 rizwank 1.1 % You should have received a copy of the GNU General Public License
 23             % along with this program; see the file COPYING.  If not, write to
 24             % the Free Software Foundation, 59 Temple Place - Suite 330,
 25             % Boston, MA 02111-1307, USA.
 26             %
 27             
 28             % -- code follows this line --
 29             %%DocumentNeededResources: font Times-Bold Times-Roman
 30             %Format: moddatestr	$W
 31             %Format: modtimestr	$C
 32             %Format: pagenumstr	$%
 33             %Format: pagecountstr	/$=
 34             
 35             % Fonts.
 36             /Times-Bold /HeaderFont-Bold MF
 37             /HeaderDateF /HeaderFont-Bold findfont 12 scalefont def
 38             
 39             /Times-Roman /HeaderFont-Times MF
 40             /HeaderHDRF /HeaderFont-Times findfont 14 scalefont def
 41             
 42             /HeaderPageNumF /Helvetica-Bold findfont 28.8 scalefont def
 43 rizwank 1.1 /HeaderPageCountF /Helvetica-Bold findfont 18 scalefont def
 44             
 45             /do_header {	% print enscript header
 46               gsave
 47                 d_header_x d_header_y translate
 48             
 49                 /dhw d_header_w 4 sub def
 50             
 51                 /linecolor {.5 0  .2 0 setcmykcolor} bind def  % line color
 52                 /txcolor   {.7 .5 0  0 setcmykcolor} bind def  % text color
 53                 /fncolor   {0  1  1  0 setcmykcolor} bind def  % filename line color
 54             
 55                 .5 setlinewidth
 56             
 57                 % line across bottom of the header area
 58                 linecolor
 59                 0 0 moveto dhw 0 lineto
 60             
 61                 % side boxes
 62                 /sbw d_header_h 2 mul def	% side box width
 63             
 64 rizwank 1.1     % left side box
 65                 0 0 sbw d_header_h Box
 66                 linecolor
 67                 stroke
 68             
 69                 % date/time in left box
 70                 txcolor
 71                 HeaderDateF setfont
 72                 moddatestr dup stringwidth pop sbw exch sub 2 div
 73                 d_header_h 2 div 2 add moveto show
 74                 modtimestr dup stringwidth pop sbw exch sub 2 div
 75                 d_header_h 5 div moveto show
 76             
 77                 % right side box
 78                 dhw sbw sub 0 sbw d_header_h Box
 79                 linecolor
 80                 stroke
 81             
 82                 % get width of pagecount
 83                 HeaderPageCountF setfont
 84                 pagecountstr stringwidth pop
 85 rizwank 1.1 
 86                 txcolor
 87                 HeaderPageNumF setfont
 88                 pagenumstr stringwidth pop add  % add to width of pagecount
 89                 sbw exch sub 2 div dhw sbw sub add
 90                 d_header_h .2 mul moveto
 91             
 92                 pagenumstr show
 93             
 94                 HeaderPageCountF setfont
 95                 pagecountstr show
 96             
 97                 % filename
 98                 fncolor
 99                 HeaderHDRF setfont
100                 dhw fname stringwidth pop sub 2 div d_header_h 8 div moveto
101                 fname show
102             
103                 % user supplied header string.
104                 user_header_p {
105                   /h d_header_h 8 div 5 mul def
106 rizwank 1.1 
107                   % HACK around a bug in enscript 1.6.0:
108                   % for some reason this is getting set to "(null)" and
109                   %
110                   user_header_center_str (\(null\)) eq {
111                     /user_header_center_str () def
112                   } if
113             
114                   % Implement strict enscript compatibility.
115                   user_header_center_str () eq user_header_right_str () eq and {
116                     dhw user_header_left_str stringwidth pop sub 2 div
117                     h moveto user_header_left_str show
118                   } {
119                     sbw 5 add h moveto user_header_left_str show
120             
121                     dhw user_header_center_str stringwidth pop sub 2 div
122                     h moveto user_header_center_str show
123             
124             	dhw sbw sub 5 sub user_header_right_str stringwidth pop
125             	sub h moveto user_header_right_str show
126                   } ifelse
127 rizwank 1.1     } if
128             
129               grestore
130             } bind def

Rizwan Kassim
Powered by
ViewCVS 0.9.2