+
+ remember_pic := currentpicture;
+
+ draw_staff (-2, 2, 0);
+fet_endchar;
+
+
+if test > 0:
+ fet_beginchar ("X-Circled notehead", "s2xcircle");
+ save wid, hei;
+ save cthick, cxr, cyr;
+
+ wid# := black_notehead_width# * sqrt (sqrt2);
+ hei# := noteheight# * sqrt (sqrt2);
+
+ set_char_box (0, wid#, hei# / 2, hei# / 2);
+
+ currentpicture := remember_pic;
+
+ draw_staff (-2, 2, 0.5);
+ fet_endchar;
+fi;
+
+
+%%%%%%%%
+%
+% SOLFA SHAPED NOTES
+%
+
+save solfa_pen_thick;
+solfa_pen_thick# = 1.75 stafflinethickness#;
+define_blacker_pixels (solfa_pen_thick);
+
+
+save solfa_base_notewidth;
+solfa_base_notewidth# := black_notehead_width#;
+
+solfa_whole_width := whole_notehead_width# / black_notehead_width#;
+solfa_half_width := half_notehead_width# / black_notehead_width#;
+solfa_quarter_width := 1.0;
+
+def draw_do_head (expr width_factor, dir) =
+ save p_in, p_out;
+ save left_dist, right_dist;
+ path p_in, p_out;
+ pair left_dist, right_dist;
+
+ set_char_box (0, width_factor * solfa_base_notewidth#,
+ 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
+
+ pickup pencircle scaled solfa_pen_thick;
+
+ bot y1 = -d;
+ y1 = y2;
+ lft x1 = 0;
+ rt x2 = w;
+ top y3 = h;
+ x3 =.5 [x1, x2];
+
+ left_dist = (unitvector (z3 - z1) rotated 90) * 0.5 solfa_pen_thick;
+ right_dist = (unitvector (z2 - z3) rotated 90) * 0.5 solfa_pen_thick;
+
+ p_in := (((z1 - left_dist) -- (z3 - left_dist)) intersectionpoint
+ (top z1 -- top z2))
+ -- ((top z1 -- top z2) intersectionpoint
+ ((z2 - right_dist) -- (z3 - right_dist)))
+ -- (((z2 - right_dist) -- (z3 - right_dist)) intersectionpoint
+ ((z1 - left_dist) -- (z3 - left_dist)))
+ -- cycle;
+
+ p_out := bot z1
+ -- bot z2{right}
+ .. rt z2{up}
+ .. (z2 + right_dist){z3 - z2}
+ -- (z3 + right_dist){z3 - z2}
+ .. top z3{left}
+ .. (z3 + left_dist){z1 - z3}
+ -- (z1 + left_dist){z1 - z3}
+ .. lft z1{down}
+ .. {right}cycle;
+
+
+ labels (1, 2, 3);
+
+ charwx := charwd;
+ charwy := -chardp + 0.5 stafflinethickness#;
+ if dir = -1:
+ charwy := -charwy;
+ fi;
+enddef;
+
+
+fet_beginchar ("Whole dohead", "s0do");
+ draw_do_head (solfa_whole_width, 1);
+ fill p_out;
+ unfill p_in;
+fet_endchar;
+
+
+fet_beginchar ("Half dohead", "d1do");
+ draw_do_head (solfa_half_width, -1);
+ fill p_out;
+ unfill p_in;
+fet_endchar;
+
+
+fet_beginchar ("Half dohead", "u1do");
+ draw_do_head (solfa_half_width, 1);
+ fill p_out;
+ unfill p_in;
+fet_endchar;
+
+
+fet_beginchar ("Quart dohead", "d2do");
+ draw_do_head (solfa_quarter_width, -1);
+ fill p_out;
+fet_endchar;
+
+
+fet_beginchar ("Quart dohead", "u2do");
+ draw_do_head (solfa_quarter_width, 1);
+ fill p_out;
+fet_endchar;
+
+
+%
+% re - flat top, curved bottom:
+% (0,h/2) {dir -90} .. (w/2,-h/2) .. {dir 90} (w,h/2) -- cycle;
+% (broader along the base and with more vertical sides for half and
+% whole notes)
+% stem attachment: h/2
+%
+
+def draw_re_head (expr width_factor, dir) =
+ save p_in, p_out;
+ path p_in, p_out;
+
+ set_char_box (0, width_factor * solfa_base_notewidth#,
+ 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
+
+ pickup pencircle scaled solfa_pen_thick;
+
+ save curve_start;
+ curve_start = 0.7;
+ lft x1 = 0;
+ y1 = y5;
+ x1 = x2;
+ y2 = curve_start [y3, y1];
+ bot y3 = -d;
+ x3 = .5 [x2, x4];
+ rt x4 = w;
+ y4 = y2;
+ top y5 = h;
+ x5 = x4;
+
+ labels (range 1 thru 5);
+
+ p_in := (z1 + 0.5 solfa_pen_thick * (1, -1))
+ -- rt z2{down}
+ .. top z3
+ .. lft z4{up}
+ -- (z5 + 0.5 solfa_pen_thick * (-1, -1))
+ -- cycle;
+
+ p_out := lft z1
+ -- lft z2{down}
+ .. bot z3
+ .. rt z4{up}
+ -- rt z5{up}
+ .. top z5{left}
+ -- top z1{left}
+ .. {down}cycle;
+
+ charwx := charwd;
+ charwy := curve_start [-chardp, charht];
+
+ if dir = -1:
+ charwy := -charwy;
+ fi;
+enddef;
+
+
+fet_beginchar ("Whole rehead", "s0re");
+ draw_re_head (solfa_whole_width, 1);
+ fill p_out;
+ unfill p_in;
+fet_endchar;
+
+
+fet_beginchar ("Half up rehead", "u1re");
+ draw_re_head (solfa_half_width, 1);
+ fill p_out;
+ unfill p_in;
+fet_endchar;
+
+
+fet_beginchar ("Half down rehead", "d1re");
+ draw_re_head (solfa_half_width, -1);
+ fill p_out;
+ unfill p_in;
+fet_endchar;
+
+
+fet_beginchar ("Quart rehead", "u2re");
+ draw_re_head (solfa_quarter_width, 1);
+ fill p_out;
+fet_endchar;
+
+
+fet_beginchar ("Quart rehead", "d2re");
+ draw_re_head (solfa_quarter_width, -1);
+ fill p_out;
+fet_endchar;
+
+
+def draw_mi_head (expr width_factor) =
+ save path_out, path_in;
+ save ne_dist, se_dist, ne, se;
+ path path_out, path_in;
+ pair ne_dist, se_dist, ne, se;
+
+ set_char_box (0, width_factor * solfa_base_notewidth#,
+ 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
+
+ pickup pencircle scaled solfa_pen_thick;
+
+ lft x1 = 0;
+ y1 = 0;
+ bot y2 = -d;
+ x2 = .5 [x1, x3];
+ rt x3 = w;
+ x4 = x2;
+ y3 = y1;
+ top y4 = h;
+
+ z6 - z5 = whatever * (z2 - z1);
+ z8 - z7 = whatever * (z2 - z1);
+ z8 - z5 = whatever * (z4 - z1);
+ z6 - z7 = whatever * (z4 - z1);
+
+ ne = unitvector (z4 - z1);
+ se = unitvector (z1 - z2);
+
+ ne_dist = (ne rotated 90) * 0.5 solfa_pen_thick;
+ se_dist = (se rotated 90) * 0.5 solfa_pen_thick;
+
+ z5 = whatever [z1, z4] - ne_dist;
+ z5 = whatever [z1, z2] - 1.5 se_dist;
+
+ z5 - z1 = -(z7 - z3);
+
+ labels (range 1 thru 8);
+
+ path_in := z5
+ -- z6
+ -- z7
+ -- z8
+ -- cycle;
+
+ path_out := lft z1
+ .. (z1 + se_dist){-se}
+ -- (z2 + se_dist){-se}
+ .. bot z2
+ .. (z2 - ne_dist){ne}
+ -- (z3 - ne_dist){ne}
+ .. rt z3
+ .. (z3 - se_dist){se}
+ -- (z4 - se_dist){se}
+ .. top z4
+ .. (z4 + ne_dist){-ne}
+ -- (z1 + ne_dist){-ne}
+ .. cycle;
+enddef;
+
+
+fet_beginchar ("Whole mihead", "s0mi");
+ draw_mi_head (solfa_whole_width);
+ fill path_out;
+ unfill path_in;
+fet_endchar;
+
+
+fet_beginchar ("Half mihead", "s1mi");
+ draw_mi_head (solfa_quarter_width);
+ fill path_out;
+ unfill path_in;
+fet_endchar;
+
+
+fet_beginchar ("Quart mihead", "s2mi");
+ draw_mi_head (solfa_quarter_width);
+ fill path_out;
+fet_endchar;
+
+
+def draw_fa_head (expr width_factor) =
+ set_char_box (0, width_factor * solfa_base_notewidth#,
+ 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
+
+ save p_down_in, p_down_out, p_up_in, p_up_out, nw_dist, nw;
+ path p_down_in, p_down_out, p_up_in, p_up_out;
+ pair nw_dist, nw;
+
+ pickup pencircle scaled solfa_pen_thick;
+
+ lft x1 = 0;
+ top y1 = h;
+
+ rt x2 = w;
+ y2 = y1;
+ bot y3 = -d;
+ x3 = x2;
+
+ y4 = y3;
+ x4 = x1;
+
+ labels (1, 2, 3, 4);
+
+ nw = unitvector (z1 - z3);
+ nw_dist = (nw rotated 90) * 0.5 solfa_pen_thick;
+
+ p_up_in := (((z1 - nw_dist) -- (z3 - nw_dist)) intersectionpoint
+ (bot z1 -- bot z2))
+ -- (((z1 - nw_dist) -- (z3 - nw_dist)) intersectionpoint
+ (lft z3 -- lft z2))
+ -- (z2 + 0.5 solfa_pen_thick * (-1, -1))
+ -- cycle;
+
+ p_up_out := lft z1{down}
+ .. (z1 + nw_dist){-nw}
+ -- (z3 + nw_dist){-nw}
+ .. bot z3{right}
+ .. rt z3{up}
+ -- rt z2{up}
+ .. top z2{left}
+ -- top z1{left}
+ .. {down}cycle;
+
+ p_down_in := p_up_in rotated 180 shifted (w, 0);
+ p_down_out := p_up_out rotated 180 shifted (w, 0);
+
+ charwy := 0.0;
+ charwx := charwd;
+enddef;
+
+
+fet_beginchar ("Whole fa up head", "u0fa");
+ draw_fa_head (solfa_whole_width);
+ fill p_up_out;
+ unfill p_up_in;
+fet_endchar;
+
+
+fet_beginchar ("Whole fa down head", "d0fa");
+ draw_fa_head (solfa_whole_width);
+ fill p_down_out;
+ unfill p_down_in;
+fet_endchar;
+
+
+fet_beginchar ("half fa up head", "u1fa");
+ draw_fa_head (solfa_half_width);
+ fill p_up_out;
+ unfill p_up_in;
+fet_endchar;
+
+
+fet_beginchar ("Half fa down head", "d1fa");
+ draw_fa_head (solfa_half_width);
+ fill p_down_out;
+ unfill p_down_in;
+fet_endchar;
+
+
+fet_beginchar ("Quarter fa up head", "u2fa");
+ draw_fa_head (solfa_quarter_width);
+ fill p_up_out;
+fet_endchar;
+
+
+fet_beginchar ("Quarter fa down head", "d2fa");
+ draw_fa_head (solfa_quarter_width);
+ fill p_down_out;