2 % feta-bolletjes.mf -- implement noteheads
4 % source file of LilyPond's pretty-but-neat music font
6 % (c) 1997--2005 Jan Nieuwenhuizen <janneke@gnu.org>
7 % & Han-Wen Nienhuys <hanwen@cs.uu.nl>
8 % & Juergen Reuter <reuter@ipd.uka.de>
18 % Most beautiful noteheads are pronounced, not circular,
19 % and not even symmetric.
20 % These examples are inspired by [Wanske]; see literature list.
24 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
26 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
28 save black_notehead_width, noteheight;
29 save slash_thick, slash_slope, overdone_heads;
30 numeric black_notehead_width, noteheight, slash_thick;
33 fet_begingroup ("noteheads");
36 % Slope of slash. From scm/grob-description.scm. How to auto-copy?
39 % Thickness of slash lines. Quarter notes get 1.5slt width.
40 slash_thick# := 2/3 * 0.48 staff_space#;
44 % Hand-engraved music often has balls extending above and below
45 % the lines. If you like that, modify overdone heads (unit:
46 % stafflinethickness).
49 noteheight# := staff_space# + (1 + overdone_heads) * stafflinethickness#;
51 define_pixels (slash_thick);
52 define_whole_vertical_pixels (noteheight);
55 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
57 % SLANT moves both extrema on the long axis (by SLANT * ELLIPTICITY,
58 % so SLANT = -1, puts the extreme on the long axis next to the short
62 def draw_outside_ellipse (expr ellipticity, tilt, superness, slant) =
67 pat := superellipse ((ellipticity, 0), (-slant * ellipticity, 1.0),
68 (-ellipticity, 0), (slant * ellipticity, -1.0),
70 pat := pat rotated tilt;
72 save top_point, right_point;
73 pair top_point, right_point;
75 top_point := directionpoint left of pat;
76 right_point := directionpoint up of pat;
80 scaling# = noteheight# / (2 ypart (top_point));
81 width# := 2 xpart (right_point) * scaling#;
82 define_pixels (scaling, width);
84 set_char_box (0, width#, noteheight# / 2, noteheight# / 2);
86 d := d - feta_space_shift;
89 charwy := ypart (right_point) * scaling#;
92 pat := pat scaled scaling shifted (w / 2, .5 (h - d));
94 width := hround width;
104 def undraw_inside_ellipse (expr ellipticity, tilt, superness, clearance) =
109 pat := superellipse ((ellipticity, 0), (0, 1.0),
110 (-ellipticity, 0), (0, -1.0),
112 pat := pat rotated tilt;
114 save top_point, right_point;
115 pair top_point, right_point;
117 top_point := directionpoint left of pat;
118 right_point := directionpoint up of pat;
120 save height, scaling;
122 height# = staff_space# + stafflinethickness# - clearance;
123 scaling# = height# / (2 ypart (top_point));
124 define_pixels (scaling);
125 pat := pat scaled scaling shifted (w / 2, .5 (h - d));
127 if test_outlines = 1:
137 % dimensions aren't entirely right.
140 save stemthick, fudge;
142 stemthick# = 2 stafflinethickness#;
143 define_whole_blacker_pixels (stemthick);
145 fudge = hround (blot_diameter / 2);
147 draw_outside_ellipse (1.80, 0, 0.707, 0);
148 undraw_inside_ellipse (1.30, 125, 0.68, 2 stafflinethickness#);
150 pickup pencircle scaled stemthick;
162 draw_gridline (z1, z2, stemthick);
163 draw_gridline (z3, z4, stemthick);
167 fet_beginchar ("Brevis notehead", "s-1");
170 draw_staff (-2, 2, 0);
175 fet_beginchar ("Brevis notehead", "s-1");
178 draw_staff (-2, 2, 0.5);
183 fet_beginchar ("Whole notehead", "s0");
184 draw_outside_ellipse (1.80 - puff_up_factor / 3.0, 0, 0.707, 0);
185 undraw_inside_ellipse (1.30, 125 - puff_up_factor * 10,
186 0.68, 2 stafflinethickness#);
188 draw_staff (-2, 2, 0);
193 fet_beginchar ("Whole notehead", "s0");
194 draw_outside_ellipse (1.80 - puff_up_factor / 3.0, 0,
196 undraw_inside_ellipse (1.30, 125 - puff_up_factor * 10,
197 0.68, 2 stafflinethickness#);
199 draw_staff (-2, 2, 0.5);
204 fet_beginchar ("Half notehead", "s1");
205 draw_outside_ellipse (1.53 - puff_up_factor / 3.0, 34, 0.66, 0.17);
206 undraw_inside_ellipse (3.25, 33, 0.81, 2.5 stafflinethickness#);
208 draw_staff (-2, 2, 0);
213 fet_beginchar ("Half notehead", "s1");
214 draw_outside_ellipse (1.53 - puff_up_factor / 3.0, 34,
216 undraw_inside_ellipse (3.25, 33, 0.81,
217 2.5 stafflinethickness#);
219 draw_staff (-2, 2, 0.5);
224 fet_beginchar ("Quart notehead", "s2");
225 % used to have 32. With 31, they are slightly bolder.
226 draw_outside_ellipse (1.49 - puff_up_factor / 3.0, 31, 0.707, 0);
227 black_notehead_width# := charwd;
229 draw_staff (-2, 2, 0);
234 fet_beginchar ("Quart notehead", "s2");
235 draw_outside_ellipse (1.49 - puff_up_factor / 3.0, 31,
238 draw_staff (-2, 2, 0.5);
243 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
246 fet_beginchar ("Whole diamondhead", "s0diamond");
247 draw_outside_ellipse (1.80, 0, 0.495, 0);
248 undraw_inside_ellipse (1.30, 125, 0.6,
249 .4 staff_space# + stafflinethickness#);
251 draw_staff (-2, 2, 0);
256 fet_beginchar ("Whole diamondhead", "s0diamond");
257 draw_outside_ellipse (1.80, 0, 0.495, 0);
258 undraw_inside_ellipse (1.30, 125, 0.6,
259 .4 staff_space# + stafflinethickness#);
261 draw_staff (-2, 2, 0.5);
266 fet_beginchar ("Half diamondhead", "s1diamond");
267 draw_outside_ellipse (1.50, 34, 0.49, 0.17);
268 undraw_inside_ellipse (3.5, 33, 0.80,
269 .3 staff_space# + 1.5 stafflinethickness#);
271 draw_staff (-2, 2, 0);
276 fet_beginchar ("Half diamondhead", "s1diamond");
277 draw_outside_ellipse (1.50, 34, 0.49, 0.17);
278 undraw_inside_ellipse (3.5, 33, 0.80,
280 + 1.5 stafflinethickness#);
282 draw_staff (-2, 2, 0.5);
287 fet_beginchar ("Quart diamondhead", "s2diamond");
288 draw_outside_ellipse (1.80, 35, 0.495, -0.25);
290 draw_staff (-2, 2, 0);
295 fet_beginchar ("Quart diamondhead", "s2diamond");
296 draw_outside_ellipse (1.80, 35, 0.495, -0.25);
298 draw_staff (-2, 2, 0.5);
303 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
306 vardef penposx@# (expr d) =
316 z@#l = pat intersectionpoint (z@# -- infinity * dir (d + 180));
317 z@#r = pat intersectionpoint (z@# -- infinity * dir (d));
322 def define_triangle_shape (expr stemdir) =
323 save triangle_a, triangle_b, triangle_c;
324 save triangle_out_a, triangle_out_b, triangle_out_c;
325 save triangle_in, triangle_out;
326 save width, depth, height;
327 save origin, left_up_dir;
328 save exact_left_point, exact_right_point, exact_down_point;
330 path triangle_a, triangle_b, triangle_c;
331 path triangle_out_a, triangle_out_b, triangle_out_c;
332 path triangle_in, triangle_out;
333 pair origin, left_up_dir;
334 pair exact_down_point, exact_left_point, exact_right_point;
337 pen_thick# = stafflinethickness# + .1 staff_space#;
338 define_pixels (llap);
339 define_blacker_pixels (pen_thick);
341 left_up_dir = llap# * dir (90 + tilt);
343 xpart (left_up_dir) * xs - (pen_thick# * xs) / 2 + xpart origin = 0;
346 exact_left_point := origin + (left_up_dir xscaled xs);
347 exact_down_point := origin + (left_up_dir rotated 120 xscaled xs);
348 exact_right_point := origin + (left_up_dir rotated 240 xscaled xs);
350 height# = ypart (exact_left_point + origin) + pen_thick# / 2;
351 depth# = -ypart (exact_down_point + origin) + pen_thick# / 2;
352 width# = xpart (exact_right_point - exact_left_point)
355 set_char_box (0, width#, depth#, height#);
357 % Formerly, the shape has simply been drawn with an elliptical pen
358 % (`scaled pen_thick xsaled xs'), but the envelope of such a curve
359 % is of 6th degree. For the sake of mf2pt1, we approximate it.
361 pickup pencircle scaled pen_thick xscaled xs;
363 z0 = (hround_pixels (xpart origin), 0);
365 z1 = z1' = z0 + llap * dir (90 + tilt) xscaled xs;
366 z2 = z2' = z0 + llap * dir (90 + tilt + 120) xscaled xs;
367 z3 = z3' = z0 + llap * dir (90 + tilt + 240) xscaled xs;
369 z12 = caveness [.5[z1, z2], z3];
370 z23 = caveness [.5[z2, z3], z1];
371 z31 = caveness [.5[z3, z1], z2];
373 triangle_a = z1 .. z12 .. z2;
374 triangle_b = z2 .. z23 .. z3;
375 triangle_c = z3 .. z31 .. z1;
377 penposx1 (angle (direction 0 of triangle_a) - 90);
378 penposx2 (angle (direction 0 of triangle_b) - 90);
379 penposx3 (angle (direction 0 of triangle_c) - 90);
381 penposx1' (angle (direction infinity of triangle_c) + 90);
382 penposx2' (angle (direction infinity of triangle_a) + 90);
383 penposx3' (angle (direction infinity of triangle_b) + 90);
385 penposx12 (angle (z12 - z0));
386 penposx23 (angle (z23 - z0));
387 penposx31 (angle (z31 - z0));
389 z10 = (z0 -- z1) intersectionpoint (z1l .. z12l .. z2'r);
390 z20 = (z0 -- z2) intersectionpoint (z2l .. z23l .. z3'r);
391 z30 = (z0 -- z3) intersectionpoint (z3l .. z31l .. z1'r);
404 triangle_out_a = z1r .. z12r .. z2'l;
405 triangle_out_b = z2r .. z23r .. z3'l;
406 triangle_out_c = z3r .. z31r .. z1'l;
408 triangle_out = top z1
410 .. z1r{direction 0 of triangle_out_a}
412 & {direction infinity of triangle_out_a}z2'l
415 .. z2r{direction 0 of triangle_out_b}
417 & {direction infinity of triangle_out_b}z3'l
420 .. z3r{direction 0 of triangle_out_c}
422 & {direction infinity of triangle_out_c}z1'l
425 labels (0, 10, 20, 30);
426 penlabels (1, 1', 2, 2', 3, 3', 12, 23, 31);
430 charwy := ypart exact_right_point;
431 charwx := xpart exact_right_point;
433 charwy := -ypart exact_down_point;
434 charwx := (width# - xpart exact_down_point);
439 def draw_whole_triangle_head =
445 llap# = 3/4 noteheight#;
449 define_triangle_shape (1);
455 fet_beginchar ("Whole trianglehead", "s0triangle");
456 draw_whole_triangle_head;
458 draw_staff (-2, 2, 0);
463 fet_beginchar ("Whole trianglehead", "s0triangle");
464 draw_whole_triangle_head;
466 draw_staff (-2, 2, 0.5);
471 def draw_small_triangle_head (expr dir) =
477 llap# = 2/3 noteheight#;
480 define_triangle_shape (dir);
484 filldraw triangle_out;
485 unfilldraw triangle_in;
489 fet_beginchar ("Half trianglehead", "d1triangle");
490 draw_small_triangle_head (-1);
492 draw_staff (-2, 2, 0);
496 fet_beginchar ("Half trianglehead", "u1triangle");
497 draw_small_triangle_head (1);
499 draw_staff (-2, 2, 0.5);
503 def draw_closed_triangle_head (expr dir) =
509 llap# = 2/3 noteheight#;
512 define_triangle_shape (dir);
517 fet_beginchar ("Quart trianglehead", "u2triangle");
518 draw_closed_triangle_head (1);
520 draw_staff (-2, 2, 0);
524 fet_beginchar ("Quart trianglehead", "d2triangle");
525 draw_closed_triangle_head (-1);
527 draw_staff (-2, 2, 0.5);
531 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
533 % Slash heads are for indicating improvisation. They are
534 % twice as high as normal heads.
536 def draw_slash (expr hwid_hash) =
540 exact_height = staff_space# + stafflinethickness# / 2;
542 set_char_box (0, 2 exact_height / slash_slope + hwid_hash,
543 exact_height, exact_height);
552 pickup pencircle scaled blot_diameter;
557 lft x2 = 2 h / slash_slope;
564 ne = unitvector (z3 - z4);
565 nw_dist = (ne rotated 90) * 0.5 blot_diameter;
568 .. (z1 + nw_dist){ne}
569 -- (z2 + nw_dist){ne}
572 .. (z3 - nw_dist){-ne}
573 -- (z4 - nw_dist){-ne}
577 if hwid_hash > 2 slash_thick#:
580 th = slash_thick - blot_diameter;
585 z6 - z5 = whatever * ne;
586 z8 - z7 = whatever * ne;
588 z5 = z1 + whatever * ne + th * (ne rotated -90);
589 z8 = z4 + whatever * ne + th * (ne rotated 90);
597 labels (range 1 thru 10);
601 fet_beginchar ("Whole slashhead", "s0slash");
602 draw_slash (4 slash_thick# + 0.5 staff_space#);
604 draw_staff (-2, 2, 0);
608 fet_beginchar ("Half slashhead", "s1slash");
609 draw_slash (3.0 slash_thick# + 0.15 staff_space#);
611 draw_staff (-2, 2, 0);
615 fet_beginchar ("Quart slashhead", "s2slash");
616 draw_slash (1.5 slash_thick#);
618 draw_staff (-2, 2, 0);
622 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
624 % `thick' is the distance between the NE/SW parallel lines in the cross
625 % (distance between centres of lines) in multiples of stafflinethickness
627 def draw_cross (expr thick) =
629 save ne_dist, nw_dist, rt_dist, up_dist;
630 save crz_in, crz_out;
633 pair ne_dist, nw_dist, rt_dist, up_dist;
634 path crz_in, crz_out;
636 pen_thick# := 1.2 stafflinethickness#;
637 thickness# := thick * stafflinethickness#;
638 define_pixels (thickness);
639 define_blacker_pixels (pen_thick);
641 pickup pencircle scaled pen_thick;
646 ne = unitvector ((1, (2 h - pen_thick) / (w - pen_thick)));
649 z4 - z5 = whatever * ne;
651 z6 - z3 = whatever * ne;
652 z3 - z4 = whatever * (ne yscaled -1);
654 z4 - z3 = whatever * (ne) + (ne rotated -90) * thickness;
657 x1 = charwd / 2 - .5 pen_thick#;
659 + thick / 2 * stafflinethickness# * (ne rotated -90);
661 % labels (1, 2, 3, 4, 5, 6);
663 nw = unitvector (z3 - z4);
665 up_dist = up * 0.5 pen_thick / cosd (angle (ne));
666 rt_dist = right * 0.5 pen_thick / sind (angle (ne));
667 nw_dist = (ne rotated 90) * 0.5 pen_thick;
668 ne_dist = (nw rotated -90) * 0.5 pen_thick;
674 x4 := hround (x4' + .5 pen_thick) - .5 pen_thick;
675 x5 := hfloor (x5' + xpart rt_dist) - xpart rt_dist;
676 y6 := vfloor (y6' + ypart up_dist) - ypart up_dist;
678 crz_out = (z6 + up_dist)
679 -- (z3 + nw_dist){ne}
681 .. (z3 + ne_dist){-nw}
682 -- (z4 + ne_dist){-nw}
684 .. (z4 - nw_dist){-ne}
686 crz_out := crz_out shifted (0, feta_shift)
687 -- reverse crz_out yscaled -1 shifted (0, -feta_eps);
689 -- reverse crz_out xscaled -1 shifted (-feta_eps, 0)
693 x4 := hround (x4' - xpart rt_dist) + xpart rt_dist;
694 x5 := hceiling (x5' - .5 pen_thick) + .5 pen_thick;
695 y6 := vfloor (y6' - .5 pen_thick) + .5 pen_thick;
697 crz_in = (bot z6){right}
698 .. (z6 - nw_dist){ne}
701 -- (z5 + nw_dist){-ne}
703 crz_in := crz_in shifted (0, feta_shift)
704 -- reverse crz_in yscaled -1 shifted (0, -feta_eps);
706 -- reverse crz_in xscaled -1 shifted (-feta_eps, 0)
711 currentpicture := currentpicture shifted (hround (w / 2), 0);
714 charwy := y1 + feta_shift;
716 z12 = (charwx * hppp, y1 * vppp);
722 fet_beginchar ("Whole Crossed notehead", "s0cross");
725 wid# := black_notehead_width# + 4 stafflinethickness#;
726 hei# := noteheight# + stafflinethickness#;
728 set_char_box (0, wid#, hei# / 2, hei# / 2);
732 remember_pic := currentpicture;
734 draw_staff (-2, 2, 0);
739 fet_beginchar ("Whole Crossed notehead", "s0cross");
742 wid# := black_notehead_width# + 4 stafflinethickness#;
743 hei# := noteheight# + stafflinethickness#;
745 set_char_box (0, wid#, hei# / 2, hei# / 2);
747 currentpicture := remember_pic;
749 draw_staff (-2, 2, 0.5);
754 fet_beginchar ("Half Crossed notehead", "s1cross");
757 wid# := black_notehead_width# + 2 stafflinethickness#;
758 hei# := noteheight# + stafflinethickness# / 2;
760 set_char_box (0, wid#, hei# / 2, hei# / 2);
764 remember_pic := currentpicture;
766 draw_staff (-2, 2, 0);
771 fet_beginchar ("Half Crossed notehead", "s1cross");
774 wid# := black_notehead_width# + 2 stafflinethickness#;
775 hei# := noteheight# + stafflinethickness# / 2;
777 set_char_box (0, wid#, hei# / 2, hei# / 2);
779 currentpicture := remember_pic;
781 draw_staff (-2, 2, 0.5);
786 fet_beginchar ("Crossed notehead", "s2cross");
787 wid# := black_notehead_width#;
789 set_char_box (0, wid#, hei# / 2, hei# / 2);
793 remember_pic := currentpicture;
795 draw_staff (-2, 2, 0);
800 fet_beginchar ("Crossed notehead", "s2cross");
801 wid# := black_notehead_width#;
803 set_char_box (0, wid#, hei# / 2, hei# / 2);
805 currentpicture := remember_pic;
807 draw_staff (-2, 2, 0.5);
812 fet_beginchar ("X-Circled notehead", "s2xcircle");
814 save cthick, cxd, cyd, dy;
816 wid# := black_notehead_width# * sqrt (sqrt2);
817 hei# := noteheight# * sqrt (sqrt2);
819 set_char_box (0, wid#, hei# / 2, hei# / 2);
821 d := d - feta_space_shift;
823 cthick# := (1.2 + 1/4) * stafflinethickness#;
824 define_blacker_pixels (cthick);
827 cyd := h + d - cthick / 2;
831 pickup pencircle scaled cthick;
833 fill fullcircle xscaled (cxd + cthick)
834 yscaled (cyd + cthick)
836 unfill fullcircle xscaled (cxd - cthick)
837 yscaled (cyd - cthick)
840 xpos := .5 cxd / sqrt2;
841 ypos := .5 cyd / sqrt2;
843 pickup penrazor scaled cthick rotated (angle (xpos, ypos) + 90);
844 draw (-xpos + w / 2, -ypos + dy) -- (xpos + w / 2, ypos + dy);
846 pickup penrazor scaled cthick rotated (angle (xpos, -ypos) + 90);
847 draw (-xpos + w / 2, ypos + dy) -- (xpos + w / 2, -ypos + dy);
852 z12 = (charwx * hppp, charwy * vppp);
855 remember_pic := currentpicture;
857 draw_staff (-2, 2, 0);
862 fet_beginchar ("X-Circled notehead", "s2xcircle");
864 save cthick, cxr, cyr;
866 wid# := black_notehead_width# * sqrt (sqrt2);
867 hei# := noteheight# * sqrt (sqrt2);
869 set_char_box (0, wid#, hei# / 2, hei# / 2);
871 currentpicture := remember_pic;
873 draw_staff (-2, 2, 0.5);
883 save solfa_pen_thick;
884 solfa_pen_thick# = 2 stafflinethickness#;
885 define_blacker_pixels (solfa_pen_thick);
888 def draw_do_head (expr width_factor, dir) =
890 save left_dist, right_dist;
892 pair left_dist, right_dist;
894 set_char_box (0, width_factor * noteheight#,
895 0.5 noteheight#, 0.5 noteheight#);
897 pickup pencircle scaled solfa_pen_thick;
906 left_dist = (unitvector (z3 - z1) rotated 90) * 0.5 solfa_pen_thick;
907 right_dist = (unitvector (z2 - z3) rotated 90) * 0.5 solfa_pen_thick;
909 p_in := (((z1 - left_dist) -- (z3 - left_dist)) intersectionpoint
911 -- ((top z1 -- top z2) intersectionpoint
912 ((z2 - right_dist) -- (z3 - right_dist)))
913 -- (((z2 - right_dist) -- (z3 - right_dist)) intersectionpoint
914 ((z1 - left_dist) -- (z3 - left_dist)))
920 .. (z2 + right_dist){z3 - z2}
921 -- (z3 + right_dist){z3 - z2}
923 .. (z3 + left_dist){z1 - z3}
924 -- (z1 + left_dist){z1 - z3}
932 charwy := -chardp + 0.5 stafflinethickness#;
939 fet_beginchar ("Whole dohead", "s0do");
940 draw_do_head (1.8, 1);
946 fet_beginchar ("Half dohead", "d1do");
947 draw_do_head (1.5, -1);
953 fet_beginchar ("Half dohead", "u1do");
954 draw_do_head (1.5, 1);
960 fet_beginchar ("Quart dohead", "d2do");
961 draw_do_head (1.55, -1);
966 fet_beginchar ("Quart dohead", "u2do");
967 draw_do_head (1.55, 1);
973 % re - flat top, curved bottom:
974 % (0,h/2) {dir -90} .. (w/2,-h/2) .. {dir 90} (w,h/2) -- cycle;
975 % (broader along the base and with more vertical sides for half and
977 % stem attachment: h/2
980 def draw_re_head (expr width_factor, dir) =
984 set_char_box (0, width_factor * noteheight#,
985 0.5 noteheight#, 0.5 noteheight#);
987 pickup pencircle scaled solfa_pen_thick;
994 y2 = curve_start [y3, y1];
1002 labels (range 1 thru 5);
1004 p_in := (z1 + 0.5 solfa_pen_thick * (1, -1))
1008 -- (z5 + 0.5 solfa_pen_thick * (-1, -1))
1021 charwy := curve_start [-chardp, charht];
1029 fet_beginchar ("Whole rehead", "s0re");
1030 draw_re_head (1.8, 1);
1036 fet_beginchar ("Half up rehead", "u1re");
1037 draw_re_head (1.5, 1);
1043 fet_beginchar ("Half down rehead", "d1re");
1044 draw_re_head (1.5, -1);
1050 fet_beginchar ("Quart rehead", "u2re");
1051 draw_re_head (1.55, 1);
1056 fet_beginchar ("Quart rehead", "d2re");
1057 draw_re_head (1.55, -1);
1062 def draw_mi_head (expr width_factor) =
1063 save path_out, path_in;
1064 save ne_dist, se_dist, ne, se;
1065 path path_out, path_in;
1066 pair ne_dist, se_dist, ne, se;
1068 set_char_box (0, width_factor * noteheight#,
1069 0.5 noteheight#, 0.5 noteheight#);
1071 pickup pencircle scaled solfa_pen_thick;
1082 z6 - z5 = whatever * (z2 - z1);
1083 z8 - z7 = whatever * (z2 - z1);
1084 z8 - z5 = whatever * (z4 - z1);
1085 z6 - z7 = whatever * (z4 - z1);
1087 ne = unitvector (z4 - z1);
1088 se = unitvector (z1 - z2);
1090 ne_dist = (ne rotated 90) * 0.5 solfa_pen_thick;
1091 se_dist = (se rotated 90) * 0.5 solfa_pen_thick;
1093 z5 = whatever [z1, z4] - ne_dist;
1094 z5 = whatever [z1, z2] - 1.5 se_dist;
1096 z5 - z1 = -(z7 - z3);
1098 labels (range 1 thru 8);
1107 .. (z1 + se_dist){-se}
1108 -- (z2 + se_dist){-se}
1110 .. (z2 - ne_dist){ne}
1111 -- (z3 - ne_dist){ne}
1113 .. (z3 - se_dist){se}
1114 -- (z4 - se_dist){se}
1116 .. (z4 + ne_dist){-ne}
1117 -- (z1 + ne_dist){-ne}
1122 fet_beginchar ("Whole mihead", "s0mi");
1129 fet_beginchar ("Half mihead", "s1mi");
1136 fet_beginchar ("Quart mihead", "s2mi");
1137 draw_mi_head (1.65);
1142 def draw_fa_head (expr width_factor) =
1143 set_char_box (0, width_factor * noteheight#,
1144 0.5 noteheight#, 0.5 noteheight#);
1146 save p_down_in, p_down_out, p_up_in, p_up_out, nw_dist, nw;
1147 path p_down_in, p_down_out, p_up_in, p_up_out;
1150 pickup pencircle scaled solfa_pen_thick;
1163 labels (1, 2, 3, 4);
1165 nw = unitvector (z1 - z3);
1166 nw_dist = (nw rotated 90) * 0.5 solfa_pen_thick;
1168 p_up_in := (((z1 - nw_dist) -- (z3 - nw_dist)) intersectionpoint
1170 -- (((z1 - nw_dist) -- (z3 - nw_dist)) intersectionpoint
1172 -- (z2 + 0.5 solfa_pen_thick * (-1, -1))
1175 p_up_out := lft z1{down}
1176 .. (z1 + nw_dist){-nw}
1177 -- (z3 + nw_dist){-nw}
1185 p_down_in := p_up_in rotated 180 shifted (w, 0);
1186 p_down_out := p_up_out rotated 180 shifted (w, 0);
1193 fet_beginchar ("Whole fa up head", "u0fa");
1200 fet_beginchar ("Whole fa down head", "d0fa");
1207 fet_beginchar ("half fa up head", "u1fa");
1214 fet_beginchar ("Half fa down head", "d1fa");
1221 fet_beginchar ("Quarter fa up head", "u2fa");
1222 draw_fa_head (1.55);
1227 fet_beginchar ("Quarter fa down head", "d2fa");
1228 draw_fa_head (1.55);
1233 def draw_la_head (expr width_factor) =
1234 set_char_box (0, width_factor * noteheight#,
1235 0.5 noteheight#, 0.5 noteheight#);
1239 pickup pencircle scaled solfa_pen_thick;
1252 labels (range 1 thru 4);
1254 p_in := (z1 + 0.5 solfa_pen_thick * (1, -1))
1255 -- (z2 + 0.5 solfa_pen_thick * (-1, -1))
1256 -- (z3 + 0.5 solfa_pen_thick * (-1, 1))
1257 -- (z4 + 0.5 solfa_pen_thick * (1, 1))
1272 fet_beginchar ("Whole lahead", "s0la");
1279 fet_beginchar ("Half lahead", "s1la");
1286 fet_beginchar ("Quart lahead", "s2la");
1287 draw_la_head (1.55);
1292 def draw_ti_head (expr width_factor, dir) =
1293 set_char_box (0, width_factor * noteheight#,
1294 0.5 noteheight#, 0.5 noteheight#);
1295 save p_in, p_out, p_top;
1296 save nw_dist, sw_dist, nw, sw;
1297 path p_in, p_out, p_top;
1298 pair nw_dist, sw_dist, nw, sw;
1302 pickup pencircle scaled solfa_pen_thick;
1307 y2 = cone_height [y1, y3];
1313 labels (range 1 thru 4);
1315 nw = unitvector (z2 - z1);
1316 sw = unitvector (z1 - z4);
1318 nw_dist = (nw rotated 90) * 0.5 solfa_pen_thick;
1319 sw_dist = (sw rotated 90) * 0.5 solfa_pen_thick;
1321 p_top := (z2 - sw_dist)
1325 p_in := (((z1 - nw_dist) -- (z2 - nw_dist)) intersectionpoint
1326 ((z1 - sw_dist) -- (z4 - sw_dist)))
1327 -- (((z1 - nw_dist) -- (z2 - nw_dist)) intersectionpoint
1328 ((z2 + sw_dist) .. {right}(bot z3)))
1330 .. (((bot z3){right} .. (z4 + nw_dist)) intersectionpoint
1331 ((z1 - sw_dist) -- (z4 - sw_dist)))
1338 .. (z2 - sw_dist){direction 0 of p_top}
1340 & {direction infinity of p_top}(z4 - nw_dist)
1347 charwy := cone_height [-chardp, charht];
1354 fet_beginchar ("Whole up tihead", "s0ti");
1355 draw_ti_head (1.8, 1);
1361 fet_beginchar ("Half up tihead", "u1ti");
1362 draw_ti_head (1.5, 1);
1368 fet_beginchar ("Half down tihead", "d1ti");
1369 draw_ti_head (1.5, -1);
1375 fet_beginchar ("Quart up tihead", "u2ti");
1376 draw_ti_head (1.55, 1);
1381 fet_beginchar ("Quart down tihead", "d2ti");
1382 draw_ti_head (1.55, -1);
1387 fet_endgroup ("noteheads");
1391 % we derive black_notehead_width# from the quarter head,
1392 % so we have to define black_notehead_width (pixel qty)
1393 % after the black_notehead_width# itself.
1395 % Let's keep it outside the group as well.
1398 define_pixels (black_notehead_width);