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);
25 draw_block ((0, 0), (block_rest_x, block_rest_y));
29 fet_beginchar ("whole rest", "0");
30 set_char_box (0, block_rest_x#,
33 currentpicture := currentpicture shifted (0, -block_rest_y);
37 fet_beginchar ("half rest", "1");
38 set_char_box (0, block_rest_x#, 0, block_rest_y#);
44 % should use ledgerline thickness?
46 fet_beginchar ("whole rest (outside staff)", "0o")
47 set_char_box (0, block_rest_x#,
48 block_rest_y#, ledgerlinethickness# / 2);
51 currentpicture := currentpicture shifted (0, -block_rest_y);
53 pickup pencircle scaled ledgerlinethickness;
56 lft x5 = -b - block_rest_y;
57 rt x6 = w + block_rest_y;
58 draw_gridline (z5, z6, ledgerlinethickness);
62 fet_beginchar ("half rest (outside staff)", "1o");
63 set_char_box (0, block_rest_x#,
64 ledgerlinethickness# / 2, block_rest_y#);
68 pickup pencircle scaled ledgerlinethickness;
71 lft x5 = -b - block_rest_y;
72 rt x6 = w + block_rest_y;
73 draw_gridline (z5, z6, ledgerlinethickness);
77 define_pixels (breve_rest_y, breve_rest_x);
79 fet_beginchar ("maxima rest", "-3");
80 set_char_box (0, 3 breve_rest_x#, breve_rest_y#, breve_rest_y#);
81 draw_block ((0, -floor (breve_rest_y)),
82 (breve_rest_x, floor (breve_rest_y)));
83 addto currentpicture also currentpicture shifted (2 breve_rest_x, 0);
87 fet_beginchar ("longa rest", "-2");
88 set_char_box (0, breve_rest_x#, breve_rest_y#, breve_rest_y#);
89 draw_block ((0, -floor (breve_rest_y)),
90 (breve_rest_x, floor (breve_rest_y)));
94 fet_beginchar ("breve rest", "-1");
95 set_char_box(0, breve_rest_x#, 0, breve_rest_y#);
96 draw_block ((0, 0), (breve_rest_x, floor (breve_rest_y)));
100 tracingvariables := 1;
102 fet_beginchar ("Quarter rest", "2");
103 % draw_staff (-2, 2, 0.0);
104 save alpha, yshift, height;
107 thick# := 1/4 staff_space#;
108 define_blacker_pixels(thick);
110 rthin := 1.25 linethickness;
111 rthick := 2 thick + rthin;
113 yshift# = -1.25 staff_space#;
114 height# = 2.8125 staff_space#;
116 define_pixels (yshift, height);
118 xcenter = -0.1 staff_space;
120 set_char_box(0, 0.95 staff_space#,
128 ne = dir (alpha + 90);
129 nw = dir (alpha + 180);
130 sw = dir (alpha + 270);
132 penpos1 (rthin, alpha + 90);
133 penpos2 (5/4 rthick, alpha);
134 penpos4 (5/4 rthick, alpha);
135 penpos5 (rthin, alpha + 90);
136 penpos3 (3/4 rthick, alpha);
137 % penpos6 (5/8 rthick, alpha);
138 penpos6 (2/3 rthick, alpha);
139 penpos7 (1/2 rthin, alpha + 90);
141 z10 = z2l + 1/2 rthin * sw;
142 % z11 = z4l + 1/2 rthin * sw;
143 z11 = z4l + 1/2 rthin * sw + 1/2 rthin * se;
144 z12 = z4r + 1/2 rthin * ne;
145 % z13 = z2r + 1/2 rthin * ne;
146 z13 = z2r + 1/2 rthin * ne + 1/2 rthin * nw;
149 x1l = xcenter + 1/3 staff_space;
150 z2r = z1 + staff_space * se;
152 x4 = xcenter + 3/8 staff_space;
154 z5 = z4l + 1.3 staff_space * se;
157 x7 = xcenter + 2/5 staff_space;
166 (u, v) = before intersectiontimes after;
171 .. subpath (0, u) of before
172 .. subpath (v, infinity) of after
173 ..tension1.4.. {se}z7l
176 ..tension1.4.. {se}z5l
184 penlabels (1, 2, 3, 4, 5, 6, 7);
185 penlabels (10, 11, 12, 13);
190 % Notes about 8th rest:
192 % * 8th rest should be no wider than the black note head
194 % * The inside corner of the horizontal portion is usually a little blotted.
196 % * The top of the crook chops off the vertical brush
198 % * The crook widens a little
200 % * The bottom of the brush is slightly flat, as it has to align with
201 % stafflines if it is inside the staff.
203 % * The top of the brush usually is a little lower than the top of bulb.
205 % * The bulb can vary. Sometimes it is open (like in the clefs). Sometimes
206 % it is closed, or even a flare.
209 % from an email to Rune Zedeler:
212 % For example, the 8th rest was vaguely based on a book with trumpet
213 % studies by Duhem, and by Baerenreiters cello suites. I included my
214 % findings in a comment in the mf file. One of the things that I tried
215 % to do was make the rest a little lighter and narrower than the black
216 % note head. I think this looks better in polyphonic music, when the
217 % rest is below a head from a different voice.
220 save bulb_diam, thin, thick;
222 bulb_diam# := 0.64 staff_space#;
223 thin# := 1.4 linethickness# - 0.02 staff_space#;
224 thick# := 2.2 linethickness#;
225 crook_thin := 0.5 linethickness + 0.08 staff_space;
227 lower_brush := 1.5 linethickness;
229 define_pixels (bulb_diam, thin, thick);
233 % PAT is a compact way to pass the brush shape to the routine.
236 def draw_rest_bulb (expr ycenter, ycut, pat, stretch) =
239 z1l = point 0 of pat;
240 z2l = point 1 of pat;
241 z2r = point 3 of pat;
242 z1r = point 4 of pat;
246 z10 = whatever [z2, z1] + left * bulb_diam * stretch;
248 z3 = z10 + bulb_diam / 2.15 * dir (-72);
249 z5 = z10 + up * bulb_diam / 2 + right * linethickness / 3;
251 z7 = 0.5 [z4, z5] + crook_thin * (0.45, 0.4) / 1.3;
252 x8 = x10 - 0.4 bulb_diam;
253 y8 = y10 + 0.25 linethickness;
255 z6 = whatever [z1l, z2l];
256 z6 = z3 + whatever * dir (12);
258 z4 = z3 + whatever * (z6 - z3)
259 + 1.1 crook_thin * (unitvector (z6 - z3) rotated 90);
260 x4 = x10 + bulb_diam * .62;
263 (pt, whatever) = pat intersectiontimes ((0, ycut) -- (w, ycut));
266 res = point pt of pat {-direction pt of pat}
267 ..tension 2.. z4{left}
274 labels (3, 4, 5, 6, 7, 8, 10);
280 def draw_eighth_rest =
286 width# := 1.0 staff_space#;
288 define_pixels (width);
289 set_char_box (0, width#,
290 1.0 staff_space# + 0.5 linethickness#,
291 0.5 staff_space# + bulb_diam# / 2);
297 y2 = h - lower_brush;
299 z2 = z1 + whatever * dir (72);
300 z9 = z2 + 0.5 linethickness * dir (angle (z2 - z1) - 10);
308 bulb = draw_rest_bulb (0.5 staff_space, y2r, pat, 1.0);
309 % remove_overlap (pat, bulb) () R;
312 fill simple_serif (z1l, z1r, 40)
322 % draw_staff (-2, 2, 0.0);
326 fet_beginchar ("Classical quarter rest", "2classical");
328 currentpicture := currentpicture xscaled -1 shifted (w, 0);
332 fet_beginchar ("8th rest", "3");
338 % TODO: the X dimensions of the rests are fucked up:
339 % they can collide with augmentation dots.
342 fet_beginchar ("16th rest", "4");
345 save pat, bulb_a, bulb_b;
346 path pat, bulb_a, bulb_b;
348 width# := 1.2 staff_space#;
350 define_pixels (width);
351 set_char_box (0, width#,
352 2.0 staff_space# + 0.5 linethickness#,
353 0.5 staff_space# + bulb_diam# / 2);
358 y1 = -2 staff_space ;
359 y2 = h - lower_brush;
361 z2 = z1 + whatever*dir(74);
362 z9 = z2 + 0.5 linethickness * dir (angle(z2 - z1)- 10);
369 bulb_a = draw_rest_bulb (0.5 staff_space, y2r, pat, 0.98);
370 bulb_b = draw_rest_bulb (-0.5 staff_space,
371 (-0.5 + 0.2) * staff_space, pat, 1.02);
373 fill simple_serif (z1l, z1r, 40)
384 % draw_staff (-2, 2, 0.0);
388 fet_beginchar ("32th rest", "5");
391 save pat, bulb_a, bulb_b, bulb_c;
392 path pat, bulb_a, bulb_b, bulb_c;
394 width# := 1.3 staff_space#;
396 define_pixels (width);
397 set_char_box (0, width#,
398 2.0 staff_space# + 0.5 linethickness#,
399 1.5 staff_space# + bulb_diam# / 2);
404 y1 = -2 staff_space ;
405 y2 = h - lower_brush;
407 z2 = z1 + whatever * dir (76);
408 z9 = z2 + 0.5 linethickness * dir (angle (z2 - z1) - 10);
415 bulb_a = draw_rest_bulb( 1.5 staff_space, y2r, pat, 0.96);
416 bulb_b = draw_rest_bulb( 0.5 staff_space,
417 (0.5 + 0.2) * staff_space, pat, 1.00);
418 bulb_c = draw_rest_bulb( -0.5 staff_space,
419 (-0.5 + 0.21) * staff_space, pat, 1.04);
421 fill simple_serif (z1l, z1r, 40)
433 % draw_staff (-2, 2, 0.0);
437 fet_beginchar ("64th rest", "6");
440 save pat, bulb_a, bulb_b, bulb_c, bulb_d;
441 path pat, bulb_a, bulb_b, bulb_c, bulb_d;
443 width# := 1.4 staff_space#;
445 define_pixels (width);
446 set_char_box (0, width#,
447 3.0 staff_space# + 0.5 linethickness#,
448 1.5 staff_space# + bulb_diam# / 2);
454 y2 = h - lower_brush;
456 z2 = z1 + whatever * dir (78);
457 z9 = z2 + 0.5 linethickness * dir (angle (z2 - z1) - 10);
464 bulb_a = draw_rest_bulb (1.5 staff_space, y2r, pat, 0.94);
465 bulb_b = draw_rest_bulb (0.5 staff_space,
466 (0.5 + 0.20) * staff_space, pat, 0.98);
467 bulb_c = draw_rest_bulb (-0.5 staff_space,
468 (-0.5 + 0.21) * staff_space, pat, 1.02);
469 bulb_d = draw_rest_bulb (-1.5 staff_space,
470 (-1.5 + 0.22) * staff_space, pat, 1.06);
472 fill simple_serif (z1l, z1r, 40)
485 % draw_staff (-2, 2, 0.0);
489 fet_beginchar ("128th rest", "7");
492 save pat, bulb_a, bulb_b, bulb_c, bulb_d, bulb_e;
493 path pat, bulb_a, bulb_b, bulb_c, bulb_d, bulb_e;
495 width# = 1.5 staff_space#;
497 define_pixels (width);
498 set_char_box (0, width#,
499 3.0 staff_space# + 0.5 linethickness#,
500 2.5 staff_space# + bulb_diam# / 2);
506 y2 = h - lower_brush;
508 z2 = z1 + whatever * dir (80);
509 z9 = z2 + 0.5 linethickness * dir (angle (z2 - z1)- 10);
516 bulb_a = draw_rest_bulb (2.5 staff_space, y2r, pat, 0.92);
517 bulb_b = draw_rest_bulb (1.5 staff_space,
518 (1.5 + 0.20) * staff_space, pat, 0.96);
519 bulb_c = draw_rest_bulb (0.5 staff_space,
520 (0.5 + 0.21) * staff_space, pat, 1.0);
521 bulb_d = draw_rest_bulb (-0.5 staff_space,
522 (-0.5 + 0.22) * staff_space, pat, 1.04);
523 bulb_e = draw_rest_bulb (-1.5 staff_space,
524 (-1.5 + 0.23) * staff_space, pat, 1.08);
526 fill simple_serif (z1l, z1r, 40)
540 % draw_staff (-2, 2, 0.0);
546 fet_endgroup ("rests")