1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
|
%NAME: barcodes.mf
% 10-Nov-87 14:05:55-PST,10055;000000000000
% Return-Path: <CLDLV%NASAGISS.BITNET@forsythe.stanford.edu>
% Date: Tue, 10 Nov 87 15:46:49 EDT
% From: Dimitri Vulis <CLDLV%NASAGISS.BITNET@forsythe.stanford.edu>
% Subject: Foo (bar codes)
%
% Dear Malcolm: I believe that the following file would of general
% interest, but I think it's too long for the digest:
%
% I was amazed to find out that business people pay enormous money for the
% ability to produce bar codes. This ought to be TRIVIAL with \TeX.
% So, I got hold of a public domain BASIC program that supposedly does that and
% lifted the codes and put them into METAFONT (it was EASY). Caveat(s): I have
% never tested these codes with an OCR. The BASIC program said it used `3 of 9'
% encoding. I presume it's not the same as UPC. The sizes may be off---I
% took them from the BASIC program that used HP LJ's 100dpi graphics mode.
% Disclaimer: I haven't tested these codes. Use them at your own risk.
% Remarks:
% 1) White space is a displayable character.
% 2) There are 9 significant strips, bwbwbwbwb; 3 of them are wide.
% 3) The white_naro; at the end of each code is the inter-code spacing.
% Credits: the original BASIC program was written by `Bill Wood Mil., WI' and
% later re-written by `Bill Baines, Enfield, CT.'. METAFONT version is by
% `Dimitri Vulis CLDLV@NASAGISS.BITNET'
mode_setup;
font_identifier "DVBar"; font_size .35in#;
naro#:=.01in#; % narrow strip width
wide#:=3naro#; % wide strip width
wdth#:=3wide#+7naro#; % common width of all codes
hght#:=.35in#; % common height of all codes
define_pixels(naro,wide,wdth,hght);
def white_naro=
wid:=wid+naro;
enddef;
def black_naro=
filldraw (wid,0)--(wid,hght)--(wid+naro,hght)--(wid+naro,0)--cycle;
wid:=wid+naro;
enddef;
def white_wide=
wid:=wid+wide;
enddef;
def black_wide=
filldraw (wid,0)--(wid,hght)--(wid+wide,hght)--(wid+wide,0)--cycle;
wid:=wid+wide;
enddef;
beginchar("1",wdth#,hght#,0);
wid:=0;
black_wide; white_naro; black_naro; white_wide; black_naro;
white_naro; black_naro; white_naro; black_wide; white_naro;
endchar;
beginchar("2",wdth#,hght#,0);
wid:=0;
black_naro; white_naro; black_wide; white_wide; black_naro;
white_naro; black_naro; white_naro; black_wide; white_naro;
endchar;
beginchar("3",wdth#,hght#,0);
wid:=0;
black_wide; white_naro; black_wide; white_wide; black_naro;
white_naro; black_naro; white_naro; black_naro; white_naro;
endchar;
beginchar("4",wdth#,hght#,0);
wid:=0;
black_naro; white_naro; black_naro; white_wide; black_wide;
white_naro; black_naro; white_naro; black_wide; white_naro;
endchar;
beginchar("5",wdth#,hght#,0);
wid:=0;
black_wide; white_naro; black_naro; white_wide; black_wide;
white_naro; black_naro; white_naro; black_naro; white_naro;
endchar;
beginchar("6",wdth#,hght#,0);
wid:=0;
black_naro; white_naro; black_wide; white_wide; black_wide;
white_naro; black_naro; white_naro; black_naro; white_naro;
endchar;
beginchar("7",wdth#,hght#,0);
wid:=0;
black_naro; white_naro; black_naro; white_wide; black_naro;
white_naro; black_wide; white_naro; black_wide; white_naro;
endchar;
beginchar("8",wdth#,hght#,0);
wid:=0;
black_wide; white_naro; black_naro; white_wide; black_naro;
white_naro; black_wide; white_naro; black_naro; white_naro;
endchar;
beginchar("9",wdth#,hght#,0);
wid:=0;
black_naro; white_naro; black_wide; white_wide; black_naro;
white_naro; black_wide; white_naro; black_naro; white_naro;
endchar;
beginchar("0",wdth#,hght#,0);
wid:=0;
black_naro; white_naro; black_naro; white_wide; black_wide;
white_naro; black_wide; white_naro; black_naro; white_naro;
endchar;
beginchar("A",wdth#,hght#,0);
wid:=0;
black_wide; white_naro; black_naro; white_naro; black_naro;
white_wide; black_naro; white_naro; black_wide; white_naro;
endchar;
beginchar("B",wdth#,hght#,0);
wid:=0;
black_naro; white_naro; black_wide; white_naro; black_naro;
white_wide; black_naro; white_naro; black_wide; white_naro;
endchar;
beginchar("C",wdth#,hght#,0);
wid:=0;
black_wide; white_naro; black_wide; white_naro; black_naro;
white_wide; black_naro; white_naro; black_naro; white_naro;
endchar;
beginchar("D",wdth#,hght#,0);
wid:=0;
black_naro; white_naro; black_naro; white_naro; black_wide;
white_wide; black_naro; white_naro; black_wide; white_naro;
endchar;
beginchar("E",wdth#,hght#,0);
wid:=0;
black_wide; white_naro; black_naro; white_naro; black_wide;
white_wide; black_naro; white_naro; black_naro; white_naro;
endchar;
beginchar("F",wdth#,hght#,0);
wid:=0;
black_naro; white_naro; black_wide; white_naro; black_wide;
white_wide; black_naro; white_naro; black_naro; white_naro;
endchar;
beginchar("G",wdth#,hght#,0);
wid:=0;
black_naro; white_naro; black_naro; white_naro; black_naro;
white_wide; black_wide; white_naro; black_wide; white_naro;
endchar;
beginchar("H",wdth#,hght#,0);
wid:=0;
black_wide; white_naro; black_naro; white_naro; black_naro;
white_wide; black_wide; white_naro; black_naro; white_naro;
endchar;
beginchar("I",wdth#,hght#,0);
wid:=0;
black_naro; white_naro; black_wide; white_naro; black_naro;
white_wide; black_wide; white_naro; black_naro; white_naro;
endchar;
beginchar("J",wdth#,hght#,0);
wid:=0;
black_naro; white_naro; black_naro; white_naro; black_wide;
white_wide; black_wide; white_naro; black_naro; white_naro;
endchar;
beginchar("K",wdth#,hght#,0);
wid:=0;
black_wide; white_naro; black_naro; white_naro; black_naro;
white_naro; black_naro; white_wide; black_wide; white_naro;
endchar;
beginchar("L",wdth#,hght#,0);
wid:=0;
black_naro; white_naro; black_wide; white_naro; black_naro;
white_naro; black_naro; white_wide; black_wide; white_naro;
endchar;
beginchar("M",wdth#,hght#,0);
wid:=0;
black_wide; white_naro; black_wide; white_naro; black_naro;
white_naro; black_naro; white_wide; black_naro; white_naro;
endchar;
beginchar("N",wdth#,hght#,0);
wid:=0;
black_naro; white_naro; black_naro; white_naro; black_wide;
white_naro; black_naro; white_wide; black_wide; white_naro;
endchar;
beginchar("O",wdth#,hght#,0);
wid:=0;
black_wide; white_naro; black_naro; white_naro; black_wide;
white_naro; black_naro; white_wide; black_naro; white_naro;
endchar;
beginchar("P",wdth#,hght#,0);
wid:=0;
black_naro; white_naro; black_wide; white_naro; black_wide;
white_naro; black_naro; white_wide; black_naro; white_naro;
endchar;
beginchar("Q",wdth#,hght#,0);
wid:=0;
black_naro; white_naro; black_naro; white_naro; black_naro;
white_naro; black_wide; white_wide; black_wide; white_naro;
endchar;
beginchar("R",wdth#,hght#,0);
wid:=0;
black_wide; white_naro; black_naro; white_naro; black_naro;
white_naro; black_wide; white_wide; black_naro; white_naro;
endchar;
beginchar("S",wdth#,hght#,0);
wid:=0;
black_naro; white_naro; black_wide; white_naro; black_naro;
white_naro; black_wide; white_wide; black_naro; white_naro;
endchar;
beginchar("T",wdth#,hght#,0);
wid:=0;
black_naro; white_naro; black_naro; white_naro; black_wide;
white_naro; black_wide; white_wide; black_naro; white_naro;
endchar;
beginchar("U",wdth#,hght#,0);
wid:=0;
black_wide; white_wide; black_naro; white_naro; black_naro;
white_naro; black_naro; white_naro; black_wide; white_naro;
endchar;
beginchar("V",wdth#,hght#,0);
wid:=0;
black_naro; white_wide; black_wide; white_naro; black_naro;
white_naro; black_naro; white_naro; black_wide; white_naro;
endchar;
beginchar("W",wdth#,hght#,0);
wid:=0;
black_wide; white_wide; black_wide; white_naro; black_naro;
white_naro; black_naro; white_naro; black_naro; white_naro;
endchar;
beginchar("X",wdth#,hght#,0);
wid:=0;
black_naro; white_wide; black_naro; white_naro; black_wide;
white_naro; black_naro; white_naro; black_wide; white_naro;
endchar;
beginchar("Y",wdth#,hght#,0);
wid:=0;
black_wide; white_wide; black_naro; white_naro; black_wide;
white_naro; black_naro; white_naro; black_naro; white_naro;
endchar;
beginchar("Z",wdth#,hght#,0);
wid:=0;
black_naro; white_wide; black_wide; white_naro; black_wide;
white_naro; black_naro; white_naro; black_naro; white_naro;
endchar;
beginchar("-",wdth#,hght#,0); % minus
wid:=0;
black_naro; white_wide; black_naro; white_naro; black_naro;
white_naro; black_wide; white_naro; black_wide; white_naro;
endchar;
beginchar(".",wdth#,hght#,0); %period
wid:=0;
black_wide; white_wide; black_naro; white_naro; black_naro;
white_naro; black_wide; white_naro; black_naro; white_naro;
endchar;
beginchar(" ",wdth#,hght#,0); %white space
wid:=0;
black_naro; white_wide; black_wide; white_naro; black_naro;
white_naro; black_wide; white_naro; black_naro; white_naro;
endchar;
beginchar("*",wdth#,hght#,0); %ascii asterisk
wid:=0;
black_naro; white_wide; black_naro; white_naro; black_wide;
white_naro; black_wide; white_naro; black_naro; white_naro;
endchar;
beginchar("$",wdth#,hght#,0); %dollar sign
wid:=0;
black_naro; white_wide; black_naro; white_wide; black_naro;
white_wide; black_naro; white_naro; black_naro; white_naro;
endchar;
beginchar("/",wdth#,hght#,0); %forward slash
wid:=0;
black_naro; white_wide; black_naro; white_wide; black_naro;
white_naro; black_naro; white_wide; black_naro; white_naro;
endchar;
beginchar("+",wdth#,hght#,0); %plus
wid:=0;
black_naro; white_wide; black_naro; white_naro; black_naro;
white_wide; black_naro; white_wide; black_naro; white_naro;
endchar;
beginchar("%",wdth#,hght#,0); %percent sign
wid:=0;
black_naro; white_naro; black_naro; white_wide; black_naro;
white_wide; black_naro; white_wide; black_naro; white_naro;
endchar;
end; %all done
|