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 % 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)
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.
22 % 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, 51 Franklin Street, Fifth Floor,
25 % Boston, MA 02110-1301, USA.
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 /$=
36 /Times-Bold /HeaderFont-Bold MF
37 /HeaderDateF /HeaderFont-Bold findfont 12 scalefont def
39 /Times-Roman /HeaderFont-Times MF
40 /HeaderHDRF /HeaderFont-Times findfont 14 scalefont def
42 /HeaderPageNumF /Helvetica-Bold findfont 28.8 scalefont def
43 /HeaderPageCountF /Helvetica-Bold findfont 18 scalefont def
45 /do_header { % print enscript header
47 d_header_x d_header_y translate
49 /dhw d_header_w 4 sub def
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
57 % line across bottom of the header area
59 0 0 moveto dhw 0 lineto
62 /sbw d_header_h 2 mul def % side box width
65 0 0 sbw d_header_h Box
69 % date/time in left box
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
78 dhw sbw sub 0 sbw d_header_h Box
82 % get width of pagecount
83 HeaderPageCountF setfont
84 pagecountstr stringwidth pop
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
94 HeaderPageCountF setfont
100 dhw fname stringwidth pop sub 2 div d_header_h 8 div moveto
103 % user supplied header string.
105 /h d_header_h 8 div 5 mul def
107 % HACK around a bug in enscript 1.6.0:
108 % for some reason this is getting set to "(null)" and
110 user_header_center_str (\(null\)) eq {
111 /user_header_center_str () def
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
119 sbw 5 add h moveto user_header_left_str show
121 dhw user_header_center_str stringwidth pop sub 2 div
122 h moveto user_header_center_str show
124 dhw sbw sub 5 sub user_header_right_str stringwidth pop
125 sub h moveto user_header_right_str show