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