1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
|
%
% Enscript styled header for color printers
% Copyright (c) 1995 Markku Rossi.
% Copyright (C) 1998 Stig Hackvn <stig@hackvan.com>
% Original Author: Markku Rossi <mtr@iki.fi>
% Author: Stig Hackvn <stig@hackvan.com>
%
%
% This file is part of GNU Enscript.
%
% Enscript 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 3 of the License, or
% (at your option) any later version.
%
% Enscript 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 Enscript. If not, see <http://www.gnu.org/licenses/>.
%
% -- 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
|