1% -*- PostScript -*-
2% Base of a2ps' prologues
3%
4% $Id: color.hdr,v 1.4 1998/01/15 15:02:26 demaille Exp $
5%
6
7%
8% This file is part of a2ps.
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% the Free Software Foundation, 59 Temple Place - Suite 330,
23% Boston, MA 02111-1307, USA.
24
25% Variables and Functions
26%
27% Variables from `outside'
28%	v:		virtual page number in current page
29%	sx:		number of chars in lines' prefix
30%	tab:		tab size (in chars)
31% Functions
32%	title:		title
33%	footer:		footer
34%	border:		border around the body text
35% Coordinates
36%	x, y:		the virtual pages (arrays)
37%	x0, y0:		the current line content (x0 does not include
38% 			the line numbers)
39%	snx, sny:	left footer
40%	dx, dy:		the l-footer
41%	lx, ly:		the r-header
42%	fnx, fny:	the c-footer
43%	scx, scy:	the sheet center
44% Font sizes
45%	fnfs:		center title
46%	bfs:		body
47% Fonts
48%	df:		footer/header
49%	sf:		symbol
50%	fnf:		center title
51% Widths and heigths
52%	cw:		a Courier char
53%	pw, ph:		page
54%	sw, sh:		sheet
55%	th:		v.p. title
56% Margins
57%	hm:		header
58%	ury:		top
59%	urx:		right
60%	llx:		left
61
62% -- code follows this line --
63%%Copyright: (c) 1988, 89, 90, 91, 92, 93 Miguel Santana
64%%Copyright: (c) 1995, 96, 97, 98 Akim Demaille, Miguel Santana
65%%DocumentProcessColors: Black
66% Function title: prints page header.
67% <ct> <rt> <lt> are passed as argument
68/title {
69  % 1. Draw the background
70  x v get y v get moveto
71  0 setgray
72  gsave
73    0 th 2 div neg rmoveto
74    th setlinewidth
75    0.5 0.5 1 setrgbcolor
76    pw 0 rlineto stroke
77  grestore
78  % 2. Border it
79  gsave
80    0.7 setlinewidth
81    pw 0 rlineto
82    0 th neg rlineto
83    pw neg 0 rlineto
84    closepath stroke
85  grestore
86  % stk: ct rt lt
87  x v get y v get th sub 1 add moveto
88%Font: Helvetica fnfs 0.8 mul
89  % 3. The left title
90  gsave
91    dup stringwidth pop fnfs 0.8 mul add exch % leave space took on stack
92    fnfs 0.8 mul hm rmoveto
93    show			% left title
94  grestore
95  exch
96  % stk: ct ltw rt
97  % 4. the right title
98  gsave
99    dup stringwidth pop fnfs 0.8 mul add exch % leave space took on stack
100    dup
101    pw exch stringwidth pop fnfs 0.8 mul add sub
102    hm
103    rmoveto
104    show			% right title
105  grestore
106  % stk: ct ltw rtw
107  % 5. the center title
108  gsave
109    pw 3 1 roll
110    % stk: ct pw ltw rtw
111    3 copy
112    % Move to the center of the left room
113    sub add 2 div hm rmoveto
114    % What is the available space in here?
115    add sub fnfs 0.8 mul sub fnfs 0.8 mul sub
116    % stk: ct space_left
117%Font: Helvetica-Bold fnfs
118    1 setgray
119    cfshow
120  grestore
121} bind def
122
123% Function border: prints virtual page border
124/border { %def
125  gsave				% print four sides
126    0 setgray
127    x v get y v get moveto
128    0.7 setlinewidth		% of the square
129    pw 0 rlineto
130    0 ph neg rlineto
131    pw neg 0 rlineto
132    closepath stroke
133  grestore
134} bind def
135
136% Function water: prints a water mark in background
137/water { %def
138  gsave
139    scx scy moveto rotate
140%Font: Times-Bold 100
141    .97 setgray
142    dup stringwidth pop 2 div neg -50 rmoveto
143    show
144  grestore
145} bind def
146
147% Function rhead: prints the right header
148/rhead {  %def
149  lx ly moveto
150%Font: Helvetica fnfs 0.8 mul
151  l-show
152} bind def
153
154% Function footer (cf rf lf -> -)
155/footer {
156%Font: Helvetica fnfs 0.8 mul
157  dx dy moveto
158  show
159
160  snx sny moveto
161  l-show
162
163  fnx fny moveto
164  c-show
165} bind def
166
167% Function print line number (<string> # -)
168/# {
169  gsave
170    sx cw mul neg 2 div 0 rmoveto
171    f# setfont
172    c-show
173  grestore
174} bind def
175