%
% a2ps styled header.
% Copyright (c) 1996-1999 Markku Rossi.
% Author: Markku Rossi <mtr@iki.fi>
%

%
% This file is part of GNU Enscript.
%
% Enscript is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% Enscript is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Enscript.  If not, see <http://www.gnu.org/licenses/>.
%

% -- code follows this line --
%Format: userstr	Printed by %N
%Format: datestr	%D{%d %b %Y %H:%M}
%Format: fmodstr	$D{%d %b %Y %H:%M}
%Format: upperpagestr	Page $V$%/$=
%Format: lowerpagestr	page $p

%HeaderHeight: 36
%FooterHeight: 12

% Fonts.
/Helvetica /helvetica-encoded MF
/SmallFont /helvetica-encoded findfont 10 scalefont def

/Helvetica-Bold /helvetica-bold-encoded MF
/BigFont   /helvetica-bold-encoded findfont 12 scalefont def

/a2ps_marg 10 def

/do_header {	% print a2ps header
  gsave
    % lowerpagestr
    SmallFont setfont
    d_footer_x d_footer_w add lowerpagestr stringwidth pop sub
    a2ps_marg sub
    d_footer_y moveto lowerpagestr show

    % current date in footer
    SmallFont setfont
    d_footer_x a2ps_marg add d_footer_y moveto datestr show

    % full filename in footer
    SmallFont setfont
    d_footer_x d_footer_w 2 div add fname stringwidth pop 2 div sub
    d_footer_y moveto fname show

    % gray box to header
    .95 setgray
    d_header_x d_header_y d_header_w 24 Box fill
    0 setgray

    % borders.
    .5 setlinewidth
    d_header_x d_header_y d_header_w 24 Box stroke

    % userstr
    d_header_x d_header_w add userstr stringwidth pop sub a2ps_marg sub
    d_header_y 29 add moveto userstr show

    % datestr
    d_header_x a2ps_marg add d_header_y 6 add moveto fmodstr show

    % upperpagestr
    d_header_x d_header_w add upperpagestr stringwidth pop sub
    a2ps_marg sub
    d_header_y 6 add moveto upperpagestr show

    % filename
    BigFont setfont
    d_header_x d_header_w 2 div add ftail stringwidth pop 2 div sub
    d_header_y 6 add moveto ftail show
  grestore
} def
