+fet_beginchar ("Mensural brevis notehead", "sM1mensural");
+ draw_mensural_brevis (staff_space#);
+fet_endchar;
+
+
+def draw_diamond_head (expr head_h, pen_w, pen_h, angle, open) =
+ save head_width, head_height;
+ save ellipse, ellipse_r;
+ path ellipse, ellipse_r, diamond_shape;
+
+ head_height# = head_h;
+ head_width# / head_height# = tand (angle);
+
+ set_char_box (0, head_width#,
+ head_height# / 2, head_height# / 2);
+
+ charwx := head_width# / 2;
+ charwy := head_height# / 2 - linethickness#;
+
+ define_pixels (head_width, head_height);
+
+ ellipse := reverse fullcircle
+ xscaled (max (blot_diameter, pen_w * head_width))
+ yscaled (max (blot_diameter, pen_h * head_width))
+ rotated -angle;
+
+ z1 = find_tangent_shift (((0, h) -- (0, -h)), ellipse,
+ (0, 0), (w / 2, 0));
+ z2 = find_tangent_shift (((0, h) -- (w, h)), ellipse,
+ (w / 2, h), (w / 2, 0));
+ z3 = find_tangent_shift (((w, h) -- (w, -h)), ellipse,
+ (w, 0), (w / 2, 0));
+ z4 = find_tangent_shift (((0, -h) -- (w, -h)), ellipse,
+ (w / 2, -h), (w / 2, 0));
+
+ diamond_shape := get_subpath (ellipse, z1 - z4, z2 - z1, z1)
+ -- get_subpath (ellipse, z2 - z1, z3 - z2, z2)
+ -- get_subpath (ellipse, z3 - z2, z4 - z3, z3)
+ -- get_subpath (ellipse, z4 - z3, z1 - z4, z4)
+ -- cycle;
+ fill diamond_shape;
+
+ if open:
+ save l;
+ path l[];
+
+ l12 := (directionpoint (z1 - z2) of ellipse) shifted z1
+ -- (directionpoint (z1 - z2) of ellipse) shifted z2;
+ l23 := (directionpoint (z2 - z3) of ellipse) shifted z2
+ -- (directionpoint (z2 - z3) of ellipse) shifted z3;
+ l34 := (directionpoint (z3 - z4) of ellipse) shifted z3
+ -- (directionpoint (z3 - z4) of ellipse) shifted z4;
+ l41 := (directionpoint (z4 - z1) of ellipse) shifted z4
+ -- (directionpoint (z4 - z1) of ellipse) shifted z1;
+
+ unfill l12 intersectionpoint l23
+ -- l23 intersectionpoint l34
+ -- l34 intersectionpoint l41
+ -- l41 intersectionpoint l12
+ -- cycle;
+ fi;
+
+ labels (1, 2, 3, 4);