]> git.donarmstrong.com Git - lilypond.git/blob - mf/parmesan-rests.mf
5beeedc1b2da7e5703bec6f87d9a53c600062976
[lilypond.git] / mf / parmesan-rests.mf
1 % -%-Fundamental-%- -*-Metafont-*-
2 % parmesan-rests.mf -- implement ancient rests
3
4 % source file of LilyPond's pretty-but-neat music font
5
6 % (c) 2001--2007 Juergen Reuter <reuter@ipd.uka.de>
7
8 % Neo-mensural rests originally by
9 % Christian Mondrup and Mats Bengtsson.
10
11
12 fet_begingroup ("rests")
13
14
15 %%%%%%%%
16 %
17 %
18 %
19 % NEO-MENSURAL NOTATION
20 %
21 %
22 %
23
24 % Neo-mensural longa and breve are identical with default longa and breve.
25
26 neomens_block_rest_x# = 2/5 staff_space#;
27 neomens_block_rest_y# = 1/1 staff_space#;
28 neomens_half_block_rest_y# = 5/8 staff_space#;
29
30 define_pixels (neomens_block_rest_x,
31                neomens_block_rest_y,
32                neomens_half_block_rest_y);
33
34
35 def neomens_half_block_rest =
36         draw_block ((0, 0),
37                     (neomens_block_rest_x, neomens_half_block_rest_y));
38 enddef;
39
40
41 fet_beginchar ("Neo-mensural maxima rest", "M3neomensural");
42         set_char_box (0, 3 neomens_block_rest_x#,
43                       neomens_block_rest_y#, neomens_block_rest_y#);
44
45         draw_block ((0, -neomens_block_rest_y),
46                      (neomens_block_rest_x, neomens_block_rest_y));
47         addto currentpicture also currentpicture
48                 shifted (2 neomens_block_rest_x, 0);
49 fet_endchar;
50
51
52 fet_beginchar ("Neo-mensural longa rest", "M2neomensural");
53         set_char_box (0, neomens_block_rest_x#,
54                       neomens_block_rest_y#, neomens_block_rest_y#);
55
56         draw_block ((0, -neomens_block_rest_y),
57                     (neomens_block_rest_x, neomens_block_rest_y));
58 fet_endchar;
59
60
61 fet_beginchar ("Neo-mensural breve rest", "M1neomensural");
62         set_char_box (0, neomens_block_rest_x#,
63                       0, neomens_block_rest_y#);
64
65         draw_block ((0, 0),
66                     (neomens_block_rest_x, neomens_block_rest_y));
67 fet_endchar;
68
69
70 fet_beginchar ("Neo-mensural whole rest", "0neomensural");
71         set_char_box (0, neomens_block_rest_x#,
72                       neomens_half_block_rest_y#,  0);
73
74         neomens_half_block_rest;
75         currentpicture :=
76                 currentpicture shifted (0, -neomens_half_block_rest_y);
77 fet_endchar;
78
79
80 fet_beginchar ("Neo-mensural half rest", "1neomensural");
81         set_char_box (0, neomens_block_rest_x#,
82                       0, neomens_half_block_rest_y#);
83
84         neomens_half_block_rest;
85 fet_endchar;
86
87
88 neomensrestsize# = 0.8 staff_space#;
89
90
91 fet_beginchar ("Neo-mensural 4th rest", "2neomensural");
92         set_char_box (0, neomensrestsize#,
93                       0, neomensrestsize#);
94
95         pickup pencircle scaled 2 stafflinethickness;
96
97         lft x1 = 0;
98         bot y1 = 0;
99         lft x2 = lft x3 = 0;
100         top y2 = top y3 = h;
101         rt x4 = w;
102         bot y4 = h / 2;
103
104         z11 = z1 - stafflinethickness * unitvector (z2 - z1);
105         z14 = z4 + stafflinethickness * unitvector (z4 - z3);
106
107         penpos1 (2 stafflinethickness, 0);
108         penpos2 (2 stafflinethickness, 0);
109         penpos3 (2 stafflinethickness, angle (z4 - z3) - 90);
110         penpos4 (2 stafflinethickness, angle (z4 - z3) - 90);
111
112         fill z1l
113              -- z2l
114              -- z2r
115              -- z1r
116              .. z11
117              .. z1l
118              .. cycle;
119         fill z3l
120              -- z4l
121              .. z14
122              .. z4r
123              -- z3r
124              .. z2l{up}
125              .. z3l
126              .. cycle;
127
128         penlabels (1, 2, 3, 4);
129         labels (11, 14);
130 fet_endchar;
131
132
133 fet_beginchar ("Neo-mensural 8th rest", "3neomensural");
134         set_char_box (0, neomensrestsize#,
135                       0, neomensrestsize#);
136
137         pickup pencircle scaled 2 stafflinethickness;
138
139         rt x1 = w;
140         bot y1 = 0;
141         rt x2 = rt x3 = w;
142         top y2 = top y3 = h;
143         lft x4 = 0;
144         bot y4 = h / 2;
145
146         z11 = z1 - stafflinethickness * unitvector (z2 - z1);
147         z14 = z4 + stafflinethickness * unitvector (z4 - z3);
148
149         penpos1 (2 stafflinethickness, 0);
150         penpos2 (2 stafflinethickness, 0);
151         penpos3 (2 stafflinethickness, angle (z4 - z3) - 90);
152         penpos4 (2 stafflinethickness, angle (z4 - z3) - 90);
153
154         fill z1l
155              -- z2l
156              -- z2r
157              -- z1r
158              .. z11
159              .. z1l
160              .. cycle;
161         fill z3l
162              -- z4l
163              .. z14
164              .. z4r
165              -- z3r
166              .. z2r{down}
167              .. z3l
168              .. cycle;
169
170         penlabels (1, 2, 3, 4);
171         labels (11, 14);
172 fet_endchar;
173
174
175 fet_beginchar ("Neo-mensural 16th rest", "4neomensural");
176         set_char_box (0, neomensrestsize#,
177                       0, staff_space#);
178
179         pickup pencircle scaled 2 stafflinethickness;
180
181         rt x1 = w;
182         bot y1 = 0;
183         rt x2 = w;
184         top y2 = h;
185
186         rt x3 = w;
187         top y3 = h;
188         lft x4 = 0;
189         bot y4 = h / 2;
190         rt x5 = w;
191         top y5 = 5/8 h;
192         lft x6 = 0;
193         bot y6 = h / 8;
194
195         z11 = z1 - stafflinethickness * unitvector (z2 - z1);
196         z14 = z4 + stafflinethickness * unitvector (z4 - z3);
197         z16 = z6 + stafflinethickness * unitvector (z6 - z5);
198
199         penpos1 (2 stafflinethickness, 0);
200         penpos2 (2 stafflinethickness, 0);
201         penpos3 (2 stafflinethickness, angle (z4 - z3) - 90);
202         penpos4 (2 stafflinethickness, angle (z4 - z3) - 90);
203         penpos5 (2 stafflinethickness, angle (z6 - z5) - 90);
204         penpos6 (2 stafflinethickness, angle (z6 - z5) - 90);
205
206         fill z1l
207              -- z2l
208              -- z2r
209              -- z1r
210              .. z11
211              .. z1l
212              .. cycle;
213         fill z3l
214              -- z4l
215              .. z14
216              .. z4r
217              -- z3r
218              .. z2r{down}
219              .. z3l
220              .. cycle;
221         fill z5l
222              -- z6l
223              .. z16
224              .. z6r
225              -- z5r
226              -- z5l
227              -- cycle;
228
229         penlabels (1, 2, 3, 4, 5, 6);
230         labels (11, 14, 16);
231 fet_endchar;
232
233
234 %%%%%%%%
235 %
236 %
237 %
238 % MENSURAL NOTATION
239 %
240 %
241 %
242
243 pen_width# = 0.3 staff_space#;
244 pen_height# = 0;
245 pen_rotation = 30;
246 slight_pen_rotation = 15;
247
248 mens_block_rest_y# = 1/1 staff_space#;
249 mens_half_block_rest_y# = 5/8 staff_space#;
250
251 define_pixels (mens_block_rest_y, mens_half_block_rest_y,
252                pen_width, pen_height);
253
254
255 fet_beginchar ("Mensural maxima rest", "M3mensural");
256         set_char_box (0, pen_width#,
257                       mens_block_rest_y#, 2 mens_block_rest_y#);
258
259         pickup pencircle xscaled pen_width
260                          yscaled pen_height
261                          rotated slight_pen_rotation;
262
263         draw (w / 2, -mens_block_rest_y)
264              -- (w / 2, 2 mens_block_rest_y);
265 fet_endchar;
266
267
268 fet_beginchar ("Mensural longa rest", "M2mensural");
269         set_char_box (0, pen_width#,
270                       mens_block_rest_y#, mens_block_rest_y#);
271
272         pickup pencircle xscaled pen_width
273                          yscaled pen_height
274                          rotated slight_pen_rotation;
275
276         draw (w / 2, -mens_block_rest_y)
277              -- (w / 2, mens_block_rest_y);
278 fet_endchar;
279
280
281 fet_beginchar ("Mensural breve rest", "M1mensural");
282         set_char_box (0, pen_width#,
283                       0, mens_block_rest_y#);
284
285         pickup pencircle xscaled pen_width
286                          yscaled pen_height
287                          rotated slight_pen_rotation;
288
289         draw (w / 2, 0)
290              -- (w / 2, mens_block_rest_y);
291 fet_endchar;
292
293
294 fet_beginchar ("Mensural whole rest", "0mensural");
295         set_char_box (0, pen_width#,
296                       mens_half_block_rest_y#, 0);
297
298         pickup pencircle xscaled pen_width
299                          yscaled pen_height
300                          rotated slight_pen_rotation;
301
302         draw (w / 2, 0)
303               -- (w / 2, -mens_half_block_rest_y);
304 fet_endchar;
305
306
307 fet_beginchar ("Mensural half rest", "1mensural");
308         set_char_box (0, pen_width#,
309                       0, mens_half_block_rest_y#);
310
311         pickup pencircle xscaled pen_width
312                          yscaled pen_height
313                          rotated slight_pen_rotation;
314
315         draw (w / 2, 0)
316               -- (w / 2, mens_half_block_rest_y);
317 fet_endchar;
318
319
320 mensrestsize# = .8 staff_space#;
321
322
323 fet_beginchar ("Mensural 4th rest", "2mensural");
324         set_char_box (0, mensrestsize#,
325                       0, mensrestsize#);
326
327         pickup pencircle xscaled pen_width
328                          yscaled pen_height
329                          rotated pen_rotation;
330
331         lft x1 = 0;
332         y1 = 0;
333         lft x2 = 0;
334         top y2 = 5/8 h;
335         rt x3 = 1/5 w;
336         bot y3 = 6/8 h;
337         rt x4 = w;
338         bot y4 = 4/8 h;
339
340         draw z1
341              -- z2
342              -- z3
343              -- z4;
344
345         labels (1, 2, 3, 4);
346 fet_endchar;
347
348 %
349 % FIXME: The left sharp corner produces ugly results at lower resolutions.
350 %
351 fet_beginchar ("Mensural 8th rest", "3mensural");
352         set_char_box (0, mensrestsize#,
353                       0, mensrestsize#);
354
355         pickup pencircle xscaled pen_width
356                          yscaled pen_height
357                          rotated pen_rotation;
358
359         rt x1 = w;
360         y1 = 0;
361         rt x2 = w;
362         top y2 = 5/8 h;
363         lft x3 = 1/5 w;
364         bot y3 = 6/8 h;
365         lft x4 = 0;
366         bot y4 = 4/8 h;
367
368         draw z1
369              -- z2
370              -- z3
371              -- z4;
372
373         labels (1, 2, 3, 4);
374 fet_endchar;
375
376 %
377 % FIXME: So far, I have never seen a semifusa rest printed.  Hence,
378 % the shape of this font character is currently pure invention.  --jr
379 %
380 %
381 % FIXME: The left sharp corner produces ugly results at lower resolutions.
382 %
383 fet_beginchar ("Mensural 16th rest", "4mensural");
384         set_char_box (0, mensrestsize#,
385                       0, staff_space#);
386
387         pickup pencircle xscaled pen_width
388                          yscaled pen_height
389                          rotated pen_rotation;
390
391         rt x1 = w;
392         y1 = 0;
393         rt x2 = w;
394         top y2 = 5.5/8 h;
395         lft x3 = 1/5 w;
396         bot y3 = 6.5/8 h;
397         lft x4 = 0;
398         bot y4 = 4.5/8 h;
399         rt x5 =  w;
400         top y5 = 2.5/8 h;
401         lft x6 = 1/5 w;
402         bot y6 = 3.5/8 h;
403         lft x7 = 0;
404         bot y7 = 1.5/8 h;
405
406         draw z1
407              -- z2
408              -- z3
409              -- z4;
410         draw z5
411              -- z6
412              -- z7;
413
414         labels (1, 2, 3, 4, 5, 6, 7);
415 fet_endchar;
416
417
418 fet_endgroup ("rests")