summaryrefslogtreecommitdiff
path: root/fonts/capbas/deseg.mf
blob: 3f4a90193876922efa1a1ea4aedabc011c4757c9 (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
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
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
%%% @mffile{
%%%     filename="deseg.mf",
%%%     version="",
%%%     date="",
%%%     filetype="mf fontcreator",
%%%     package="m-capbas.arj"
%%%     author="Phons Bloemen (PhB)",
%%%     address="Eindhoven U. of Technology"
%%%     email="Internet: phons@ei.ele.tue.nl",
%%%     codetable="ISO/ASCII",
%%%     checksumtype="none",
%%%     checksum="0",
%%%     keywords="",
%%%     abstract="
%%%        Input file defining the glyphs for 14 segment ('star')
%%%        display font.
%%%        The font is drawn onto a fixed 'grid' of points. By
%%%        deformation of this 'square' grid special effects can
%%%        be achieved.
%%%        Part of Capital Baseball package"
%%%     copyright="Copyleft (L) Phons Bloemen (PhB),
%%%        according to GNU public licence version 2 or later.
%%%        (1) Do not change this file (even its name)
%%%        (2) if you do make changes, first rename it to some
%%%            other name, and mark your changes clearly.",
%%%     }
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%if unknown cmbase: input cmbase fi
%def generate suffix t= enddef;
%input cmtt10; font_setup;
%% get some definitions from cmtt10 for proper setup
%% do not ask why this sequence is used, it works!
mode_setup;

if unknown gensize: gensize := 10; fi;
em# := gensize * 0.5pt#;
slant := 0.1;
tpp := 0.03;
tcr := 0.15;
font_coding_scheme:="TeX text";
font_identifier:="DESEG";
font_size gensize * 1pt#;
body_height#:=1.6em#;  % height of tallest characters
asc_height#:=1.6em#;    % height of lowercase ascenders
cap_height#:=1.6em#;    % height of caps
fig_height#:=1.6em#;    % height of numerals
x_height#:=1.6em#;    % height of lowercase without ascenders
math_axis#:=1.6em#;    % axis of symmetry for math symbols
bar_height#:=1.6em#;    % height of crossbar in lowercase e
comma_depth#:=0.1em#;    % depth of comma below baseline
desc_depth#:=0em#;    % depth of lowercase descenders
%% monospace := false;
%% font_setup;
font_normal_space 1.5 * em#;
font_quad 6em#;
font_extra_space 1.5 * em#;

%%% definitions for the corners of the 14-segment display

def cornern (suffix $) =
  z$n = z$ + (0,1*tf)        + (0,-tcr *tf)  ;
  z$nl = z$ + (-1*tf,3*tf) + (-tcr * tf, 0);
  z$nr = z$ + (1*tf,3*tf)  + (tcr *tf, 0)  ;
  labels($n);
enddef;
def cornere (suffix $) =
  z$e = z$ + (1*tf,0)      + (-tcr *tf,0)  ;
  z$el = z$ + (3*tf,1*tf)  + (0,tcr * tf);
  z$er = z$ + (3*tf,-1*tf) + (0,-tcr *tf)  ;
  labels($e);
enddef;
def corners (suffix $) =
  z$s = z$ + (0,-1*tf)     + (0,tcr *tf)  ;
  z$sl = z$ + (1*tf,-3*tf) + (tcr * tf, 0);
  z$sr = z$ + (-1*tf,-3*tf)+ (-tcr *tf, 0)  ;
  labels($s);
enddef;
def cornerw (suffix $) =
  z$w = z$ + (-1*tf,0)     + (tcr *tf,0)  ;
  z$wl = z$ + (-3*tf,-1*tf)+ (0,-tcr * tf);
  z$wr = z$ + (-3*tf,1*tf) + (0,tcr *tf)  ;
  labels($w);
enddef;
def cornerne (suffix $) =
  z$ne = z$ + (1*tf,1*tf)        + (0,-tcr *tf)  ;
  z$nel = z$ + (2*tf,4*tf) + (-tcr * tf, 0);
  z$ner = z$ + (4*tf,2*tf)  + (tcr *tf, 0)  ;
  labels($ne);
enddef;
def corneres (suffix $) =
  z$es = z$ + (1*tf,-1*tf)      + (-tcr *tf,0)  ;
  z$esl = z$ + (4*tf,-2*tf)  + (0,tcr * tf);
  z$esr = z$ + (2*tf,-4*tf) + (0,-tcr *tf)  ;
  labels($es);
enddef;
def cornersw (suffix $) =
  z$sw = z$ + (-1*tf,-1*tf)     + (0,tcr *tf)  ;
  z$swl = z$ + (-2*tf,-4*tf) + (tcr * tf, 0);
  z$swr = z$ + (-4*tf,-2*tf)+ (-tcr *tf, 0)  ;
  labels($sw);
enddef;
def cornerwn (suffix $) =
  z$wn = z$ + (-1*tf,1*tf)     + (tcr *tf,0)  ;
  z$wnl = z$ + (-4*tf,2*tf)+ (0,-tcr * tf);
  z$wnr = z$ + (-2*tf,4*tf) + (0,tcr *tf)  ;
  labels($wn);
enddef;

def seg(expr a) =
if a = 1 :
  cornere(1); cornerw(2);
  fill(z1e -- z1el -- z2wr -- z2w -- z2wl -- z1er -- cycle);
elseif a = 2 :
  cornern(1); corners(3);
  fill(z1n -- z1nl -- z3sr -- z3s -- z3sl -- z1nr -- cycle);
elseif a = 3 :
  cornern(3); corners(5);
  fill(z3n -- z3nl -- z5sr -- z5s -- z5sl -- z3nr -- cycle);
elseif a = 4 :
  cornere(5); cornerw(6);
  fill(z5e -- z5el -- z6wr -- z6w -- z6wl -- z5er -- cycle);
elseif a = 5 :
  cornern(4); corners(6);
  fill(z4n -- z4nl -- z6sr -- z6s -- z6sl -- z4nr -- cycle);
elseif a = 6 :
  cornern(2); corners(4);
  fill(z2n -- z2nl -- z4sr -- z4s -- z4sl -- z2nr -- cycle);
elseif a = 7 :
  cornere(3); cornerw(7);
  fill(z3e -- z3el -- z7wr -- z7w -- z7wl -- z3er -- cycle);
elseif a = 8 :
  corneres(5); cornerwn(7);
  fill(z5es -- z5esl -- z7wnr -- z7wn -- z7wnl -- z5esr -- cycle);
elseif a = 9 :
  corners(8); cornern(7);
  fill(z8s -- z8sl -- z7nr -- z7n -- z7nl -- z8sr -- cycle);
elseif a = 10 :
  cornersw(6); cornerne(7);
  fill(z6sw -- z6swl -- z7ner -- z7ne -- z7nel -- z6swr -- cycle);
elseif a = 11 :
  cornerw(4); cornere(7);
  fill(z4w -- z4wl -- z7er -- z7e -- z7el -- z4wr -- cycle);
elseif a = 12 :
  cornerwn(2); corneres(7);
  fill(z2wn -- z2wnl -- z7esr -- z7es -- z7esl -- z2wnr -- cycle);
elseif a = 13 :
  cornern(9); corners(7);
  fill(z9n -- z9nl -- z7sr -- z7s -- z7sl -- z9nr -- cycle);
elseif a = 14 :
  cornerne(1); cornersw(7);
  fill(z1ne -- z1nel -- z7swr -- z7sw -- z7swl -- z1ner -- cycle);
elseif a = 15 :
  pickup pencircle scaled (3*tf);
  z2p = z2 + (2 *tf,0);
  drawdot(z2p);
elseif a = 16 :
  pickup pencircle scaled (3*tf);
  z2p = z2 + (3 *tf, 0);
  z2p1 = z2 + (1 *tf, 0);
  z2p2 = z2 + (3 *tf, -2 * tf);
  z2p3 = z2 + (0, -5 * tf);
  fill(z2p1 -- z2p2 -- z2p3 -- cycle);
  drawdot(z2p);
fi;
enddef;

def segchar(expr c)(text t) =
beginchar((char c), (1+2*slant)*em#, 1.6 * em#,0)
  clearit;
  tf := tpp * w;
  z1 = (tf,tf);
  z6 = (w-2*slant*w-tf-tf,h-tf);
  z5 = (slant*w+tf,h-tf);
  z2-z1 = z6-z5;
  z3 = 0.5[z1,z5];
  z4 = 0.5[z2,z6];
  z8 = 0.5[z5,z6];
  z9 = 0.5[z1,z2];
  z7 = 0.5[z3,z4];
  for a = t:
    seg(a);
  endfor;
endchar;
enddef;

def segpoint(expr c)(text t) =
beginchar((char c), 3 * tpp * em#, 2 * tpp * em#, 2 * tpp * em#)
  clearit;
  tf := 0.3 * w;
  z2 = (-2*w,0);
  for a = t:
    seg(a);
  endfor;
endchar;
enddef;

%%% The space character is special

beginchar(32,1*em#,2*em#,0);
endchar;

%%% The 'flychar' characters follow (upper and lower case!)

segchar(33)(5,15);
segchar(34)(3,5);
segchar(35)(1,2,3,4,5,6,7,9,11,13);
segchar(36)(1,3,7,4,6,9,11,13);
segchar(37)(1,3,4,6,14,10);
segchar(38)(1,2,3,6,7,9);
segchar(39)(10);
segchar(40)(10,13,1);
segchar(41)(8,13,1);
segchar(42)(7,8,9,10,11,12,13,14);
segchar(43)(7,9,11,13);
segpoint(44)(15);
segchar(45)(7,11);
segpoint(46)(16);
segchar(47)(14,10);
segchar(48)(1,2,3,14,10,4,5,6);
segchar(49)(5,6);
segchar(50)(4,5,11,14,1);
segchar(51)(4,10,11,6,1);
segchar(52)(3,7,5,6,11);
segchar(53)(4,3,7,12,1);
segchar(54)(4,3,7,11,6,1,2);
segchar(55)(4,10,13);
segchar(56)(1,2,3,4,5,6,7,11);
segchar(57)(1,6,5,4,3,7,11);
segchar(58)(11,8);
segchar(59)(11,9);
segchar(60)(10,12);
segchar(61)(4,7,11);
segchar(62)(8,14);
segchar(63)(4,5,15);
segchar(64)(3,4,5,7,9,6,1);
segchar(65)(2,3,4,5,6,7,11);
segchar(66)(1,4,5,6,11,9,13);
segchar(67)(1,2,3,4);
segchar(68)(1,4,5,6,9,13);
segchar(69)(1,2,3,4,7);
segchar(70)(2,3,4,7);
segchar(71)(1,2,3,4,6,11);
segchar(72)(2,3,5,6,7,11);
segchar(73)(4,9,13,1);
segchar(74)(1,5,6);
segchar(75)(2,3,7,10,12);
segchar(76)(1,2,3);
segchar(77)(2,3,8,10,5,6);
segchar(78)(2,3,8,12,5,6);
segchar(79)(1,2,3,4,5,6);
segchar(80)(2,3,4,5,7,11);
segchar(81)(1,2,3,4,5,6,12);
segchar(82)(2,3,4,5,7,11,12);
segchar(83)(4,8,12,1);
segchar(84)(4,9,13);
segchar(85)(1,2,3,5,6);
segchar(86)(2,3,14,10);
segchar(87)(2,3,14,12,5,6);
segchar(88)(8,10,12,14);
segchar(89)(8,10,13);
segchar(90)(4,10,14,1);
segchar(91)(4,3,2,1);
segchar(92)(8,12);
segchar(93)(4,5,6,1);
segchar(94)(14,12);
segchar(95)(1);
segchar(96)(8);
segchar(97)(1,12,7,2);
segchar(98)(1,12,7,3,2);
segchar(99)(1,2,7);
segchar(100)(1,14,11,5,6);
segchar(101)(1,2,7,14);
segchar(102)(10,11,7,13);
segchar(103)(1,5,6,10,11);
segchar(104)(2,3,6,7,11);
segchar(105)(7,11,13,1);
segchar(106)(1,11,6);
segchar(107)(2,3,7,10,12);
segchar(108)(1,2);
segchar(109)(2,3,8,10,5,6);
segchar(110)(2,7,12);
segchar(111)(1,2,7,11,6);
segchar(112)(2,3,4,5,7,11);
segchar(113)(3,4,5,6,7,11);
segchar(114)(11,13);
segchar(115)(11,12,1);
segchar(116)(3,7,2,1);
segchar(117)(1,2,6);
segchar(118)(2,14);
segchar(119)(2,14,12,6);
segchar(120)(8,10,12,14);
segchar(121)(8,10,13);
segchar(122)(7,14,1);
segchar(123)(4,8,14,1);
segchar(124)(9,13);
segchar(125)(4,10,12,1);
segchar(126)(14,12);
bye.