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>
10 % This file is part of GNU Enscript.
12 % Enscript 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 3 of the License, or
15 % (at your option) any later version.
17 % Enscript 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.
22 % You should have received a copy of the GNU General Public License
23 % along with Enscript. If not, see <http://www.gnu.org/licenses/>.
26 % -- code follows this line --
27 %%DocumentNeededResources: font Times-Bold Times-Roman
28 %Format: moddatestr $W
29 %Format: modtimestr $C
30 %Format: pagenumstr $%
31 %Format: pagecountstr /$=
34 /Times-Bold /HeaderFont-Bold MF
35 /HeaderDateF /HeaderFont-Bold findfont 12 scalefont def
37 /Times-Roman /HeaderFont-Times MF
38 /HeaderHDRF /HeaderFont-Times findfont 14 scalefont def
40 /HeaderPageNumF /Helvetica-Bold findfont 28.8 scalefont def
41 /HeaderPageCountF /Helvetica-Bold findfont 18 scalefont def
43 /do_header { % print enscript header
45 d_header_x d_header_y translate
47 /dhw d_header_w 4 sub def
49 /linecolor {.5 0 .2 0 setcmykcolor} bind def % line color
50 /txcolor {.7 .5 0 0 setcmykcolor} bind def % text color
51 /fncolor {0 1 1 0 setcmykcolor} bind def % filename line color
55 % line across bottom of the header area
57 0 0 moveto dhw 0 lineto
60 /sbw d_header_h 2 mul def % side box width
63 0 0 sbw d_header_h Box
67 % date/time in left box
70 moddatestr dup stringwidth pop sbw exch sub 2 div
71 d_header_h 2 div 2 add moveto show
72 modtimestr dup stringwidth pop sbw exch sub 2 div
73 d_header_h 5 div moveto show
76 dhw sbw sub 0 sbw d_header_h Box
80 % get width of pagecount
81 HeaderPageCountF setfont
82 pagecountstr stringwidth pop
85 HeaderPageNumF setfont
86 pagenumstr stringwidth pop add % add to width of pagecount
87 sbw exch sub 2 div dhw sbw sub add
88 d_header_h .2 mul moveto
92 HeaderPageCountF setfont
98 dhw fname stringwidth pop sub 2 div d_header_h 8 div moveto
101 % user supplied header string.
103 /h d_header_h 8 div 5 mul def
105 % HACK around a bug in enscript 1.6.0:
106 % for some reason this is getting set to "(null)" and
108 user_header_center_str (\(null\)) eq {
109 /user_header_center_str () def
112 % Implement strict enscript compatibility.
113 user_header_center_str () eq user_header_right_str () eq and {
114 dhw user_header_left_str stringwidth pop sub 2 div
115 h moveto user_header_left_str show
117 sbw 5 add h moveto user_header_left_str show
119 dhw user_header_center_str stringwidth pop sub 2 div
120 h moveto user_header_center_str show
122 dhw sbw sub 5 sub user_header_right_str stringwidth pop
123 sub h moveto user_header_right_str show