+enddef;
+
+
+def draw_eighth_rest (expr show_labels) =
+ save ycenter;
+ save pat, bulb;
+ path pat, bulb;
+
+ set_char_box (0, 1.0 staff_space#,
+ 1.0 staff_space# + 0.5 linethickness#,
+ 0.5 staff_space# + bulb_diam# / 2);
+
+ penpos1 (thick, 0);
+ penpos2 (thin, 10);
+
+ y1 = -staff_space_rounded;
+ y2 = h - vround lower_brush;
+ x2r = w;
+ z2 = z1 + whatever * dir (72);
+ z9 = z2 + 0.5 linethickness * dir (angle (z2 - z1) - 10);
+ y9 := vround y9;
+
+ x1l := hround x1l;
+ x1r := hround x1r;
+ x1 := .5 [x1l, x1r];
+
+ if show_labels = 1:
+ penlabels (1, 2);
+ labels (9);
+ fi;
+
+ pat = z1l
+ -- z2l
+ .. z9
+ .. z2r
+ -- z1r
+ .. cycle;
+ bulb = draw_rest_bulb (0.5 staff_space, y2r, pat, 1.0, show_labels);
+
+ fill simple_serif (z1l, z1r, 40)
+ -- z2r
+ .. z9
+ .. bulb
+ -- z1l
+ .. cycle;
+
+ draw_staff (-2, 2, 0);
+enddef;
+
+
+fet_beginchar ("Classical quarter rest", "2classical");
+ draw_eighth_rest (0);
+ currentpicture := currentpicture xscaled -1 shifted (w, 0);
+fet_endchar;
+
+
+fet_beginchar ("8th rest", "3");
+ draw_eighth_rest (1);
+fet_endchar;
+
+
+%
+% TODO: the X dimensions of the rests are fucked up:
+% they can collide with augmentation dots.
+%
+
+fet_beginchar ("16th rest", "4");
+ save ycenter;
+ save pat, bulb_a, bulb_b;
+ path pat, bulb_a, bulb_b;
+
+ set_char_box (0, 1.2 staff_space#,
+ 2.0 staff_space# + 0.5 linethickness#,
+ 0.5 staff_space# + bulb_diam# / 2);
+
+ penpos1 (thick, 0);
+ penpos2 (thin, 10);
+
+ y1 = -2 staff_space_rounded;
+ y2 = h - vround lower_brush;
+ x2r = w;
+ z2 = z1 + whatever * dir (74);
+ z9 = z2 + 0.5 linethickness * dir (angle (z2 - z1) - 10);
+ y9 := vround y9;
+
+ x1l := hround x1l;
+ x1r := hround x1r;
+ x1 := .5 [x1l, x1r];
+
+ pat = z1l
+ -- z2l
+ .. z9
+ .. z2r
+ -- z1r
+ .. cycle;
+ bulb_a = draw_rest_bulb (.5 staff_space,
+ y2r, pat, 0.98, 1);
+ bulb_b = draw_rest_bulb (.5 staff_space - staff_space_rounded,
+ hround ((-0.5 + 0.2) * staff_space),
+ pat, 1.02, 1);
+
+ fill simple_serif (z1l, z1r, 40)
+ -- z2r
+ .. z9
+ .. bulb_a
+ -- bulb_b
+ -- z1l
+ .. cycle;
+
+ penlabels (1, 2);
+ labels (9);
+
+ draw_staff (-2, 2, 0);
+fet_endchar;
+
+
+fet_beginchar ("32th rest", "5");
+ save ycenter;
+ save pat, bulb_a, bulb_b, bulb_c;
+ path pat, bulb_a, bulb_b, bulb_c;
+
+ set_char_box (0, 1.3 staff_space#,
+ 2.0 staff_space# + 0.5 linethickness#,
+ 1.5 staff_space# + bulb_diam# / 2);
+
+ penpos1 (thick, 0);
+ penpos2 (thin, 10);
+
+ y1 = -2 staff_space_rounded;
+ y2 = h - vround lower_brush;
+ x2r = w;
+ z2 = z1 + whatever * dir (76);
+ z9 = z2 + 0.5 linethickness * dir (angle (z2 - z1) - 10);
+ y9 := vround y9;
+
+ x1l := hround x1l;
+ x1r := hround x1r;
+ x1 := .5 [x1l, x1r];
+
+ pat = z1l
+ -- z2l
+ .. z9
+ .. z2r
+ -- z1r
+ .. cycle;
+ bulb_a = draw_rest_bulb (.5 staff_space + staff_space_rounded,
+ y2r, pat, 0.96, 1);
+ bulb_b = draw_rest_bulb (.5 staff_space,
+ hround ((0.5 + 0.2) * staff_space),
+ pat, 1.00, 1);
+ bulb_c = draw_rest_bulb (.5 staff_space - staff_space_rounded,
+ hround ((-0.5 + 0.21) * staff_space),
+ pat, 1.04, 1);
+
+ fill simple_serif (z1l, z1r, 40)
+ -- z2r
+ .. z9
+ .. bulb_a
+ -- bulb_b
+ -- bulb_c
+ -- z1l
+ .. cycle;
+
+ penlabels (1, 2);
+ labels (9);
+
+ draw_staff (-2, 2, 0);
+fet_endchar;
+
+
+fet_beginchar ("64th rest", "6");
+ save ycenter;
+ save pat, bulb_a, bulb_b, bulb_c, bulb_d;
+ path pat, bulb_a, bulb_b, bulb_c, bulb_d;
+
+ set_char_box (0, 1.4 staff_space#,
+ 3.0 staff_space# + 0.5 linethickness#,
+ 1.5 staff_space# + bulb_diam# / 2);
+
+ penpos1 (thick, 0);
+ penpos2 (thin, 10);
+
+ y1 = -3 staff_space_rounded;
+ y2 = h - vround lower_brush;
+ x2r = w;
+ z2 = z1 + whatever * dir (78);
+ z9 = z2 + 0.5 linethickness * dir (angle (z2 - z1) - 10);
+ y9 := vround y9;
+
+ x1l := hround x1l;
+ x1r := hround x1r;
+ x1 := .5 [x1l, x1r];
+
+ pat = z1l
+ -- z2l
+ .. z9
+ .. z2r
+ -- z1r
+ .. cycle;
+ bulb_a = draw_rest_bulb (.5 staff_space + staff_space_rounded,
+ y2r, pat, 0.94, 1);
+ bulb_b = draw_rest_bulb (.5 staff_space,
+ hround ((0.5 + 0.20) * staff_space),
+ pat, 0.98, 1);
+ bulb_c = draw_rest_bulb (.5 staff_space - staff_space_rounded,
+ hround ((-0.5 + 0.21) * staff_space),
+ pat, 1.02, 1);
+ bulb_d = draw_rest_bulb (.5 staff_space - 2 staff_space_rounded,
+ hround ((-1.5 + 0.22) * staff_space),
+ pat, 1.06, 1);
+
+ fill simple_serif (z1l, z1r, 40)
+ -- z2r
+ .. z9
+ .. bulb_a
+ -- bulb_b
+ -- bulb_c
+ -- bulb_d
+ -- z1l
+ .. cycle;
+
+ penlabels (1, 2);
+ labels (9);
+
+ draw_staff (-2, 2, 0);
+fet_endchar;
+
+
+fet_beginchar ("128th rest", "7");
+ save ycenter;
+ save pat, bulb_a, bulb_b, bulb_c, bulb_d, bulb_e;
+ path pat, bulb_a, bulb_b, bulb_c, bulb_d, bulb_e;
+
+ set_char_box (0, 1.5 staff_space#,
+ 3.0 staff_space# + 0.5 linethickness#,
+ 2.5 staff_space# + bulb_diam# / 2);
+
+ penpos1 (thick, 0);
+ penpos2 (thin, 10);
+
+ y1 = -3 staff_space_rounded;
+ y2 = h - vround lower_brush;
+ x2r = w;
+ z2 = z1 + whatever * dir (80);
+ z9 = z2 + 0.5 linethickness * dir (angle (z2 - z1)- 10);
+ y9 := vround y9;
+
+ x1l := hround x1l;
+ x1r := hround x1r;
+ x1 := .5 [x1l, x1r];
+
+ pat = z1l
+ -- z2l
+ .. z9
+ .. z2r
+ -- z1r
+ .. cycle;
+ bulb_a = draw_rest_bulb (.5 staff_space + 2 staff_space_rounded,
+ y2r, pat, 0.92, 1);
+ bulb_b = draw_rest_bulb (.5 staff_space + staff_space_rounded,
+ hround ((1.5 + 0.20) * staff_space),
+ pat, 0.96, 1);
+ bulb_c = draw_rest_bulb (.5 staff_space,
+ hround ((0.5 + 0.21) * staff_space),
+ pat, 1.0, 1);
+ bulb_d = draw_rest_bulb (.5 staff_space - staff_space_rounded,
+ hround ((-0.5 + 0.22) * staff_space),
+ pat, 1.04, 1);
+ bulb_e = draw_rest_bulb (.5 staff_space - 2 staff_space_rounded,
+ hround ((-1.5 + 0.23) * staff_space),
+ pat, 1.08, 1);
+
+ fill simple_serif (z1l, z1r, 40)
+ -- z2r
+ .. z9
+ .. bulb_a
+ -- bulb_b
+ -- bulb_c
+ -- bulb_d
+ -- bulb_e
+ -- z1l
+ .. cycle;
+
+ penlabels (1, 2);
+ labels (9);
+
+ draw_staff (-2, 2, 0);
+fet_endchar;
+