summaryrefslogtreecommitdiff
path: root/fonts/kixfont/kix.mf
blob: 8ac60382909349067d02907f929b15634dfaecbb (plain)
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
% KIX, a font for typesetting snail mail zipcodes.
%
% The KIX code is a barcodish format used to encode country codes, zip codes
% and street numbers in a machine-readable format.  If printed below the
% address line on bulk mailings, a discount can be obtained.
%
% This font is according to the Dutch specifications.  The sizes are
% optimal for printing on a printer with a resolution which is a multiple
% of 150dpi.  This optimisation means that the sizes in the TFM file for
% this font match almost exactly on an integer number of pixels.
%
% Install this font in your TeX distribution and update any distro caches.
% Include this file with \font\kix=kix and use it to format properly coded
% KIX-information, for instance {\kix 1234AB56} for zipcode 1234AB and street
% number 56.  For more information on the data to encode in KIX, please refer
% to the following site in Dutch:
%	http://www.tpgpostbusiness.nl/kix/
% KIX is also used in a few other countries, but not worldwide.
%
% Metafont scripting by Rick van Rein, KIX-knowledge from Ivo Terhorst.
%
% Available for any purpose, no warranties.


mode_setup;
font_identifier "kix";


% The bar in the code is barw# wide, spaces are #spcw wide
% The sync portion is synch# high, plus additional stickh# to either side
barw#   := 0.508mm#;
spcw#   := 0.677mm#;
synch#  := 1.27mm#;
stickh# := 2.08mm#;

define_pixels (barw, spcw, synch, stickh);


% Character dimensions:
%  wd, ht, dp

wd# := 4 * (barw# + spcw#);
ht# := synch# + stickh# + 2mm#;
dp# := stickh#;

define_pixels (wd, ht, dp)


% Routine to start a character definition

def defchar (expr ch) =
	beginchar (ch, wd#, ht#, dp#);
	x := 0;
enddef;

% Routine to draw a sync alone

def sync =
	fill (x,0)--(x+barw,0)--(x+barw,synch)--(x,synch)--cycle;
	x := x + barw + spcw
enddef;

% Routine to draw a stick down

def down =
	fill (x,-stickh)--(x+barw,-stickh)--(x+barw,synch)--(x,synch)--cycle;
	x := x + barw + spcw
enddef;

% Routine to draw a stick up

def up =
	fill (x,0)--(x+barw,0)--(x+barw,synch+stickh)--(x,synch+stickh)--cycle;
	x := x + barw + spcw
enddef;

% Routine to draw a long line

def updown =
	fill (x,-stickh)--(x+barw,-stickh)--(x+barw,synch+stickh)--(x,synch+stickh)--cycle;
	x := x + barw + spcw
enddef;

defchar ("1"); sync; down; up; updown; endchar;
defchar ("2"); sync; down; updown; up; endchar;
defchar ("3"); down; sync; up; updown; endchar;
defchar ("4"); down; sync; updown; up; endchar;
defchar ("5"); down; down; up; up; endchar;
defchar ("6"); sync; up; down; updown; endchar;
defchar ("7"); sync; updown; sync; updown; endchar;
defchar ("8"); sync; updown; down; up; endchar;
defchar ("9"); down; up; sync; updown; endchar;
defchar ("0"); sync; sync; updown; updown; endchar;
defchar ("A"); down; up; down; up; endchar;
defchar ("B"); down; updown; sync; up; endchar;
defchar ("C"); sync; up; updown; down; endchar;
defchar ("D"); sync; updown; up; down; endchar;
defchar ("E"); sync; updown; updown; sync; endchar;
defchar ("F"); down; up; up; down; endchar;
defchar ("G"); down; up; updown; sync; endchar;
defchar ("H"); down; updown; up; sync; endchar;
defchar ("I"); up; sync; down; updown; endchar;
defchar ("J"); up; down; sync; updown; endchar;
defchar ("K"); up; down; down; up; endchar;
defchar ("L"); updown; sync; sync; updown; endchar;
defchar ("M"); updown; sync; down; up; endchar;
defchar ("N"); updown; down; sync; up; endchar;
defchar ("O"); up; sync; updown; down; endchar;
defchar ("P"); up; down; up; down; endchar;
defchar ("Q"); up; down; updown; sync; endchar;
defchar ("R"); updown; sync; up; down; endchar;
defchar ("S"); updown; sync; updown; sync; endchar;
defchar ("T"); updown; down; up; sync; endchar;
defchar ("U"); up; up; down; down; endchar;
defchar ("V"); up; updown; sync; down; endchar;
defchar ("W"); up; updown; down; sync; endchar;
defchar ("X"); updown; up; sync; down; endchar;
defchar ("Y"); updown; up; down; sync; endchar;
defchar ("Z"); updown; updown; sync; sync; endchar;

end