enscript-color.hdr - enscript - GNU Enscript
 (HTM) git clone git://thinkerwim.org/enscript.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
       enscript-color.hdr (3576B)
       ---
            1 %
            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>
            7 %
            8 
            9 %
           10 % This file is part of GNU Enscript.
           11 %
           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.
           16 %
           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.
           21 %
           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/>.
           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 %Format: pagecountstr        /$=
           32 
           33 % Fonts.
           34 /Times-Bold /HeaderFont-Bold MF
           35 /HeaderDateF /HeaderFont-Bold findfont 12 scalefont def
           36 
           37 /Times-Roman /HeaderFont-Times MF
           38 /HeaderHDRF /HeaderFont-Times findfont 14 scalefont def
           39 
           40 /HeaderPageNumF /Helvetica-Bold findfont 28.8 scalefont def
           41 /HeaderPageCountF /Helvetica-Bold findfont 18 scalefont def
           42 
           43 /do_header {        % print enscript header
           44   gsave
           45     d_header_x d_header_y translate
           46 
           47     /dhw d_header_w 4 sub def
           48 
           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
           52 
           53     .5 setlinewidth
           54 
           55     % line across bottom of the header area
           56     linecolor
           57     0 0 moveto dhw 0 lineto
           58 
           59     % side boxes
           60     /sbw d_header_h 2 mul def        % side box width
           61 
           62     % left side box
           63     0 0 sbw d_header_h Box
           64     linecolor
           65     stroke
           66 
           67     % date/time in left box
           68     txcolor
           69     HeaderDateF setfont
           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
           74 
           75     % right side box
           76     dhw sbw sub 0 sbw d_header_h Box
           77     linecolor
           78     stroke
           79 
           80     % get width of pagecount
           81     HeaderPageCountF setfont
           82     pagecountstr stringwidth pop
           83 
           84     txcolor
           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
           89 
           90     pagenumstr show
           91 
           92     HeaderPageCountF setfont
           93     pagecountstr show
           94 
           95     % filename
           96     fncolor
           97     HeaderHDRF setfont
           98     dhw fname stringwidth pop sub 2 div d_header_h 8 div moveto
           99     fname show
          100 
          101     % user supplied header string.
          102     user_header_p {
          103       /h d_header_h 8 div 5 mul def
          104 
          105       % HACK around a bug in enscript 1.6.0:
          106       % for some reason this is getting set to "(null)" and
          107       %
          108       user_header_center_str (\(null\)) eq {
          109         /user_header_center_str () def
          110       } if
          111 
          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
          116       } {
          117         sbw 5 add h moveto user_header_left_str show
          118 
          119         dhw user_header_center_str stringwidth pop sub 2 div
          120         h moveto user_header_center_str show
          121 
          122         dhw sbw sub 5 sub user_header_right_str stringwidth pop
          123         sub h moveto user_header_right_str show
          124       } ifelse
          125     } if
          126 
          127   grestore
          128 } bind def