enscript-color.hdr [plain text]
%
% Enscript styled header for color printers
% Copyright (c) 1995 Markku Rossi.
% Copyright (C) 1998 Stig Hackvän <stig@hackvan.com>
% Original Author: Markku Rossi <mtr@iki.fi>
% Author: Stig Hackvän <stig@hackvan.com>
%
%
% This file is part of GNU enscript.
%
% This program 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.
%
% This program 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 this program; see the file COPYING. If not, write to
% the Free Software Foundation, 59 Temple Place - Suite 330,
% Boston, MA 02111-1307, USA.
%
% -- code follows this line --
%%DocumentNeededResources: font Times-Bold Times-Roman
%Format: moddatestr $W
%Format: modtimestr $C
%Format: pagenumstr $%
%Format: pagecountstr /$=
% Fonts.
/Times-Bold /HeaderFont-Bold MF
/HeaderDateF /HeaderFont-Bold findfont 12 scalefont def
/Times-Roman /HeaderFont-Times MF
/HeaderHDRF /HeaderFont-Times findfont 14 scalefont def
/HeaderPageNumF /Helvetica-Bold findfont 28.8 scalefont def
/HeaderPageCountF /Helvetica-Bold findfont 18 scalefont def
/do_header { % print enscript header
gsave
d_header_x d_header_y translate
/dhw d_header_w 4 sub def
/linecolor {.5 0 .2 0 setcmykcolor} bind def % line color
/txcolor {.7 .5 0 0 setcmykcolor} bind def % text color
/fncolor {0 1 1 0 setcmykcolor} bind def % filename line color
.5 setlinewidth
% line across bottom of the header area
linecolor
0 0 moveto dhw 0 lineto
% side boxes
/sbw d_header_h 2 mul def % side box width
% left side box
0 0 sbw d_header_h Box
linecolor
stroke
% date/time in left box
txcolor
HeaderDateF setfont
moddatestr dup stringwidth pop sbw exch sub 2 div
d_header_h 2 div 2 add moveto show
modtimestr dup stringwidth pop sbw exch sub 2 div
d_header_h 5 div moveto show
% right side box
dhw sbw sub 0 sbw d_header_h Box
linecolor
stroke
% get width of pagecount
HeaderPageCountF setfont
pagecountstr stringwidth pop
txcolor
HeaderPageNumF setfont
pagenumstr stringwidth pop add % add to width of pagecount
sbw exch sub 2 div dhw sbw sub add
d_header_h .2 mul moveto
pagenumstr show
HeaderPageCountF setfont
pagecountstr show
% filename
fncolor
HeaderHDRF setfont
dhw fname stringwidth pop sub 2 div d_header_h 8 div moveto
fname show
% user supplied header string.
user_header_p {
/h d_header_h 8 div 5 mul def
% HACK around a bug in enscript 1.6.0:
% for some reason this is getting set to "(null)" and
%
user_header_center_str (\(null\)) eq {
/user_header_center_str () def
} if
% Implement strict enscript compatibility.
user_header_center_str () eq user_header_right_str () eq and {
dhw user_header_left_str stringwidth pop sub 2 div
h moveto user_header_left_str show
} {
sbw 5 add h moveto user_header_left_str show
dhw user_header_center_str stringwidth pop sub 2 div
h moveto user_header_center_str show
dhw sbw sub 5 sub user_header_right_str stringwidth pop
sub h moveto user_header_right_str show
} ifelse
} if
grestore
} bind def