+def draw_cross (expr thick) =
+ save ne, nw;
+ save ne_dist, nw_dist, rt_dist, up_dist;
+ save crz_in, crz_out;
+ save thickness;
+ pair ne, nw;
+ pair ne_dist, nw_dist, rt_dist, up_dist;
+ path crz_in, crz_out;
+
+ pen_thick# := 1.2 stafflinethickness#;
+ thickness# := thick * stafflinethickness#;
+ define_pixels (thickness);
+ define_blacker_pixels (pen_thick);
+
+ pickup pencircle scaled pen_thick;
+
+ h := h - feta_shift;
+
+ top y3 = h;
+ ne = unitvector ((1, (2 h - pen_thick) / (w - pen_thick)));
+ rt x4 = w / 2;
+ y5 = 0;
+ z4 - z5 = whatever * ne;
+ x6 = 0;
+ z6 - z3 = whatever * ne;
+ z3 - z4 = whatever * (ne yscaled -1);
+
+ z4 - z3 = whatever * (ne) + (ne rotated -90) * thickness;
+
+
+ x1 = charwd / 2 - .5 pen_thick#;
+ z1 = whatever * ne
+ + thick / 2 * stafflinethickness# * (ne rotated -90);
+
+ % labels (1, 2, 3, 4, 5, 6);
+
+ nw = unitvector (z3 - z4);
+
+ up_dist = up * 0.5 pen_thick / cosd (angle (ne));
+ rt_dist = right * 0.5 pen_thick / sind (angle (ne));
+ nw_dist = (ne rotated 90) * 0.5 pen_thick;
+ ne_dist = (nw rotated -90) * 0.5 pen_thick;
+
+ x4' := x4;
+ x5' := x5;
+ y6' := y6;
+
+ x4 := hround (x4' + .5 pen_thick) - .5 pen_thick;
+ x5 := hfloor (x5' + xpart rt_dist) - xpart rt_dist;
+ y6 := vfloor (y6' + ypart up_dist) - ypart up_dist;
+
+ crz_out = (z6 + up_dist)
+ -- (z3 + nw_dist){ne}
+ .. (top z3)
+ .. (z3 + ne_dist){-nw}
+ -- (z4 + ne_dist){-nw}
+ .. (rt z4)
+ .. (z4 - nw_dist){-ne}
+ -- (z5 + rt_dist);
+ crz_out := crz_out shifted (0, feta_shift)
+ -- reverse crz_out yscaled -1 shifted (0, -feta_eps);
+ fill crz_out
+ -- reverse crz_out xscaled -1 shifted (-feta_eps, 0)
+ -- cycle;
+
+ if (thick > 1):
+ x4 := hround (x4' - xpart rt_dist) + xpart rt_dist;
+ x5 := hceiling (x5' - .5 pen_thick) + .5 pen_thick;
+ y6 := vfloor (y6' - .5 pen_thick) + .5 pen_thick;
+
+ crz_in = (bot z6){right}
+ .. (z6 - nw_dist){ne}
+ -- (z3 - up_dist)
+ -- (z4 - rt_dist)
+ -- (z5 + nw_dist){-ne}
+ .. {down}(lft z5);
+ crz_in := crz_in shifted (0, feta_shift)
+ -- reverse crz_in yscaled -1 shifted (0, -feta_eps);
+ unfill crz_in
+ -- reverse crz_in xscaled -1 shifted (-feta_eps, 0)
+ -- cycle;
+ fi
+
+ % ugh
+ currentpicture := currentpicture shifted (hround (w / 2), 0);
+
+ charwx := charwd;
+ charwy := y1 + feta_shift;
+
+ z12 = (charwx * hppp, y1 * vppp);
+
+ labels (12);
+enddef;
+
+
+fet_beginchar ("Whole Crossed notehead", "s0cross");
+ save wid, hei;
+
+ wid# := black_notehead_width# + 4 stafflinethickness#;
+ hei# := noteheight# + stafflinethickness#;
+
+ set_char_box (0, wid#, hei# / 2, hei# / 2);
+
+ draw_cross (3.75);
+
+ remember_pic := currentpicture;
+
+ draw_staff (-2, 2, 0);
+fet_endchar;
+
+
+if test > 0:
+ fet_beginchar ("Whole Crossed notehead", "s0cross");
+ save wid, hei;
+
+ wid# := black_notehead_width# + 4 stafflinethickness#;
+ hei# := noteheight# + stafflinethickness#;
+
+ set_char_box (0, wid#, hei# / 2, hei# / 2);
+
+ currentpicture := remember_pic;
+
+ draw_staff (-2, 2, 0.5);
+ fet_endchar;
+fi;
+
+
+fet_beginchar ("Half Crossed notehead", "s1cross");
+ save wid, hei;
+
+ wid# := black_notehead_width# + 2 stafflinethickness#;
+ hei# := noteheight# + stafflinethickness# / 2;
+
+ set_char_box (0, wid#, hei# / 2, hei# / 2);
+
+ draw_cross (3.0);
+
+ remember_pic := currentpicture;
+
+ draw_staff (-2, 2, 0);
+fet_endchar;
+
+
+if test > 0:
+ fet_beginchar ("Half Crossed notehead", "s1cross");
+ save wid, hei;
+
+ wid# := black_notehead_width# + 2 stafflinethickness#;
+ hei# := noteheight# + stafflinethickness# / 2;
+
+ set_char_box (0, wid#, hei# / 2, hei# / 2);
+
+ currentpicture := remember_pic;
+
+ draw_staff (-2, 2, 0.5);
+ fet_endchar;
+fi;
+
+
+fet_beginchar ("Crossed notehead", "s2cross");
+ wid# := black_notehead_width#;
+ hei# := noteheight#;
+ set_char_box (0, wid#, hei# / 2, hei# / 2);
+
+ draw_cross (1.0);
+
+ remember_pic := currentpicture;
+
+ draw_staff (-2, 2, 0);
+fet_endchar;
+
+
+if test > 0:
+ fet_beginchar ("Crossed notehead", "s2cross");
+ wid# := black_notehead_width#;
+ hei# := noteheight#;
+ set_char_box (0, wid#, hei# / 2, hei# / 2);
+
+ currentpicture := remember_pic;
+
+ draw_staff (-2, 2, 0.5);
+ fet_endchar;
+fi;
+
+
+fet_beginchar ("X-Circled notehead", "s2xcircle");
+ save wid, hei;
+ save cthick, cxd, cyd, dy;
+
+ wid# := black_notehead_width# * sqrt (sqrt2);
+ hei# := noteheight# * sqrt (sqrt2);
+
+ set_char_box (0, wid#, hei# / 2, hei# / 2);
+
+ d := d - feta_space_shift;
+
+ cthick# := (1.2 + 1/4) * stafflinethickness#;
+ define_blacker_pixels (cthick);
+
+ cxd := w - cthick;
+ cyd := h + d - cthick / 2;
+
+ dy = .5 (h - d);
+
+ pickup pencircle scaled cthick;
+
+ fill fullcircle xscaled (cxd + cthick)
+ yscaled (cyd + cthick)
+ shifted (w / 2, dy);
+ unfill fullcircle xscaled (cxd - cthick)
+ yscaled (cyd - cthick)
+ shifted (w / 2, dy);
+
+ xpos := .5 cxd / sqrt2;
+ ypos := .5 cyd / sqrt2;
+
+ pickup penrazor scaled cthick rotated (angle (xpos, ypos) + 90);
+ draw (-xpos + w / 2, -ypos + dy) -- (xpos + w / 2, ypos + dy);
+
+ pickup penrazor scaled cthick rotated (angle (xpos, -ypos) + 90);
+ draw (-xpos + w / 2, ypos + dy) -- (xpos + w / 2, -ypos + dy);
+
+ charwx := charwd;
+ charwy := 0;
+
+ z12 = (charwx * hppp, charwy * vppp);
+ labels (12);
+
+ 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;
+
+
+%%%%%%%%