1 % feta-eindelijk.mf -- implement rest symbols -*-Fundamental-*-
3 % part of LilyPond's pretty-but-neat music font
5 % source file of the Feta (not the Font-En-Tja) music font
7 % (c) 1997--2004 Jan Nieuwenhuizen <janneke@gnu.org>
9 fet_begingroup ("rests");
13 save block_rest_y, block_rest_x;
14 save breve_rest_y, breve_rest_x;
16 breve_rest_y# = staff_space#;
17 breve_rest_x# = 3/5 staff_space#;
18 block_rest_y# = 5/8 staff_space#;
19 block_rest_x# = 3/2 staff_space#;
21 define_pixels (block_rest_y, block_rest_x);
24 draw_block ((0, 0), (block_rest_x, block_rest_y));
28 fet_beginchar ("whole rest", "0");
29 set_char_box (0, block_rest_x#,
32 currentpicture := currentpicture shifted (0, -block_rest_y);
36 fet_beginchar ("half rest", "1");
37 set_char_box (0, block_rest_x#, 0, block_rest_y#);
43 % should use ledgerline thickness?
45 fet_beginchar ("whole rest (outside staff)", "0o")
46 set_char_box (0, block_rest_x#,
47 block_rest_y#, ledgerlinethickness# / 2);
49 currentpicture := currentpicture shifted (0, -block_rest_y);
50 pickup pencircle scaled ledgerlinethickness;
53 lft x5 = -b - block_rest_y;
54 rt x6 = w + block_rest_y;
55 draw_gridline (z5, z6, ledgerlinethickness);
59 fet_beginchar ("half rest (outside staff)", "1o");
60 set_char_box (0, block_rest_x#,
61 ledgerlinethickness# / 2, block_rest_y#);
63 pickup pencircle scaled ledgerlinethickness;
66 lft x5 = -b - block_rest_y;
67 rt x6 = w + block_rest_y;
68 draw_gridline (z5, z6, ledgerlinethickness);
72 define_pixels (breve_rest_y, breve_rest_x);
74 fet_beginchar ("maxima rest", "-3");
75 set_char_box (0, 3 breve_rest_x#, breve_rest_y#, breve_rest_y#);
76 draw_block ((0, -floor (breve_rest_y)),
77 (breve_rest_x, floor (breve_rest_y)));
78 addto currentpicture also currentpicture shifted (2 breve_rest_x, 0);
82 fet_beginchar ("longa rest", "-2");
83 set_char_box (0, breve_rest_x#, breve_rest_y#, breve_rest_y#);
84 draw_block ((0, -floor (breve_rest_y)),
85 (breve_rest_x, floor (breve_rest_y)));
89 fet_beginchar ("breve rest", "-1");
90 set_char_box(0, breve_rest_x#, 0, breve_rest_y#);
91 draw_block ((0, 0), (breve_rest_x, floor (breve_rest_y)));
95 tracingvariables := 1;
97 fet_beginchar ("Quarter rest", "2");
98 % draw_staff (-2, 2, 0.0);
99 save alpha, yshift, height;
102 thick# := 1/4 staff_space#;
103 define_blacker_pixels(thick);
105 rthin := 1.25 linethickness;
106 rthick := 2 thick + rthin;
108 yshift# = -1.25 staff_space#;
109 height# = 2.8125 staff_space#;
111 define_pixels (yshift, height);
113 xcenter = -0.1 staff_space;
115 set_char_box(0, 0.95 staff_space#,
123 ne = dir (alpha + 90);
124 nw = dir (alpha + 180);
125 sw = dir (alpha + 270);
127 penpos1 (rthin, alpha + 90);
128 penpos2 (5/4 rthick, alpha);
129 penpos4 (5/4 rthick, alpha);
130 penpos5 (rthin, alpha + 90);
131 penpos3 (3/4 rthick, alpha);
132 % penpos6 (5/8 rthick, alpha);
133 penpos6 (2/3 rthick, alpha);
134 penpos7 (1/2 rthin, alpha + 90);
136 z10 = z2l + 1/2 rthin * sw;
137 % z11 = z4l + 1/2 rthin * sw;
138 z11 = z4l + 1/2 rthin * sw + 1/2 rthin * se;
139 z12 = z4r + 1/2 rthin * ne;
140 % z13 = z2r + 1/2 rthin * ne;
141 z13 = z2r + 1/2 rthin * ne + 1/2 rthin * nw;
144 x1l = xcenter + 1/3 staff_space;
145 z2r = z1 + staff_space * se;
147 x4 = xcenter + 3/8 staff_space;
149 z5 = z4l + 1.3 staff_space * se;
152 x7 = xcenter + 2/5 staff_space;
157 before = z11{se} .. {se}z5l;
158 after = z5r{nw} ..tension1.4.. z6l;
159 (u, v) = before intersectiontimes after;
164 subpath(0, u) of before ..
165 subpath(v, infinity) of after ..tension1.4..
167 z7r{nw} ..tension1.4..
176 penlabels (1, 2, 3, 4, 5, 6, 7);
177 penlabels (10, 11, 12, 13);
182 % Notes about 8th rest:
184 % * 8th rest should be no wider than the black note head
186 % * The inside corner of the horizontal portion is usually a little blotted.
188 % * The top of the crook chops off the vertical brush
190 % * The crook widens a little
192 % * The bottom of the brush is slightly flat, as it has to align with
193 % stafflines if it is inside the staff.
195 % * The top of the brush usually is a little lower than the top of bulb.
197 % * The bulb can vary. Sometimes it is open (like in the clefs). Sometimes
198 % it is closed, or even a flare.
201 % from an email to Rune Zedeler:
204 % For example, the 8th rest was vaguely based on a book with trumpet
205 % studies by Duhem, and by Baerenreiters cello suites. I included my
206 % findings in a comment in the mf file. One of the things that I tried
207 % to do was make the rest a little lighter and narrower than the black
208 % note head. I think this looks better in polyphonic music, when the
209 % rest is below a head from a different voice.
212 save bulb_diam, thin, thick;
214 bulb_diam# := 0.64 staff_space#;
215 thin# := 1.4 linethickness# - 0.02 staff_space#;
216 thick# := 2.2 linethickness#;
217 crook_thin := 0.5 linethickness + 0.08 staff_space;
219 lower_brush := 1.5 linethickness;
221 define_pixels (bulb_diam, thin, thick);
225 % PAT is a compact way to pass the brush shape to the routine.
228 def draw_rest_bulb (expr ycenter, ycut, pat, stretch) =
231 z1l = point 0 of pat;
232 z2l = point 1 of pat;
233 z2r = point 3 of pat;
234 z1r = point 4 of pat;
238 z10 = whatever [z2, z1] + left * bulb_diam * stretch;
240 z3 = z10 + bulb_diam / 2.15 * dir (-72);
241 z5 = z10 + up * bulb_diam / 2 + right * linethickness / 3;
243 z7 = 0.5 [z4, z5] + crook_thin * (0.45, 0.4) / 1.3;
244 x8 = x10 - 0.4 bulb_diam;
245 y8 = y10 + 0.25 linethickness;
247 z6 = whatever [z1l, z2l];
248 z6 = z3 + whatever * dir (12);
250 z4 = z3 + whatever * (z6 - z3)
251 + 1.1 crook_thin * (unitvector (z6 - z3) rotated 90);
252 x4 = x10 + bulb_diam * .62;
255 (pt, whatever) = pat intersectiontimes ((0, ycut) -- (w, ycut));
258 res = point pt of pat {-direction pt of pat} ..tension 2..
259 z4{left} ..tension 0.9..
266 labels (3, 4, 5, 6, 7, 8, 10);
272 def draw_eighth_rest =
278 width# := 1.0 staff_space#;
280 define_pixels (width);
281 set_char_box (0, width#,
282 1.0 staff_space# + 0.5 linethickness#,
283 0.5 staff_space# + bulb_diam# / 2);
289 y2 = h - lower_brush;
291 z2 = z1 + whatever * dir (72);
292 z9 = z2 + 0.5 linethickness * dir (angle (z2 - z1) - 10);
299 bulb = draw_rest_bulb (0.5 staff_space, y2r, pat, 1.0);
301 fill simple_serif (z1l, z1r, 40) ---
310 % draw_staff (-2, 2, 0.0);
314 fet_beginchar ("Classical quarter rest", "2classical");
316 currentpicture := currentpicture xscaled -1 shifted (w, 0);
320 fet_beginchar ("8th rest", "3");
326 % TODO: the X dimensions of the rests are fucked up:
327 % they can collide with augmentation dots.
330 fet_beginchar ("16th rest", "4");
333 save pat, bulb_a, bulb_b;
334 path pat, bulb_a, bulb_b;
336 width# := 1.2 staff_space#;
338 define_pixels (width);
339 set_char_box (0, width#,
340 2.0 staff_space# + 0.5 linethickness#,
341 0.5 staff_space# + bulb_diam# / 2);
346 y1 = -2 staff_space ;
347 y2 = h - lower_brush;
349 z2 = z1 + whatever*dir(74);
350 z9 = z2 + 0.5 linethickness * dir (angle(z2 - z1)- 10);
356 bulb_a = draw_rest_bulb (0.5 staff_space, y2r, pat, 0.98);
357 bulb_b = draw_rest_bulb (-0.5 staff_space,
358 (-0.5 + 0.2) * staff_space, pat, 1.02);
360 fill simple_serif (z1l, z1r, 40) ---
370 % draw_staff (-2, 2, 0.0);
374 fet_beginchar ("32th rest", "5");
377 save pat, bulb_a, bulb_b, bulb_c;
378 path pat, bulb_a, bulb_b, bulb_c;
380 width# := 1.3 staff_space#;
382 define_pixels (width);
383 set_char_box (0, width#,
384 2.0 staff_space# + 0.5 linethickness#,
385 1.5 staff_space# + bulb_diam# / 2);
390 y1 = -2 staff_space ;
391 y2 = h - lower_brush;
393 z2 = z1 + whatever * dir (76);
394 z9 = z2 + 0.5 linethickness * dir (angle (z2 - z1) - 10);
400 bulb_a = draw_rest_bulb( 1.5 staff_space, y2r, pat, 0.96);
401 bulb_b = draw_rest_bulb( 0.5 staff_space,
402 (0.5 + 0.2) * staff_space, pat, 1.00);
403 bulb_c = draw_rest_bulb( -0.5 staff_space,
404 (-0.5 + 0.21) * staff_space, pat, 1.04);
406 fill simple_serif (z1l, z1r, 40) ---
417 % draw_staff (-2, 2, 0.0);
421 fet_beginchar ("64th rest", "6");
424 save pat, bulb_a, bulb_b, bulb_c, bulb_d;
425 path pat, bulb_a, bulb_b, bulb_c, bulb_d;
427 width# := 1.4 staff_space#;
429 define_pixels (width);
430 set_char_box (0, width#,
431 3.0 staff_space# + 0.5 linethickness#,
432 1.5 staff_space# + bulb_diam# / 2);
438 y2 = h - lower_brush;
440 z2 = z1 + whatever * dir (78);
441 z9 = z2 + 0.5 linethickness * dir (angle (z2 - z1) - 10);
447 bulb_a = draw_rest_bulb (1.5 staff_space, y2r, pat, 0.94);
448 bulb_b = draw_rest_bulb (0.5 staff_space,
449 (0.5 + 0.20) * staff_space, pat, 0.98);
450 bulb_c = draw_rest_bulb (-0.5 staff_space,
451 (-0.5 + 0.21) * staff_space, pat, 1.02);
452 bulb_d = draw_rest_bulb (-1.5 staff_space,
453 (-1.5 + 0.22) * staff_space, pat, 1.06);
455 fill simple_serif (z1l, z1r, 40) ---
468 % draw_staff (-2, 2, 0.0);
472 fet_beginchar ("128th rest", "7");
475 save pat, bulb_a, bulb_b, bulb_c, bulb_d, bulb_e;
476 path pat, bulb_a, bulb_b, bulb_c, bulb_d, bulb_e;
478 width# = 1.5 staff_space#;
480 define_pixels (width);
481 set_char_box (0, width#,
482 3.0 staff_space# + 0.5 linethickness#,
483 2.5 staff_space# + bulb_diam# / 2);
489 y2 = h - lower_brush;
491 z2 = z1 + whatever * dir (80);
492 z9 = z2 + 0.5 linethickness * dir (angle (z2 - z1)- 10);
498 bulb_a = draw_rest_bulb (2.5 staff_space, y2r, pat, 0.92);
499 bulb_b = draw_rest_bulb (1.5 staff_space,
500 (1.5 + 0.20) * staff_space, pat, 0.96);
501 bulb_c = draw_rest_bulb (0.5 staff_space,
502 (0.5 + 0.21) * staff_space, pat, 1.0);
503 bulb_d = draw_rest_bulb (-0.5 staff_space,
504 (-0.5 + 0.22) * staff_space, pat, 1.04);
505 bulb_e = draw_rest_bulb (-1.5 staff_space,
506 (-1.5 + 0.23) * staff_space, pat, 1.08);
508 fill simple_serif (z1l, z1r, 40) ---
521 % draw_staff (-2, 2, 0.0);
527 fet_endgroup("rests")