1 rizwank 1.1 %
2 % Enscript styled header.
3 % Copyright (c) 1995 Markku Rossi.
4 % Author: Markku Rossi <mtr@iki.fi>
5 %
6
7 %
8 % This file is part of GNU enscript.
9 %
10 % This program is free software; you can redistribute it and/or modify
11 % it under the terms of the GNU General Public License as published by
12 % the Free Software Foundation; either version 2, or (at your option)
13 % any later version.
14 %
15 % This program is distributed in the hope that it will be useful,
16 % but WITHOUT ANY WARRANTY; without even the implied warranty of
17 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 % GNU General Public License for more details.
19 %
20 % You should have received a copy of the GNU General Public License
21 % along with this program; see the file COPYING. If not, write to
22 rizwank 1.1 % the Free Software Foundation, 59 Temple Place - Suite 330,
23 % Boston, MA 02111-1307, USA.
24 %
25
26 % -- code follows this line --
27 %%DocumentNeededResources: font Times-Bold Times-Roman
28 %Format: moddatestr $W
29 %Format: modtimestr $C
30 %Format: pagenumstr $%
31
32 % Fonts.
33 /Times-Bold /HeaderFont-Bold MF
34 /HeaderDateF /HeaderFont-Bold findfont 12 scalefont def
35
36 /Times-Roman /HeaderFont-Times MF
37 /HeaderHDRF /HeaderFont-Times findfont 14 scalefont def
38
39 /HeaderPageNumF /Helvetica-Bold findfont 28.8 scalefont def
40
41 /do_header { % print enscript header
42 gsave
43 rizwank 1.1 d_header_x d_header_y translate
44
45 % light bar
46 0 0 d_header_w d_header_h 2 div Box
47 .95 setgray fill
48
49 % dark gray boxes
50 /dbw d_header_h 2 mul def % dark box width
51 /dbc .7 def % dark box color
52
53 % left dark box.
54 0 0 dbw d_header_h Box
55 dbc setgray fill
56
57 0 setgray
58 HeaderDateF setfont
59 moddatestr dup stringwidth pop dbw exch sub 2 div
60 d_header_h 2 div 2 add moveto show
61 modtimestr dup stringwidth pop dbw exch sub 2 div
62 d_header_h 5 div moveto show
63
64 rizwank 1.1 % right dark box
65 d_header_w dbw sub 0 dbw d_header_h Box
66 dbc setgray fill
67
68 HeaderPageNumF setfont
69 1 setgray
70 pagenumstr dup
71 stringwidth pop dbw exch sub 2 div d_header_w dbw sub add
72 d_header_h .2 mul moveto show
73
74 % filename
75 0 setgray
76 HeaderHDRF setfont
77 d_header_w fname stringwidth pop sub 2 div d_header_h 8 div moveto
78 fname show
79
80 % user supplied header string.
81 user_header_p {
82 /h d_header_h 8 div 5 mul def
83
84 % Implement strict enscript compatibility.
85 rizwank 1.1 user_header_center_str () eq user_header_right_str () eq and {
86 d_header_w user_header_left_str stringwidth pop sub 2 div
87 h moveto user_header_left_str show
88 } {
89 dbw 5 add h moveto user_header_left_str show
90
91 d_header_w user_header_center_str stringwidth pop sub 2 div
92 h moveto user_header_center_str show
93
94 d_header_w dbw sub 5 sub user_header_right_str stringwidth pop
95 sub h moveto user_header_right_str show
96 } ifelse
97 } if
98
99 grestore
100 } def
|