enscript.hdr - enscript - GNU Enscript
 (HTM) git clone git://thinkerwim.org/enscript.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
       enscript.hdr (2763B)
       ---
            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 % Enscript 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 3 of the License, or
           13 % (at your option) any later version.
           14 %
           15 % Enscript 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 Enscript.  If not, see <http://www.gnu.org/licenses/>.
           22 %
           23 
           24 % -- code follows this line --
           25 %%DocumentNeededResources: font Times-Bold Times-Roman
           26 %Format: moddatestr        $W
           27 %Format: modtimestr        $C
           28 %Format: pagenumstr        $%
           29 
           30 % Fonts.
           31 /Times-Bold /HeaderFont-Bold MF
           32 /HeaderDateF /HeaderFont-Bold findfont 12 scalefont def
           33 
           34 /Times-Roman /HeaderFont-Times MF
           35 /HeaderHDRF /HeaderFont-Times findfont 14 scalefont def
           36 
           37 /HeaderPageNumF /Helvetica-Bold findfont 28.8 scalefont def
           38 
           39 /do_header {        % print enscript header
           40   gsave
           41     d_header_x d_header_y translate
           42 
           43     % light bar
           44     0 0 d_header_w d_header_h 2 div Box
           45     .95 setgray fill
           46 
           47     % dark gray boxes
           48     /dbw d_header_h 2 mul def        % dark box width
           49     /dbc .7 def                        % dark box color
           50 
           51     % left dark box.
           52     0 0 dbw d_header_h Box
           53     dbc setgray fill
           54 
           55     0 setgray 
           56     HeaderDateF setfont
           57     moddatestr dup stringwidth pop dbw exch sub 2 div 
           58     d_header_h 2 div 2 add moveto show
           59     modtimestr dup stringwidth pop dbw exch sub 2 div 
           60     d_header_h 5 div moveto show
           61 
           62     % right dark box
           63     d_header_w dbw sub 0 dbw d_header_h Box
           64     dbc setgray fill
           65 
           66     HeaderPageNumF setfont
           67     1 setgray
           68     pagenumstr dup
           69     stringwidth pop dbw exch sub 2 div d_header_w dbw sub add
           70     d_header_h .2 mul moveto show
           71 
           72     % filename
           73     0 setgray 
           74     HeaderHDRF setfont
           75     d_header_w fname stringwidth pop sub 2 div d_header_h 8 div moveto
           76     fname show
           77 
           78     % user supplied header string.
           79     user_header_p {
           80       /h d_header_h 8 div 5 mul def
           81 
           82       % Implement strict enscript compatibility.
           83       user_header_center_str () eq user_header_right_str () eq and {
           84         d_header_w user_header_left_str stringwidth pop sub 2 div 
           85         h moveto user_header_left_str show
           86       } {
           87         dbw 5 add h moveto user_header_left_str show
           88 
           89         d_header_w user_header_center_str stringwidth pop sub 2 div 
           90         h moveto user_header_center_str show
           91 
           92         d_header_w dbw sub 5 sub user_header_right_str stringwidth pop
           93         sub h moveto user_header_right_str show
           94       } ifelse
           95     } if
           96 
           97   grestore
           98 } def