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