+ 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;
+fet_endchar;
+
+
+def draw_la_head (expr width_factor) =
+ set_char_box (0, width_factor * solfa_base_notewidth#,
+ 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
+ save p_in, p_out;
+ path p_in, p_out;
+
+ 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 (range 1 thru 4);
+
+ p_in := (z1 + 0.5 solfa_pen_thick * (1, -1))
+ -- (z2 + 0.5 solfa_pen_thick * (-1, -1))
+ -- (z3 + 0.5 solfa_pen_thick * (-1, 1))
+ -- (z4 + 0.5 solfa_pen_thick * (1, 1))
+ -- cycle;
+
+ p_out := top z1
+ -- top z2{right}
+ .. rt z2{down}
+ -- rt z3{down}
+ .. bot z3{left}
+ -- bot z4{left}
+ .. lft z4{up}
+ -- lft z1{up}
+ .. cycle;
+enddef;
+
+
+fet_beginchar ("Whole lahead", "s0la");
+ draw_la_head (solfa_whole_width);
+ fill p_out;
+ unfill p_in;
+fet_endchar;
+
+
+fet_beginchar ("Half lahead", "s1la");
+ draw_la_head (solfa_half_width);
+ fill p_out;
+ unfill p_in;
+fet_endchar;
+
+
+fet_beginchar ("Quart lahead", "s2la");
+ draw_la_head (solfa_quarter_width);
+ fill p_out;
+fet_endchar;
+
+
+def draw_ti_head (expr width_factor, dir) =
+ set_char_box (0, width_factor * solfa_base_notewidth#,
+ 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
+ save p_in, p_out, p_top;
+ save nw_dist, sw_dist, nw, sw;
+ path p_in, p_out, p_top;
+ pair nw_dist, sw_dist, nw, sw;
+ save cone_height;
+ cone_height = 0.64;
+
+ pickup pencircle scaled solfa_pen_thick;
+
+ x1 = .5 [x2, x4];
+ bot y1 = -d;
+ lft x2 = 0;
+ y2 = cone_height [y1, y3];
+ rt x4 = w;
+ y4 = y2;
+ x3 = x1;
+ top y3 = h;
+
+ labels (range 1 thru 4);
+
+ nw = unitvector (z2 - z1);
+ sw = unitvector (z1 - z4);
+
+ nw_dist = (nw rotated 90) * 0.5 solfa_pen_thick;
+ sw_dist = (sw rotated 90) * 0.5 solfa_pen_thick;
+
+ p_top := (z2 - sw_dist)
+ .. (top z3){right}
+ .. (z4 - nw_dist);
+
+ p_in := (((z1 - nw_dist) -- (z2 - nw_dist)) intersectionpoint
+ ((z1 - sw_dist) -- (z4 - sw_dist)))
+ -- (((z1 - nw_dist) -- (z2 - nw_dist)) intersectionpoint
+ ((z2 + sw_dist) .. {right}(bot z3)))
+ .. bot z3
+ .. (((bot z3){right} .. (z4 + nw_dist)) intersectionpoint
+ ((z1 - sw_dist) -- (z4 - sw_dist)))
+ -- cycle;
+
+ p_out := bot z1
+ .. (z1 + nw_dist)
+ -- (z2 + nw_dist)
+ .. lft z2
+ .. (z2 - sw_dist){direction 0 of p_top}
+ & p_top
+ & {direction infinity of p_top}(z4 - nw_dist)
+ .. rt z4
+ .. (z4 + sw_dist)
+ -- (z1 + sw_dist)
+ .. cycle;
+
+ charwx := charwd;
+ charwy := cone_height [-chardp, charht];
+ if dir = -1:
+ charwy := -charwy;
+ fi;
+enddef;
+
+
+fet_beginchar ("Whole up tihead", "s0ti");
+ draw_ti_head (solfa_whole_width, 1);
+ fill p_out;
+ unfill p_in;
+fet_endchar;
+
+
+fet_beginchar ("Half up tihead", "u1ti");
+ draw_ti_head (solfa_half_width, 1);
+ fill p_out;
+ unfill p_in;
+fet_endchar;
+
+
+fet_beginchar ("Half down tihead", "d1ti");
+ draw_ti_head (solfa_half_width, -1);
+ fill p_out;
+ unfill p_in;
+fet_endchar;
+
+
+fet_beginchar ("Quart up tihead", "u2ti");
+ draw_ti_head (solfa_quarter_width, 1);
+ fill p_out;
+fet_endchar;
+
+
+fet_beginchar ("Quart down tihead", "d2ti");
+ draw_ti_head (solfa_quarter_width, -1);
+ fill p_out;
+fet_endchar;
+
+
+fet_endgroup ("noteheads");
+
+
+%
+% we derive black_notehead_width# from the quarter head,
+% so we have to define black_notehead_width (pixel qty)
+% after the black_notehead_width# itself.
+%
+% Let's keep it outside the group as well.
+%