2 % feta-bolletjes.mf -- implement noteheads
4 % source file of LilyPond's pretty-but-neat music font
6 % (c) 1997--2006 Jan Nieuwenhuizen <janneke@gnu.org>
7 % & Han-Wen Nienhuys <hanwen@xs4all.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, solfa_noteheight;
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#;
53 % solfa heads should not overlap on chords.
55 solfa_noteheight# := staff_space# - stafflinethickness#;
57 define_pixels (slash_thick);
58 define_whole_vertical_pixels (noteheight);
61 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
63 % SLANT moves both extrema on the long axis (by SLANT * ELLIPTICITY,
64 % so SLANT = -1, puts the extreme on the long axis next to the short
68 def draw_outside_ellipse (expr ellipticity, tilt, superness, slant) =
73 pat := superellipse ((ellipticity, 0), (-slant * ellipticity, 1.0),
74 (-ellipticity, 0), (slant * ellipticity, -1.0),
76 pat := pat rotated tilt;
78 save top_point, right_point;
79 pair top_point, right_point;
81 top_point := directionpoint left of pat;
82 right_point := directionpoint up of pat;
86 scaling# = noteheight# / (2 ypart (top_point));
87 width# := 2 xpart (right_point) * scaling#;
88 define_pixels (scaling, width);
90 set_char_box (0, width#, noteheight# / 2, noteheight# / 2);
92 d := d - feta_space_shift;
95 charwy := ypart (right_point) * scaling#;
98 pat := pat scaled scaling shifted (w / 2, .5 (h - d));
100 width := hround width;
102 if test_outlines = 1:
110 def undraw_inside_ellipse (expr ellipticity, tilt, superness, clearance) =
115 pat := superellipse ((ellipticity, 0), (0, 1.0),
116 (-ellipticity, 0), (0, -1.0),
118 pat := pat rotated tilt;
120 save top_point, right_point;
121 pair top_point, right_point;
123 top_point := directionpoint left of pat;
124 right_point := directionpoint up of pat;
126 save height, scaling;
128 height# = staff_space# + stafflinethickness# - clearance;
129 scaling# = height# / (2 ypart (top_point));
130 define_pixels (scaling);
131 pat := pat scaled scaling shifted (w / 2, .5 (h - d));
133 if test_outlines = 1:
143 % dimensions aren't entirely right.
146 save stemthick, fudge;
148 stemthick# = 2 stafflinethickness#;
149 define_whole_blacker_pixels (stemthick);
151 fudge = hround (blot_diameter / 2);
153 draw_outside_ellipse (1.80, 0, 0.707, 0);
154 undraw_inside_ellipse (1.30, 125, 0.68, 2 stafflinethickness#);
156 pickup pencircle scaled stemthick;
168 draw_gridline (z1, z2, stemthick);
169 draw_gridline (z3, z4, stemthick);
173 fet_beginchar ("Brevis notehead", "s-1");
176 draw_staff (-2, 2, 0);
181 fet_beginchar ("Brevis notehead", "s-1");
184 draw_staff (-2, 2, 0.5);
189 fet_beginchar ("Whole notehead", "s0");
190 draw_outside_ellipse (1.80 - puff_up_factor / 3.0, 0, 0.707, 0);
191 undraw_inside_ellipse (1.30, 125 - puff_up_factor * 10,
192 0.68, 2 stafflinethickness#);
194 draw_staff (-2, 2, 0);
199 fet_beginchar ("Whole notehead", "s0");
200 draw_outside_ellipse (1.80 - puff_up_factor / 3.0, 0,
202 undraw_inside_ellipse (1.30, 125 - puff_up_factor * 10,
203 0.68, 2 stafflinethickness#);
205 draw_staff (-2, 2, 0.5);
212 fet_beginchar ("Half notehead", "s1");
213 draw_outside_ellipse (1.53 - puff_up_factor / 3.0, 34, 0.66, 0.17);
214 undraw_inside_ellipse (3.25, 33, 0.81, 2.5 stafflinethickness#);
216 draw_staff (-2, 2, 0);
221 fet_beginchar ("Half notehead", "s1");
222 draw_outside_ellipse (1.53 - puff_up_factor / 3.0, 34,
224 undraw_inside_ellipse (3.25, 33, 0.81,
225 2.5 stafflinethickness#);
227 draw_staff (-2, 2, 0.5);
232 fet_beginchar ("Quart notehead", "s2");
233 % used to have 32. With 31, they are slightly bolder.
234 draw_outside_ellipse (1.49 - puff_up_factor / 3.0, 31, 0.707, 0);
235 black_notehead_width# := charwd;
237 draw_staff (-2, 2, 0);
241 fet_beginchar ("Quart notehead", "s2");
242 draw_outside_ellipse (1.49 - puff_up_factor / 3.0, 31,
245 draw_staff (-2, 2, 0.5);
249 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
252 %% fonts for "small style"
255 fet_beginchar ("Half notehead (quarter size)", "s1small");
256 draw_outside_ellipse (1.49 - puff_up_factor / 3.0, 31, 0.707, 0.0);
257 undraw_inside_ellipse (3.25, 33, 0.81, 2.8 stafflinethickness#);
259 draw_staff (-2, 2, 0);
264 fet_beginchar ("Quart notehead (quarter size)", "s2small");
265 % used to have 32. With 31, they are slightly bolder.
266 draw_outside_ellipse (1.49 - puff_up_factor / 3.0, 31, 0.707, 0);
267 black_notehead_width# := charwd;
269 draw_staff (-2, 2, 0);
273 fet_beginchar ("Whole notehead (quarter size)", "s0small");
274 draw_outside_ellipse (1.60 - puff_up_factor / 3.0, 0, 0.707, 0);
275 undraw_inside_ellipse (1.30, 125 - puff_up_factor * 10,
276 0.68, 2 stafflinethickness#);
278 draw_staff (-2, 2, 0);
282 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
285 fet_beginchar ("Whole diamondhead", "s0diamond");
286 draw_outside_ellipse (1.80, 0, 0.495, 0);
287 undraw_inside_ellipse (1.30, 125, 0.6,
288 .4 staff_space# + stafflinethickness#);
290 draw_staff (-2, 2, 0);
295 fet_beginchar ("Whole diamondhead", "s0diamond");
296 draw_outside_ellipse (1.80, 0, 0.495, 0);
297 undraw_inside_ellipse (1.30, 125, 0.6,
298 .4 staff_space# + stafflinethickness#);
300 draw_staff (-2, 2, 0.5);
305 fet_beginchar ("Half diamondhead", "s1diamond");
306 draw_outside_ellipse (1.50, 34, 0.49, 0.17);
307 undraw_inside_ellipse (3.5, 33, 0.80,
308 .3 staff_space# + 1.5 stafflinethickness#);
310 draw_staff (-2, 2, 0);
315 fet_beginchar ("Half diamondhead", "s1diamond");
316 draw_outside_ellipse (1.50, 34, 0.49, 0.17);
317 undraw_inside_ellipse (3.5, 33, 0.80,
319 + 1.5 stafflinethickness#);
321 draw_staff (-2, 2, 0.5);
326 fet_beginchar ("Quart diamondhead", "s2diamond");
327 draw_outside_ellipse (1.80, 35, 0.495, -0.25);
329 draw_staff (-2, 2, 0);
334 fet_beginchar ("Quart diamondhead", "s2diamond");
335 draw_outside_ellipse (1.80, 35, 0.495, -0.25);
337 draw_staff (-2, 2, 0.5);
342 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
345 vardef penposx@# (expr d) =
355 z@#l = pat intersectionpoint (z@# -- infinity * dir (d + 180));
356 z@#r = pat intersectionpoint (z@# -- infinity * dir (d));
361 def define_triangle_shape (expr stemdir) =
362 save triangle_a, triangle_b, triangle_c;
363 save triangle_out_a, triangle_out_b, triangle_out_c;
364 save triangle_in, triangle_out;
365 save width, depth, height;
366 save origin, left_up_dir;
367 save exact_left_point, exact_right_point, exact_down_point;
369 path triangle_a, triangle_b, triangle_c;
370 path triangle_out_a, triangle_out_b, triangle_out_c;
371 path triangle_in, triangle_out;
372 pair origin, left_up_dir;
373 pair exact_down_point, exact_left_point, exact_right_point;
376 pen_thick# = stafflinethickness# + .1 staff_space#;
377 define_pixels (llap);
378 define_blacker_pixels (pen_thick);
380 left_up_dir = llap# * dir (90 + tilt);
382 xpart (left_up_dir) * xs - (pen_thick# * xs) / 2 + xpart origin = 0;
385 exact_left_point := origin + (left_up_dir xscaled xs);
386 exact_down_point := origin + (left_up_dir rotated 120 xscaled xs);
387 exact_right_point := origin + (left_up_dir rotated 240 xscaled xs);
389 height# = ypart (exact_left_point + origin) + pen_thick# / 2;
390 depth# = -ypart (exact_down_point + origin) + pen_thick# / 2;
391 width# = xpart (exact_right_point - exact_left_point)
394 set_char_box (0, width#, depth#, height#);
396 % Formerly, the shape has simply been drawn with an elliptical pen
397 % (`scaled pen_thick xsaled xs'), but the envelope of such a curve
398 % is of 6th degree. For the sake of mf2pt1, we approximate it.
400 pickup pencircle scaled pen_thick xscaled xs;
402 z0 = (hround_pixels (xpart origin), 0);
404 z1 = z1' = z0 + llap * dir (90 + tilt) xscaled xs;
405 z2 = z2' = z0 + llap * dir (90 + tilt + 120) xscaled xs;
406 z3 = z3' = z0 + llap * dir (90 + tilt + 240) xscaled xs;
408 z12 = caveness [.5[z1, z2], z3];
409 z23 = caveness [.5[z2, z3], z1];
410 z31 = caveness [.5[z3, z1], z2];
412 triangle_a = z1 .. z12 .. z2;
413 triangle_b = z2 .. z23 .. z3;
414 triangle_c = z3 .. z31 .. z1;
416 penposx1 (angle (direction 0 of triangle_a) - 90);
417 penposx2 (angle (direction 0 of triangle_b) - 90);
418 penposx3 (angle (direction 0 of triangle_c) - 90);
420 penposx1' (angle (direction infinity of triangle_c) + 90);
421 penposx2' (angle (direction infinity of triangle_a) + 90);
422 penposx3' (angle (direction infinity of triangle_b) + 90);
424 penposx12 (angle (z12 - z0));
425 penposx23 (angle (z23 - z0));
426 penposx31 (angle (z31 - z0));
428 z10 = (z0 -- z1) intersectionpoint (z1l .. z12l .. z2'r);
429 z20 = (z0 -- z2) intersectionpoint (z2l .. z23l .. z3'r);
430 z30 = (z0 -- z3) intersectionpoint (z3l .. z31l .. z1'r);
443 triangle_out_a = z1r .. z12r .. z2'l;
444 triangle_out_b = z2r .. z23r .. z3'l;
445 triangle_out_c = z3r .. z31r .. z1'l;
447 triangle_out = top z1
449 .. z1r{direction 0 of triangle_out_a}
451 & {direction infinity of triangle_out_a}z2'l
454 .. z2r{direction 0 of triangle_out_b}
456 & {direction infinity of triangle_out_b}z3'l
459 .. z3r{direction 0 of triangle_out_c}
461 & {direction infinity of triangle_out_c}z1'l
464 labels (0, 10, 20, 30);
465 penlabels (1, 1', 2, 2', 3, 3', 12, 23, 31);
469 charwy := ypart exact_right_point;
470 charwx := xpart exact_right_point;
472 charwy := -ypart exact_down_point;
473 charwx := (width# - xpart exact_down_point);
478 def draw_whole_triangle_head =
484 llap# = 3/4 noteheight#;
488 define_triangle_shape (1);
494 fet_beginchar ("Whole trianglehead", "s0triangle");
495 draw_whole_triangle_head;
497 draw_staff (-2, 2, 0);
502 fet_beginchar ("Whole trianglehead", "s0triangle");
503 draw_whole_triangle_head;
505 draw_staff (-2, 2, 0.5);
510 def draw_small_triangle_head (expr dir) =
516 llap# = 2/3 noteheight#;
519 define_triangle_shape (dir);
523 filldraw triangle_out;
524 unfilldraw triangle_in;
528 fet_beginchar ("Half trianglehead", "d1triangle");
529 draw_small_triangle_head (-1);
531 draw_staff (-2, 2, 0);
535 fet_beginchar ("Half trianglehead", "u1triangle");
536 draw_small_triangle_head (1);
538 draw_staff (-2, 2, 0.5);
542 def draw_closed_triangle_head (expr dir) =
548 llap# = 2/3 noteheight#;
551 define_triangle_shape (dir);
556 fet_beginchar ("Quart trianglehead", "u2triangle");
557 draw_closed_triangle_head (1);
559 draw_staff (-2, 2, 0);
563 fet_beginchar ("Quart trianglehead", "d2triangle");
564 draw_closed_triangle_head (-1);
566 draw_staff (-2, 2, 0.5);
570 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
572 % Slash heads are for indicating improvisation. They are
573 % twice as high as normal heads.
575 def draw_slash (expr hwid_hash) =
579 exact_height = staff_space# + stafflinethickness# / 2;
581 set_char_box (0, 2 exact_height / slash_slope + hwid_hash,
582 exact_height, exact_height);
591 pickup pencircle scaled blot_diameter;
596 lft x2 = 2 h / slash_slope;
603 ne = unitvector (z3 - z4);
604 nw_dist = (ne rotated 90) * 0.5 blot_diameter;
607 .. (z1 + nw_dist){ne}
608 -- (z2 + nw_dist){ne}
611 .. (z3 - nw_dist){-ne}
612 -- (z4 - nw_dist){-ne}
616 if hwid_hash > 2 slash_thick#:
619 th = slash_thick - blot_diameter;
624 z6 - z5 = whatever * ne;
625 z8 - z7 = whatever * ne;
627 z5 = z1 + whatever * ne + th * (ne rotated -90);
628 z8 = z4 + whatever * ne + th * (ne rotated 90);
636 labels (range 1 thru 10);
640 fet_beginchar ("Whole slashhead", "s0slash");
641 draw_slash (4 slash_thick# + 0.5 staff_space#);
643 draw_staff (-2, 2, 0);
647 fet_beginchar ("Half slashhead", "s1slash");
648 draw_slash (3.0 slash_thick# + 0.15 staff_space#);
650 draw_staff (-2, 2, 0);
654 fet_beginchar ("Quart slashhead", "s2slash");
655 draw_slash (1.5 slash_thick#);
657 draw_staff (-2, 2, 0);
661 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
663 % `thick' is the distance between the NE/SW parallel lines in the cross
664 % (distance between centres of lines) in multiples of stafflinethickness
666 def draw_cross (expr thick) =
668 save ne_dist, nw_dist, rt_dist, up_dist;
669 save crz_in, crz_out;
672 pair ne_dist, nw_dist, rt_dist, up_dist;
673 path crz_in, crz_out;
675 pen_thick# := 1.2 stafflinethickness#;
676 thickness# := thick * stafflinethickness#;
677 define_pixels (thickness);
678 define_blacker_pixels (pen_thick);
680 pickup pencircle scaled pen_thick;
685 ne = unitvector ((1, (2 h - pen_thick) / (w - pen_thick)));
688 z4 - z5 = whatever * ne;
690 z6 - z3 = whatever * ne;
691 z3 - z4 = whatever * (ne yscaled -1);
693 z4 - z3 = whatever * (ne) + (ne rotated -90) * thickness;
696 x1 = charwd / 2 - .5 pen_thick#;
698 + thick / 2 * stafflinethickness# * (ne rotated -90);
700 % labels (1, 2, 3, 4, 5, 6);
702 nw = unitvector (z3 - z4);
704 up_dist = up * 0.5 pen_thick / cosd (angle (ne));
705 rt_dist = right * 0.5 pen_thick / sind (angle (ne));
706 nw_dist = (ne rotated 90) * 0.5 pen_thick;
707 ne_dist = (nw rotated -90) * 0.5 pen_thick;
713 x4 := hround (x4' + .5 pen_thick) - .5 pen_thick;
714 x5 := hfloor (x5' + xpart rt_dist) - xpart rt_dist;
715 y6 := vfloor (y6' + ypart up_dist) - ypart up_dist;
717 crz_out = (z6 + up_dist)
718 -- (z3 + nw_dist){ne}
720 .. (z3 + ne_dist){-nw}
721 -- (z4 + ne_dist){-nw}
723 .. (z4 - nw_dist){-ne}
725 crz_out := crz_out shifted (0, feta_shift)
726 -- reverse crz_out yscaled -1 shifted (0, -feta_eps);
728 -- reverse crz_out xscaled -1 shifted (-feta_eps, 0)
732 x4 := hround (x4' - xpart rt_dist) + xpart rt_dist;
733 x5 := hceiling (x5' - .5 pen_thick) + .5 pen_thick;
734 y6 := vfloor (y6' - .5 pen_thick) + .5 pen_thick;
736 crz_in = (bot z6){right}
737 .. (z6 - nw_dist){ne}
740 -- (z5 + nw_dist){-ne}
742 crz_in := crz_in shifted (0, feta_shift)
743 -- reverse crz_in yscaled -1 shifted (0, -feta_eps);
745 -- reverse crz_in xscaled -1 shifted (-feta_eps, 0)
750 currentpicture := currentpicture shifted (hround (w / 2), 0);
753 charwy := y1 + feta_shift;
755 z12 = (charwx * hppp, y1 * vppp);
761 fet_beginchar ("Whole Crossed notehead", "s0cross");
764 wid# := black_notehead_width# + 4 stafflinethickness#;
765 hei# := noteheight# + stafflinethickness#;
767 set_char_box (0, wid#, hei# / 2, hei# / 2);
771 remember_pic := currentpicture;
773 draw_staff (-2, 2, 0);
778 fet_beginchar ("Whole Crossed notehead", "s0cross");
781 wid# := black_notehead_width# + 4 stafflinethickness#;
782 hei# := noteheight# + stafflinethickness#;
784 set_char_box (0, wid#, hei# / 2, hei# / 2);
786 currentpicture := remember_pic;
788 draw_staff (-2, 2, 0.5);
793 fet_beginchar ("Half Crossed notehead", "s1cross");
796 wid# := black_notehead_width# + 2 stafflinethickness#;
797 hei# := noteheight# + stafflinethickness# / 2;
799 set_char_box (0, wid#, hei# / 2, hei# / 2);
803 remember_pic := currentpicture;
805 draw_staff (-2, 2, 0);
810 fet_beginchar ("Half Crossed notehead", "s1cross");
813 wid# := black_notehead_width# + 2 stafflinethickness#;
814 hei# := noteheight# + stafflinethickness# / 2;
816 set_char_box (0, wid#, hei# / 2, hei# / 2);
818 currentpicture := remember_pic;
820 draw_staff (-2, 2, 0.5);
825 fet_beginchar ("Crossed notehead", "s2cross");
826 wid# := black_notehead_width#;
828 set_char_box (0, wid#, hei# / 2, hei# / 2);
832 remember_pic := currentpicture;
834 draw_staff (-2, 2, 0);
839 fet_beginchar ("Crossed notehead", "s2cross");
840 wid# := black_notehead_width#;
842 set_char_box (0, wid#, hei# / 2, hei# / 2);
844 currentpicture := remember_pic;
846 draw_staff (-2, 2, 0.5);
851 fet_beginchar ("X-Circled notehead", "s2xcircle");
853 save cthick, cxd, cyd, dy;
855 wid# := black_notehead_width# * sqrt (sqrt2);
856 hei# := noteheight# * sqrt (sqrt2);
858 set_char_box (0, wid#, hei# / 2, hei# / 2);
860 d := d - feta_space_shift;
862 cthick# := (1.2 + 1/4) * stafflinethickness#;
863 define_blacker_pixels (cthick);
866 cyd := h + d - cthick / 2;
870 pickup pencircle scaled cthick;
872 fill fullcircle xscaled (cxd + cthick)
873 yscaled (cyd + cthick)
875 unfill fullcircle xscaled (cxd - cthick)
876 yscaled (cyd - cthick)
879 xpos := .5 cxd / sqrt2;
880 ypos := .5 cyd / sqrt2;
882 pickup penrazor scaled cthick rotated (angle (xpos, ypos) + 90);
883 draw (-xpos + w / 2, -ypos + dy) -- (xpos + w / 2, ypos + dy);
885 pickup penrazor scaled cthick rotated (angle (xpos, -ypos) + 90);
886 draw (-xpos + w / 2, ypos + dy) -- (xpos + w / 2, -ypos + dy);
891 z12 = (charwx * hppp, charwy * vppp);
894 remember_pic := currentpicture;
896 draw_staff (-2, 2, 0);
901 fet_beginchar ("X-Circled notehead", "s2xcircle");
903 save cthick, cxr, cyr;
905 wid# := black_notehead_width# * sqrt (sqrt2);
906 hei# := noteheight# * sqrt (sqrt2);
908 set_char_box (0, wid#, hei# / 2, hei# / 2);
910 currentpicture := remember_pic;
912 draw_staff (-2, 2, 0.5);
922 save solfa_pen_thick;
923 solfa_pen_thick# = 2 stafflinethickness#;
924 define_blacker_pixels (solfa_pen_thick);
927 solfa_whole_width := 1.8;
928 solfa_half_width := 1.35;
929 solfa_quarter_width := 1.35;
932 def draw_do_head (expr width_factor, dir) =
934 save left_dist, right_dist;
936 pair left_dist, right_dist;
938 set_char_box (0, width_factor * solfa_noteheight#,
939 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
941 pickup pencircle scaled solfa_pen_thick;
950 left_dist = (unitvector (z3 - z1) rotated 90) * 0.5 solfa_pen_thick;
951 right_dist = (unitvector (z2 - z3) rotated 90) * 0.5 solfa_pen_thick;
953 p_in := (((z1 - left_dist) -- (z3 - left_dist)) intersectionpoint
955 -- ((top z1 -- top z2) intersectionpoint
956 ((z2 - right_dist) -- (z3 - right_dist)))
957 -- (((z2 - right_dist) -- (z3 - right_dist)) intersectionpoint
958 ((z1 - left_dist) -- (z3 - left_dist)))
964 .. (z2 + right_dist){z3 - z2}
965 -- (z3 + right_dist){z3 - z2}
967 .. (z3 + left_dist){z1 - z3}
968 -- (z1 + left_dist){z1 - z3}
976 charwy := -chardp + 0.5 stafflinethickness#;
983 fet_beginchar ("Whole dohead", "s0do");
984 draw_do_head (solfa_whole_width, 1);
990 fet_beginchar ("Half dohead", "d1do");
991 draw_do_head (solfa_half_width, -1);
997 fet_beginchar ("Half dohead", "u1do");
998 draw_do_head (solfa_half_width, 1);
1004 fet_beginchar ("Quart dohead", "d2do");
1005 draw_do_head (solfa_quarter_width, -1);
1010 fet_beginchar ("Quart dohead", "u2do");
1011 draw_do_head (solfa_quarter_width, 1);
1017 % re - flat top, curved bottom:
1018 % (0,h/2) {dir -90} .. (w/2,-h/2) .. {dir 90} (w,h/2) -- cycle;
1019 % (broader along the base and with more vertical sides for half and
1021 % stem attachment: h/2
1024 def draw_re_head (expr width_factor, dir) =
1028 set_char_box (0, width_factor * solfa_noteheight#,
1029 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1031 pickup pencircle scaled solfa_pen_thick;
1038 y2 = curve_start [y3, y1];
1046 labels (range 1 thru 5);
1048 p_in := (z1 + 0.5 solfa_pen_thick * (1, -1))
1052 -- (z5 + 0.5 solfa_pen_thick * (-1, -1))
1065 charwy := curve_start [-chardp, charht];
1073 fet_beginchar ("Whole rehead", "s0re");
1074 draw_re_head (solfa_whole_width, 1);
1080 fet_beginchar ("Half up rehead", "u1re");
1081 draw_re_head (solfa_half_width, 1);
1087 fet_beginchar ("Half down rehead", "d1re");
1088 draw_re_head (solfa_half_width, -1);
1094 fet_beginchar ("Quart rehead", "u2re");
1095 draw_re_head (solfa_quarter_width, 1);
1100 fet_beginchar ("Quart rehead", "d2re");
1101 draw_re_head (solfa_quarter_width, -1);
1106 def draw_mi_head (expr width_factor) =
1107 save path_out, path_in;
1108 save ne_dist, se_dist, ne, se;
1109 path path_out, path_in;
1110 pair ne_dist, se_dist, ne, se;
1112 set_char_box (0, width_factor * solfa_noteheight#,
1113 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1115 pickup pencircle scaled solfa_pen_thick;
1126 z6 - z5 = whatever * (z2 - z1);
1127 z8 - z7 = whatever * (z2 - z1);
1128 z8 - z5 = whatever * (z4 - z1);
1129 z6 - z7 = whatever * (z4 - z1);
1131 ne = unitvector (z4 - z1);
1132 se = unitvector (z1 - z2);
1134 ne_dist = (ne rotated 90) * 0.5 solfa_pen_thick;
1135 se_dist = (se rotated 90) * 0.5 solfa_pen_thick;
1137 z5 = whatever [z1, z4] - ne_dist;
1138 z5 = whatever [z1, z2] - 1.5 se_dist;
1140 z5 - z1 = -(z7 - z3);
1142 labels (range 1 thru 8);
1151 .. (z1 + se_dist){-se}
1152 -- (z2 + se_dist){-se}
1154 .. (z2 - ne_dist){ne}
1155 -- (z3 - ne_dist){ne}
1157 .. (z3 - se_dist){se}
1158 -- (z4 - se_dist){se}
1160 .. (z4 + ne_dist){-ne}
1161 -- (z1 + ne_dist){-ne}
1166 fet_beginchar ("Whole mihead", "s0mi");
1167 draw_mi_head (solfa_whole_width);
1173 fet_beginchar ("Half mihead", "s1mi");
1174 draw_mi_head (solfa_quarter_width);
1180 fet_beginchar ("Quart mihead", "s2mi");
1181 draw_mi_head (solfa_quarter_width);
1186 def draw_fa_head (expr width_factor) =
1187 set_char_box (0, width_factor * solfa_noteheight#,
1188 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1190 save p_down_in, p_down_out, p_up_in, p_up_out, nw_dist, nw;
1191 path p_down_in, p_down_out, p_up_in, p_up_out;
1194 pickup pencircle scaled solfa_pen_thick;
1207 labels (1, 2, 3, 4);
1209 nw = unitvector (z1 - z3);
1210 nw_dist = (nw rotated 90) * 0.5 solfa_pen_thick;
1212 p_up_in := (((z1 - nw_dist) -- (z3 - nw_dist)) intersectionpoint
1214 -- (((z1 - nw_dist) -- (z3 - nw_dist)) intersectionpoint
1216 -- (z2 + 0.5 solfa_pen_thick * (-1, -1))
1219 p_up_out := lft z1{down}
1220 .. (z1 + nw_dist){-nw}
1221 -- (z3 + nw_dist){-nw}
1229 p_down_in := p_up_in rotated 180 shifted (w, 0);
1230 p_down_out := p_up_out rotated 180 shifted (w, 0);
1237 fet_beginchar ("Whole fa up head", "u0fa");
1238 draw_fa_head (solfa_whole_width);
1244 fet_beginchar ("Whole fa down head", "d0fa");
1245 draw_fa_head (solfa_whole_width);
1251 fet_beginchar ("half fa up head", "u1fa");
1252 draw_fa_head (solfa_half_width);
1258 fet_beginchar ("Half fa down head", "d1fa");
1259 draw_fa_head (solfa_half_width);
1265 fet_beginchar ("Quarter fa up head", "u2fa");
1266 draw_fa_head (solfa_quarter_width);
1271 fet_beginchar ("Quarter fa down head", "d2fa");
1272 draw_fa_head (solfa_quarter_width);
1277 def draw_la_head (expr width_factor) =
1278 set_char_box (0, width_factor * solfa_noteheight#,
1279 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1283 pickup pencircle scaled solfa_pen_thick;
1296 labels (range 1 thru 4);
1298 p_in := (z1 + 0.5 solfa_pen_thick * (1, -1))
1299 -- (z2 + 0.5 solfa_pen_thick * (-1, -1))
1300 -- (z3 + 0.5 solfa_pen_thick * (-1, 1))
1301 -- (z4 + 0.5 solfa_pen_thick * (1, 1))
1316 fet_beginchar ("Whole lahead", "s0la");
1317 draw_la_head (solfa_whole_width);
1323 fet_beginchar ("Half lahead", "s1la");
1324 draw_la_head (solfa_half_width);
1330 fet_beginchar ("Quart lahead", "s2la");
1331 draw_la_head (solfa_quarter_width);
1336 def draw_ti_head (expr width_factor, dir) =
1337 set_char_box (0, width_factor * solfa_noteheight#,
1338 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1339 save p_in, p_out, p_top;
1340 save nw_dist, sw_dist, nw, sw;
1341 path p_in, p_out, p_top;
1342 pair nw_dist, sw_dist, nw, sw;
1346 pickup pencircle scaled solfa_pen_thick;
1351 y2 = cone_height [y1, y3];
1357 labels (range 1 thru 4);
1359 nw = unitvector (z2 - z1);
1360 sw = unitvector (z1 - z4);
1362 nw_dist = (nw rotated 90) * 0.5 solfa_pen_thick;
1363 sw_dist = (sw rotated 90) * 0.5 solfa_pen_thick;
1365 p_top := (z2 - sw_dist)
1369 p_in := (((z1 - nw_dist) -- (z2 - nw_dist)) intersectionpoint
1370 ((z1 - sw_dist) -- (z4 - sw_dist)))
1371 -- (((z1 - nw_dist) -- (z2 - nw_dist)) intersectionpoint
1372 ((z2 + sw_dist) .. {right}(bot z3)))
1374 .. (((bot z3){right} .. (z4 + nw_dist)) intersectionpoint
1375 ((z1 - sw_dist) -- (z4 - sw_dist)))
1382 .. (z2 - sw_dist){direction 0 of p_top}
1384 & {direction infinity of p_top}(z4 - nw_dist)
1391 charwy := cone_height [-chardp, charht];
1398 fet_beginchar ("Whole up tihead", "s0ti");
1399 draw_ti_head (solfa_whole_width, 1);
1405 fet_beginchar ("Half up tihead", "u1ti");
1406 draw_ti_head (solfa_half_width, 1);
1412 fet_beginchar ("Half down tihead", "d1ti");
1413 draw_ti_head (solfa_half_width, -1);
1419 fet_beginchar ("Quart up tihead", "u2ti");
1420 draw_ti_head (solfa_quarter_width, 1);
1425 fet_beginchar ("Quart down tihead", "d2ti");
1426 draw_ti_head (solfa_quarter_width, -1);
1431 fet_endgroup ("noteheads");
1435 % we derive black_notehead_width# from the quarter head,
1436 % so we have to define black_notehead_width (pixel qty)
1437 % after the black_notehead_width# itself.
1439 % Let's keep it outside the group as well.
1442 define_pixels (black_notehead_width);