summaryrefslogtreecommitdiff
path: root/fonts/ruscap/ruscap10.mf
blob: 7f9dcbc4c7517953ee9d333cb8eb52e9622572cb (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
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
% ruscap10.mf
% Version 1.0
% Copyright (c) 2024, Victor Sannier with Reserved Font Name ruscap.
% This Font Software is licensed under the SIL Open Font License, Version 1.1.

font_size 10pt#;
font_quad 13pt#;

u# := 10/12 pt#; % unit
s# := 2/3 u#; % sidebearing
o# := 1/4 u#; % overshoot

% Heights
cap_height# := 9 u#;
asc_height# := 11 u#;
desc_height# := 1 u#;
crossbar_height# := 5 u#;

diag_angle := 90 + 35;
spur_width# := 1/2 u#;
spur_angle := 35;

% Pen
thick# := 5/4 u#;
thin# := 1/3 u#;
pen_angle := 65;

% Serif
serif_width# := 5/2 u#;
serif_angle := 90 / 6;

mode_setup;

o_width# := 6u#;
e# := 1/3 u#;

define_pixels(u, s);
define_whole_pixels(serif_width, spur_width, o_width);
define_whole_vertical_pixels(cap_height, asc_height, desc_height);
define_blacker_pixels(thick, thin);
define_good_y_pixels(crossbar_height);
define_corrected_pixels(o, e);

pickup pensquare xscaled thick yscaled thin rotated pen_angle;
rustic_pen := savepen;

font_slant 0;
font_normal_space 3/4 o_width#;
font_normal_stretch 1/3 o_width#;
font_normal_shrink 1/2 o_width#;
font_x_height cap_height#;

% Macros

def draw_serif(suffix i, j)(expr width) =
	rt x.j - lft x.i = width; y.i = y.j;
	draw z.i{dir serif_angle} .. {dir serif_angle}z.j;
enddef;

def draw_diag_stroke(suffix i, j)(expr angle) =
	z.i - z.i.l = z.j.r - z.j = spur_width * dir spur_angle;
 	z.j - z.i = whatever * (dir angle);
	draw z.i.l .. z.i .. tension 3 .. z.j .. z.j.r;
enddef;

def draw_I(suffix i, j, k, l)(expr sw) =
	x.i = x.j;  % vertical stem
	top y.i = h + o; bot y.j = 0;
	z.i - z.i.l
	  = spur_width * dir spur_angle;

	% Serif
	rt (2 x.j - x.k) - lft x.k = serif_width;
	y.j = y.k;
	draw_serif(k, l)(sw);

	draw z.i.l .. z.i .. tension 5 .. z.j;
enddef;

def draw_P(suffix i, j, k, l, m)(expr w) =
	lft x.k = s;
	draw_I(i, j, k, l)(serif_width);
	rt x.m = w - s;
	y.m = crossbar_height + 1/2 (cap_height - crossbar_height);
	draw z.i{right} .. z.m .. {left}(x.i + e, crossbar_height);
enddef;

% Characters

beginchar("A", 8u# + 2u#, cap_height#, 0);
	"Rustic A";
	pickup rustic_pen;

	top y1 = h + o; bot y2 = -o; rt x2.r = w - s;
	draw_diag_stroke(1, 2)(diag_angle);

	lft x5 = s; bot y5 = 0;
	z3 = 1/5 [z1, z2];
	z4 = 1/2 [z5, z6];
        draw_serif(5, 6)(serif_width);
	draw z3 .. z4;

	labels(range 1 thru 6);
	labels(1.l, 2.r);
endchar;

beginchar("B", 5u# + 2s#, cap_height#, 0);
	"Rustic B";
	pickup rustic_pen;
	draw_P(1, 2, 3, 4, 5)(5u);
	rt x6 = w - s; y6 = crossbar_height / 2;
	draw (x1, crossbar_height){right} .. z6 .. {left}z4;
	labels(range 1 thru 6);
endchar;
 
beginchar("C", 5u# + 2s#, cap_height#, 0);
	"Rustic C";
	pickup rustic_pen;
	rt x1 = w - s; y1 = (crossbar_height + cap_height) / 2;
	x2 = w / 2; top y2 = h + o;
	lft x3 = s; y3 = cap_height - crossbar_height;
	x4 = w / 2; bot y4 = 0;
	rt x5 = w - s; bot y5 = 0;
	draw z1 .. z2 .. z3.. z4 .. {right}z5;
	labels(range 1 thru 5);
endchar;

beginchar("D", 5u# + 2s#, cap_height#, 0);
	"Rustic D";
	pickup rustic_pen;
	lft x3 = s;
	draw_I(1, 2, 3, 4)(serif_width);
	rt x5 = w - s; y5 = crossbar_height;
	draw z1{right} .. z5 .. {left}z4;
	labels(range 1 thru 5);
endchar;

def draw_EF =
	pickup rustic_pen;
	% Top stroke
	lft x1 = s; top y1 = h;
	rt x2 = w - s; top y2 = h;
	draw z1{dir serif_angle} .. {dir serif_angle}z2;
	% Down stroke
	rt (2 x5 - x1) - lft x1 = serif_width;
	x6 = x5; top y5 = h; bot y6 = 0;
	draw z5 .. z6;
	% Bottom stroke
	lft x3 = s; bot y3 = 0; bot y4 = 0;
	draw z3{dir serif_angle} .. {dir serif_angle}z4;
	% Middle stroke
	z7 = (x5, crossbar_height); z8 = (x2, crossbar_height);
	draw z7 .. z8;
	labels(range 1 thru 8);
enddef;

beginchar("E", 3.5u# + 2s#, cap_height#, 0);
	"Rustic E";
	x4 = x2;
	draw_EF;
endchar;

beginchar("F", 4u# + 2s#, asc_height#, 0);
	"Rustic F";
	x6 = (x3 + x4) / 2;
	draw_EF;
endchar;

beginchar("G", 5u# + 2s#, cap_height#, 0);
	"Rustic G";
	pickup rustic_pen;
	rt x1 = w - s; y1 = (crossbar_height + cap_height) / 2;
	x2 = w / 2; top y2 = h + o;
	lft x3 = s; y3 = cap_height - crossbar_height;
	x4 = w / 2; bot y4 = -o;
	rt x5 = w - s; y5 = cap_height - crossbar_height;
	draw z1 .. z2 .. z3.. z4 .. z5;
	labels(range 1 thru 5);
endchar;

beginchar("H", 7u# + 2s#, cap_height#, 0);
	"Rustic H";
	pickup rustic_pen;
	lft x9 = s; y9 = crossbar_height;
	x1 - x9 = u;
	draw_I(1, 2, 3, 4)(serif_width);
	rt x8 = w - s;
	draw_I(5, 6, 7, 8)(serif_width);
	draw z9 .. (x5, crossbar_height);
	labels(range 1 thru 9);
endchar;

beginchar("I", serif_width# + 2s#, cap_height#, 0);
	"Rustic I";
	pickup rustic_pen;
	lft x3 = s;
	draw_I(1, 2, 3, 4)(serif_width);
	labels(range 1 thru 4);
endchar;

beginchar("K", 7u# + 2s#, cap_height#, 0);
	"Rustic K";
	pickup rustic_pen;
	lft x3 = s;
	draw_I(1, 2, 3, 4)(serif_width);
	x5 = x6 - 2u; top y5 = h + o;
	rt x6 = w - s; bot y6 = 0;
	draw (x1 + e, crossbar_height) .. {dir pen_angle}z5;
	draw (x1 + e, crossbar_height) .. tension 2 .. z6 - (u, 0) .. z6;
	labels(range 1 thru 6);
endchar;
 
beginchar("L", 5u# + 2s#, asc_height#, 0);
	"Rustic L";
	pickup rustic_pen;
	lft x3 = s;
	draw_I(1, 2, 3, 4)(w - 2s);
	labels(range 1 thru 4);
	labels(1.l);
endchar;

beginchar("M", 11u# + 2s#, cap_height#, 0);
	"Rustic M";
	pickup rustic_pen;
	top y1 = h + o; bot y2 = -o;
	x1 = x5 + u;
	1/2 (z5.l + z5.r) = z5; lft x5 = s + serif_width/2;
	a := (diag_angle - 90) * 3/4 + 90;
	draw_diag_stroke(1, 2)(a);
	top y3 = h + o; bot y4 = 0; rt x4.r = w - s;
	a := (diag_angle - 90) / 3 + 90;
	draw_diag_stroke(3, 4)(a);

	% Left stem
	bot y5 = 0;
	draw z1 .. z5;
	draw_serif(5.l, 5.r, serif_width);
	% Right stem
	draw z3 .. z2.r;

	labels(range 1 thru 5);
endchar;

beginchar("N", 8u# + 2s#, cap_height#, 0);
	"Rustic N";
	pickup rustic_pen;

	% Diagonal stroke
	x1 + x2 = w; top y1 = h + o; bot y2 = 0;
	draw_diag_stroke(1, 2)(diag_angle);

	% Left stem
	bot y3 = 0; lft x3 = s + serif_width/2 - u/3;
	draw z1 .. z3;
	1/2 (z3.l + z3.r) = z3;
	draw_serif(3.l, 3.r, serif_width);

	% Right stem
	x4 = x5 = x2.r;  % vertical stem
	top y4 = h + o; bot y5 = 0;
	z4 - z4.l = spur_width * dir spur_angle;
	draw z4.l .. z4 -- z5;

	labels(range 1 thru 5);
endchar;

beginchar("O", o_width# + 2s#, cap_height#, 0);
	"Rustic O";
	pickup rustic_pen;
	lft x2 = s; rt x4 = w - s; x1 = x3 = w/2;
	top y1 = h + o; bot y3 = -o; y2 = y4 = crossbar_height;
	draw z1 .. z2 .. z3 .. z4 .. cycle;
	labels(range 1 thru 4);
endchar;

beginchar("P", 4u# + 2s#, cap_height#, 0);
	"Rustic P";
	pickup rustic_pen;
	draw_P(1, 2, 3, 4, 5)(w);
	labels(range 1 thru 5);
endchar;
 
beginchar("Q", 6u# + 2s#, cap_height#, u#);
	"Rustic Q";
	pickup rustic_pen;
	lft x2 = s; rt x4 = o_width + s; x1 = x3 = (o_width + 2s)/2;
	top y1 = h + o; bot y3 = -o; y2 = y4 = crossbar_height;
	rt x5 = w - s; bot y5 = -d;
	draw z3{curl 3} .. z4 .. z1 .. z2 .. z3 .. {down}z5;
	labels(range 1 thru 5);
endchar;

beginchar("R", 7u# + 2s#, cap_height#, 0);
	"Rustic P";
	pickup rustic_pen;
	draw_P(1, 2, 3, 4, 5)(5u);
	rt x6 = w - s; bot y6 = 0;
	draw (x1 + u, crossbar_height) .. tension 2 .. z6 - (u, 0) .. z6;
	labels(range 1 thru 6);
endchar;

beginchar("S", 4u# + 2s#, cap_height#, 0);
	"Rustic S";
	pickup rustic_pen;
	lft x2 = s; x2 = x4;
	rt x1 = w - s; x1 = x3;
	top y1 = h - 3/2 u; bot y4 = u/2;
	h - y2 = y3; z2 - z3 = whatever * dir diag_angle;
	draw z1{curl 2} .. z2 .. z3 .. {curl 1}z4;
	labels(range 1 thru 4);
endchar;

beginchar("T", 6u# + 2s#, cap_height#, 0);
	"Rustic T";
	pickup rustic_pen;
	x1 = w - x2; top y1 = h;
	draw_serif(1, 2)(w - 2s);
	x3 = w - x4; bot y3 = 0;
	draw_serif(3, 4)(serif_width);
	draw 1/2 [z1, z2] .. 1/2 [z3, z4];
	labels(range 1 thru 4);
endchar;

beginchar("V", 6u# + 2s#, cap_height#, 1/2 u#);
	"Rustic V";
	pickup rustic_pen;
	lft x1 = s + spur_width; rt x3 = rt x4 = rt x5 = w - s - u/2;
	top y1 = h + o; bot y3 = u; top y4 = h + o; bot y5 = -d;
	bot y2 = 0; lft x2 = 5/2 u + s;
	draw z1{down} .. z2 .. z3{right};
	z1 - z1.l = spur_width * dir spur_angle; draw z1.l .. z1; % Spur
	draw z4{dir -85} .. z5;
	labels(range 1 thru 5);
endchar;

beginchar("X", 7u# + 2s#, cap_height#, 0);
	"Rustic X";
	pickup rustic_pen;
	top y1 = h + o; bot y2 = 0; rt x2.r = w - s;
	draw_diag_stroke(1, 2)(diag_angle);
	draw (x1, y2) .. (x2, y1);
	labels(range 1 thru 4);
endchar;

beginchar("Y", 8u# + 2s#, cap_height#, 0);
	"Rustic Y";
	pickup rustic_pen;
	x2 = x3 = w/2;
	lft x1 = s; rt x4 = w - s;
	bot y3 = 0;
	top y1 = top y4 = h + o; y2 = crossbar_height;
	draw z1 .. z2 .. tension 2 .. z3;
	draw z4{left} .. z2;
	% Serif
	1/2 (z3.l + z3.r) = z3;
	draw_serif(3.l, 3.r, serif_width);
	labels(range 1 thru 4);
endchar;

beginchar("Z", 6u# + 2s#, cap_height#, 0);
	"Rustic Z";
	pickup rustic_pen;
	lft x1 = s; top y1 = h;
	draw_serif(1, 2)(w - 2s);
	lft x3 = s; bot y3 = 0;
	draw_serif(3, 4)(w - 2s);
	draw z2 .. z3;
	labels(range 1 thru 4);
endchar;

ligtable "A": "T" kern -1.5u#, "Y" kern -1.5u#;
ligtable "B": "C" kern .5u#, "M" kern -u#;
ligtable "F": "A" kern -.5u#, "M" kern -u#, "T" kern -u#;
ligtable "G": "C" kern .5u#, "Q" kern .5u#, "G" kern .5u#, "O" kern .5u#;
ligtable "K": "C" kern -u#, "G" kern -u#, "T" kern -u#, "Y" kern -u#;
ligtable "L": "T" kern -u#, "Y" kern -2u#;
ligtable "M": "T" kern -u#;
ligtable "O": "M" kern -.5u#;
ligtable "P": "A" kern -.5u#, "M" kern -.5u#;
ligtable "R": "C" kern -.5u#, "O" kern -u#, "T" kern -u#, "Y" kern -1.5u#;
ligtable "T": "A" kern -u#, "H" kern -u#, "M" kern -u#;
ligtable "V": "M" kern -u#;
ligtable "Y": "M" kern -u#;

end;