Imported Upstream version 2.4.4p3
[debian/amanda] / example / HP-DAT.ps
1 %!
2 %%BoundingBox: 25 25 290 900
3 %%Title: AMANDA ExaLabel
4 %%Pages: 1
5 %%EndComments
6
7 %%%%
8 %%%% This is a template file used by AMANDA to create PostScript tape
9 %%%% labels for each dump.  This file is set up for DAT 4mm tapes,
10 %%%% but you can edit it to work with anything.
11 %%%%
12 %%%% NOTE: this is quick-hack for DAT TAPES; it is simply a scaled 
13 %%%% version of the Exabyte version.
14 %%%%
15
16 %
17 % The label is made up of 6 parts:  statistics, tape name, date,
18 % header, filesystem list, and the logo.  Geometrically, the label 
19 % looks like this:
20 %
21 %   +------------------------+
22 %   |statistics              |   <- section 'A'
23 %   +----+-------------------+
24 %   |logo|     TAPE_NAME     |   <- section 'B'  (logo) <- section 'F'
25 %   |    | version      date |   <- section 'C'
26 %   +----+--+--------+-------+
27 %   | h   fs   l | h  fs   l |   <- section 'D'
28 %   +-------+--------+-------+
29 %   |            |           |   <- section 'E'
30 %   |            |           |
31 %   v            v           v
32 %
33 % Sections D and E, which hold the bulk of the information are 
34 % cut into columns.
35 %
36
37 % Quick-hack for DAT tapes
38 %
39 .78 .75 scale
40
41 % section 'A' font, start position, and line separation
42 %
43 /StatFont               { /Courier findfont 9 scalefont setfont } def
44 /StatPos                { 40 740 } def
45 /StatSep                { 8 } def
46
47 % section 'B' font and position (text centered around this point)
48 %
49 /TitleFont              { /Helvetica-Bold findfont 24 scalefont setfont } def
50 /TitlePos               { 180 685 } def
51
52 % section 'C' font, position of the date (left justified) and the version
53 %
54 /DateFont               { /Palatino-Bold findfont 10 scalefont setfont } def
55 /DatePos                { 280 670 } def
56 /VersFont               { /Palatino-Bold findfont 10 scalefont setfont } def
57 /VersPos                { 80 670 } def
58
59 % section 'D' font, and field positions (x coord is relative to each column)
60 %
61
62 /HeadingFont            { /Palatino-Bold findfont 8 scalefont setfont } def
63 /HeadingHostPos         { 5 650 } def
64 /HeadingFsPos           { 45 650 } def
65 /HeadingLvlPos          { 120 650 } def
66
67 % section 'E' font, and line separation
68 %
69 /HostFont               { /Courier findfont 6 scalefont setfont } def
70 /HostSep                { 6 } def
71
72
73 % the following rectangles separate the regions
74 %
75 /StatBox                { 290 750 25 710 } def
76 /TitleBox               { 290 710 25 665 } def
77 /LogoBox                { 70 710 25 665 } def
78 /HeadingBox             { 290 665 25 645 } def
79 /HostBox                { 290 645 25 0 } def
80
81
82 % number of columns for section 'E,' column width, position of first 
83 % entry in first column, y coordinate of top and bottom of dividing lines
84 %
85 /NumColumns             { 2 } def
86 /ColumnWidth            { 132 } def
87 /ColumnBasePos          { 25 633 } def
88 /TopColDivLine          { 665 } def
89 /BotColDivLine          { 0 } def
90
91
92 %%%%
93 %%%% END OF USER-CONFIGURABLE OPTIONS
94 %%%%
95 %%%% the rest of this file contains the internal functions that are used
96 %%%% by genlabel to draw the label
97 %%%%
98
99
100 %
101 % Initial Setup... draws everything that is the same for all labels
102 %
103
104 % function to draw a box
105 %
106 /box {
107         /ury exch def
108         /urx exch def
109         /lly exch def
110         /llx exch def
111
112         llx lly moveto
113         llx ury lineto
114         urx ury lineto
115         urx lly lineto
116         closepath
117 } def
118
119
120 % move the origin up a bit
121 %
122 0 20 translate
123
124 % draw all of the boxes
125 %
126 0 setgray 
127 2 setlinewidth                                  % thick lines
128 StatBox box stroke
129 TitleBox box stroke
130 LogoBox box stroke
131 HeadingBox box stroke
132 HostBox box stroke
133
134
135 % draw the column dividers
136 %
137 0.5 setlinewidth                                % thin lines
138 /i 1 def
139 {
140         NumColumns i sub 0 le { exit } if       % no lines if this last col.
141         /xoff ColumnBasePos pop                 % get x base position
142            i ColumnWidth mul add def            % offset for this column
143         xoff TopColDivLine moveto 
144         xoff BotColDivLine lineto stroke        
145         /i i 1 add def
146 } loop
147
148
149 % draw the heading names
150 %
151 /i 0 def
152 HeadingFont
153 {
154         NumColumns i sub 0 le { exit } if
155         /xoff ColumnBasePos pop
156           i ColumnWidth mul add def
157         HeadingHostPos exch xoff add exch moveto
158           (Host) show
159         HeadingFsPos exch xoff add exch moveto
160           (Fs) show
161         HeadingLvlPos exch xoff add exch moveto
162           (Lv) show
163         /i i 1 add def
164 } loop
165
166
167 %
168 % the following functions draw strings for each kind of information
169 %
170
171 /CurrStatY StatPos exch pop def
172 ColumnBasePos /CurrColumnY exch def
173   /CurrColumnX exch def
174
175
176 % DrawStat draws the string on the top of the stack in the next position
177 % in section 'A'
178 %
179 /DrawStat {
180         StatFont
181         StatPos pop CurrStatY moveto
182         show
183         /CurrStatY CurrStatY StatSep sub def
184 } def
185
186
187 % DrawTitle draws the string on the top of the stack in section 'B'
188 %
189 /DrawTitle {
190         TitleFont
191         TitlePos moveto
192         dup stringwidth pop 2 div neg 0 rmoveto
193         show
194 } def
195
196
197 % DrawDate draws the string on the top of the stack in section 'C'
198 %
199 /DrawDate {
200         DateFont
201         DatePos moveto
202         dup stringwidth pop neg 0 rmoveto
203         show
204 } def
205
206
207 % DrawVers draws the string on the top of the stack in section 'C'
208 %
209 /DrawVers {
210         VersFont
211         VersPos moveto
212         show
213 } def
214
215
216 % DrawHost expects five strings to be on the stack; right now it
217 % uses only the first three.  The strings are Host Name, Partition Name,
218 % Dump Level, Tape File Number, and Output Size.
219
220 /DrawHost {
221         HostFont
222         pop pop pop                     % discard sizes and fileno
223         CurrColumnX HeadingLvlPos pop add CurrColumnY moveto
224         show
225         CurrColumnX HeadingFsPos pop add CurrColumnY moveto
226         show
227         CurrColumnX HeadingHostPos pop add CurrColumnY moveto
228         show
229         /CurrColumnY CurrColumnY HostSep sub def
230         CurrColumnY BotColDivLine lt {
231                 /CurrColumnY ColumnBasePos exch pop def
232                 /CurrColumnX CurrColumnX ColumnWidth add def
233         } if
234 } def
235
236
237 %%%%
238 %%%% END OF TEMPLATE FILE
239 %%%%