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 half_notehead_width, whole_notehead_width, slash_thick;
30 save slash_slope, overdone_heads, solfa_noteheight;
34 numeric black_notehead_width;
35 numeric whole_notehead_width;
36 numeric half_notehead_width;
39 fet_begingroup ("noteheads");
42 % Slope of slash. From scm/grob-description.scm. How to auto-copy?
45 % Thickness of slash lines. Quarter notes get 1.5slt width.
46 slash_thick# := 2/3 * 0.48 staff_space#;
50 % Hand-engraved music often has balls extending above and below
51 % the lines. If you like that, modify overdone heads (unit:
52 % stafflinethickness).
55 noteheight# := staff_space# + (1 + overdone_heads) * stafflinethickness#;
59 % solfa heads should not overlap on chords.
61 solfa_noteheight# := staff_space# - stafflinethickness#;
63 define_pixels (slash_thick);
64 define_whole_vertical_pixels (noteheight);
67 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
69 % SLANT moves both extrema on the long axis (by SLANT * ELLIPTICITY,
70 % so SLANT = -1, puts the extreme on the long axis next to the short
74 def draw_outside_ellipse (expr ellipticity, tilt, superness, slant) =
79 pat := superellipse ((ellipticity, 0), (-slant * ellipticity, 1.0),
80 (-ellipticity, 0), (slant * ellipticity, -1.0),
82 pat := pat rotated tilt;
84 save top_point, right_point;
85 pair top_point, right_point;
87 top_point := directionpoint left of pat;
88 right_point := directionpoint up of pat;
92 scaling# = noteheight# / (2 ypart (top_point));
93 width# := 2 xpart (right_point) * scaling#;
94 define_pixels (scaling, width);
96 set_char_box (0, width#, noteheight# / 2, noteheight# / 2);
98 d := d - feta_space_shift;
101 charwy := ypart (right_point) * scaling#;
104 pat := pat scaled scaling shifted (w / 2, .5 (h - d));
106 width := hround width;
108 if test_outlines = 1:
116 def undraw_inside_ellipse (expr ellipticity, tilt, superness, clearance) =
121 pat := superellipse ((ellipticity, 0), (0, 1.0),
122 (-ellipticity, 0), (0, -1.0),
124 pat := pat rotated tilt;
126 save top_point, right_point;
127 pair top_point, right_point;
129 top_point := directionpoint left of pat;
130 right_point := directionpoint up of pat;
132 save height, scaling;
134 height# = staff_space# + stafflinethickness# - clearance;
135 scaling# = height# / (2 ypart (top_point));
136 define_pixels (scaling);
137 pat := pat scaled scaling shifted (w / 2, .5 (h - d));
139 if test_outlines = 1:
149 % dimensions aren't entirely right.
152 save stemthick, fudge;
154 stemthick# = 2 stafflinethickness#;
155 define_whole_blacker_pixels (stemthick);
157 fudge = hround (blot_diameter / 2);
159 draw_outside_ellipse (1.80, 0, 0.707, 0);
160 undraw_inside_ellipse (1.30, 125, 0.68, 2 stafflinethickness#);
162 pickup pencircle scaled stemthick;
174 draw_gridline (z1, z2, stemthick);
175 draw_gridline (z3, z4, stemthick);
179 fet_beginchar ("Brevis notehead", "s-1");
182 draw_staff (-2, 2, 0);
187 fet_beginchar ("Brevis notehead", "s-1");
190 draw_staff (-2, 2, 0.5);
195 fet_beginchar ("Whole notehead", "s0");
196 draw_outside_ellipse (1.80 - puff_up_factor / 3.0, 0, 0.707, 0);
197 undraw_inside_ellipse (1.30, 125 - puff_up_factor * 10,
198 0.68, 2 stafflinethickness#);
200 whole_notehead_width# := charwd;
202 draw_staff (-2, 2, 0);
207 fet_beginchar ("Whole notehead", "s0");
208 draw_outside_ellipse (1.80 - puff_up_factor / 3.0, 0,
210 undraw_inside_ellipse (1.30, 125 - puff_up_factor * 10,
211 0.68, 2 stafflinethickness#);
213 draw_staff (-2, 2, 0.5);
220 fet_beginchar ("Half notehead", "s1");
221 draw_outside_ellipse (1.53 - puff_up_factor / 3.0, 34, 0.66, 0.17);
222 undraw_inside_ellipse (3.25, 33, 0.81, 2.5 stafflinethickness#);
224 half_notehead_width# := charwd;
226 draw_staff (-2, 2, 0);
231 fet_beginchar ("Half notehead", "s1");
232 draw_outside_ellipse (1.53 - puff_up_factor / 3.0, 34,
234 undraw_inside_ellipse (3.25, 33, 0.81,
235 2.5 stafflinethickness#);
237 draw_staff (-2, 2, 0.5);
242 fet_beginchar ("Quart notehead", "s2");
243 % used to have 32. With 31, they are slightly bolder.
244 draw_outside_ellipse (1.49 - puff_up_factor / 3.0, 31, 0.707, 0);
245 black_notehead_width# := charwd;
247 draw_staff (-2, 2, 0);
251 fet_beginchar ("Quart notehead", "s2");
252 draw_outside_ellipse (1.49 - puff_up_factor / 3.0, 31,
255 draw_staff (-2, 2, 0.5);
260 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
263 fet_beginchar ("Whole diamondhead", "s0diamond");
264 draw_outside_ellipse (1.80, 0, 0.495, 0);
265 undraw_inside_ellipse (1.30, 125, 0.6,
266 .4 staff_space# + stafflinethickness#);
268 draw_staff (-2, 2, 0);
273 fet_beginchar ("Whole diamondhead", "s0diamond");
274 draw_outside_ellipse (1.80, 0, 0.495, 0);
275 undraw_inside_ellipse (1.30, 125, 0.6,
276 .4 staff_space# + stafflinethickness#);
278 draw_staff (-2, 2, 0.5);
283 fet_beginchar ("Half diamondhead", "s1diamond");
284 draw_outside_ellipse (1.50, 34, 0.49, 0.17);
285 undraw_inside_ellipse (3.5, 33, 0.80,
286 .3 staff_space# + 1.5 stafflinethickness#);
288 draw_staff (-2, 2, 0);
293 fet_beginchar ("Half diamondhead", "s1diamond");
294 draw_outside_ellipse (1.50, 34, 0.49, 0.17);
295 undraw_inside_ellipse (3.5, 33, 0.80,
297 + 1.5 stafflinethickness#);
299 draw_staff (-2, 2, 0.5);
304 fet_beginchar ("Quart diamondhead", "s2diamond");
305 draw_outside_ellipse (1.80, 35, 0.495, -0.25);
307 draw_staff (-2, 2, 0);
312 fet_beginchar ("Quart diamondhead", "s2diamond");
313 draw_outside_ellipse (1.80, 35, 0.495, -0.25);
315 draw_staff (-2, 2, 0.5);
320 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
323 vardef penposx@# (expr d) =
333 z@#l = pat intersectionpoint (z@# -- infinity * dir (d + 180));
334 z@#r = pat intersectionpoint (z@# -- infinity * dir (d));
341 % UGH : xs not declared as argument.
343 def define_triangle_shape (expr stemdir) =
344 save triangle_a, triangle_b, triangle_c;
345 save triangle_out_a, triangle_out_b, triangle_out_c;
346 save triangle_in, triangle_out;
347 save width, depth, height;
348 save origin, left_up_dir;
349 save exact_left_point, exact_right_point, exact_down_point;
351 path triangle_a, triangle_b, triangle_c;
352 path triangle_out_a, triangle_out_b, triangle_out_c;
353 path triangle_in, triangle_out;
354 pair origin, left_up_dir;
355 pair exact_down_point, exact_left_point, exact_right_point;
358 pen_thick# = stafflinethickness# + .1 staff_space#;
359 define_pixels (llap);
360 define_blacker_pixels (pen_thick);
362 left_up_dir = llap# * dir (90 + tilt);
364 xpart (left_up_dir) * xs - (pen_thick# * xs) / 2 + xpart origin = 0;
367 exact_left_point := origin + (left_up_dir xscaled xs);
368 exact_down_point := origin + (left_up_dir rotated 120 xscaled xs);
369 exact_right_point := origin + (left_up_dir rotated 240 xscaled xs);
371 height# = ypart (exact_left_point + origin) + pen_thick# / 2;
372 depth# = -ypart (exact_down_point + origin) + pen_thick# / 2;
373 width# = xpart (exact_right_point - exact_left_point)
376 set_char_box (0, width#, depth#, height#);
378 % Formerly, the shape has simply been drawn with an elliptical pen
379 % (`scaled pen_thick xsaled xs'), but the envelope of such a curve
380 % is of 6th degree. For the sake of mf2pt1, we approximate it.
382 pickup pencircle scaled pen_thick xscaled xs;
384 z0 = (hround_pixels (xpart origin), 0);
386 z1 = z1' = z0 + llap * dir (90 + tilt) xscaled xs;
387 z2 = z2' = z0 + llap * dir (90 + tilt + 120) xscaled xs;
388 z3 = z3' = z0 + llap * dir (90 + tilt + 240) xscaled xs;
390 z12 = caveness [.5[z1, z2], z3];
391 z23 = caveness [.5[z2, z3], z1];
392 z31 = caveness [.5[z3, z1], z2];
394 triangle_a = z1 .. z12 .. z2;
395 triangle_b = z2 .. z23 .. z3;
396 triangle_c = z3 .. z31 .. z1;
398 penposx1 (angle (direction 0 of triangle_a) - 90);
399 penposx2 (angle (direction 0 of triangle_b) - 90);
400 penposx3 (angle (direction 0 of triangle_c) - 90);
402 penposx1' (angle (direction infinity of triangle_c) + 90);
403 penposx2' (angle (direction infinity of triangle_a) + 90);
404 penposx3' (angle (direction infinity of triangle_b) + 90);
406 penposx12 (angle (z12 - z0));
407 penposx23 (angle (z23 - z0));
408 penposx31 (angle (z31 - z0));
410 z10 = (z0 -- z1) intersectionpoint (z1l .. z12l .. z2'r);
411 z20 = (z0 -- z2) intersectionpoint (z2l .. z23l .. z3'r);
412 z30 = (z0 -- z3) intersectionpoint (z3l .. z31l .. z1'r);
425 triangle_out_a = z1r .. z12r .. z2'l;
426 triangle_out_b = z2r .. z23r .. z3'l;
427 triangle_out_c = z3r .. z31r .. z1'l;
429 triangle_out = top z1
431 .. z1r{direction 0 of triangle_out_a}
433 & {direction infinity of triangle_out_a}z2'l
436 .. z2r{direction 0 of triangle_out_b}
438 & {direction infinity of triangle_out_b}z3'l
441 .. z3r{direction 0 of triangle_out_c}
443 & {direction infinity of triangle_out_c}z1'l
446 labels (0, 10, 20, 30);
447 penlabels (1, 1', 2, 2', 3, 3', 12, 23, 31);
451 charwy := ypart exact_right_point;
452 charwx := xpart exact_right_point + .5 pen_thick# * xs;
454 charwy := -ypart exact_down_point;
455 charwx := (width# - xpart exact_down_point + xs * pen_thick#);
460 def draw_whole_triangle_head =
466 llap# = 3/4 noteheight#;
470 define_triangle_shape (1);
476 fet_beginchar ("Whole trianglehead", "s0triangle");
477 draw_whole_triangle_head;
479 draw_staff (-2, 2, 0);
484 fet_beginchar ("Whole trianglehead", "s0triangle");
485 draw_whole_triangle_head;
487 draw_staff (-2, 2, 0.5);
492 def draw_small_triangle_head (expr dir) =
498 llap# = 2/3 noteheight#;
501 define_triangle_shape (dir);
505 filldraw triangle_out;
506 unfilldraw triangle_in;
510 fet_beginchar ("Half trianglehead (downstem)", "d1triangle");
511 draw_small_triangle_head (-1);
513 draw_staff (-2, 2, 0);
517 fet_beginchar ("Half trianglehead (upstem)", "u1triangle");
518 draw_small_triangle_head (1);
520 draw_staff (-2, 2, 0.5);
524 def draw_closed_triangle_head (expr dir) =
530 llap# = 2/3 noteheight#;
533 define_triangle_shape (dir);
538 fet_beginchar ("Quart trianglehead (upstem)", "u2triangle");
539 draw_closed_triangle_head (1);
541 draw_staff (-2, 2, 0);
545 fet_beginchar ("Quart trianglehead (downstem)", "d2triangle");
546 draw_closed_triangle_head (-1);
548 draw_staff (-2, 2, 0.5);
552 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
554 % Slash heads are for indicating improvisation. They are
555 % twice as high as normal heads.
557 def draw_slash (expr hwid_hash) =
561 exact_height = staff_space# + stafflinethickness# / 2;
563 set_char_box (0, 2 exact_height / slash_slope + hwid_hash,
564 exact_height, exact_height);
573 pickup pencircle scaled blot_diameter;
578 lft x2 = 2 h / slash_slope;
585 ne = unitvector (z3 - z4);
586 nw_dist = (ne rotated 90) * 0.5 blot_diameter;
589 .. (z1 + nw_dist){ne}
590 -- (z2 + nw_dist){ne}
593 .. (z3 - nw_dist){-ne}
594 -- (z4 - nw_dist){-ne}
598 if hwid_hash > 2 slash_thick#:
601 th = slash_thick - blot_diameter;
606 z6 - z5 = whatever * ne;
607 z8 - z7 = whatever * ne;
609 z5 = z1 + whatever * ne + th * (ne rotated -90);
610 z8 = z4 + whatever * ne + th * (ne rotated 90);
618 labels (range 1 thru 10);
622 fet_beginchar ("Whole slashhead", "s0slash");
623 draw_slash (4 slash_thick# + 0.5 staff_space#);
625 draw_staff (-2, 2, 0);
629 fet_beginchar ("Half slashhead", "s1slash");
630 draw_slash (3.0 slash_thick# + 0.15 staff_space#);
632 draw_staff (-2, 2, 0);
636 fet_beginchar ("Quart slashhead", "s2slash");
637 draw_slash (1.5 slash_thick#);
639 draw_staff (-2, 2, 0);
643 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
645 % `thick' is the distance between the NE/SW parallel lines in the cross
646 % (distance between centres of lines) in multiples of stafflinethickness
648 def draw_cross (expr thick) =
650 save ne_dist, nw_dist, rt_dist, up_dist;
651 save crz_in, crz_out;
654 pair ne_dist, nw_dist, rt_dist, up_dist;
655 path crz_in, crz_out;
657 pen_thick# := 1.2 stafflinethickness#;
658 thickness# := thick * stafflinethickness#;
659 define_pixels (thickness);
660 define_blacker_pixels (pen_thick);
662 pickup pencircle scaled pen_thick;
667 ne = unitvector ((1, (2 h - pen_thick) / (w - pen_thick)));
670 z4 - z5 = whatever * ne;
672 z6 - z3 = whatever * ne;
673 z3 - z4 = whatever * (ne yscaled -1);
675 z4 - z3 = whatever * (ne) + (ne rotated -90) * thickness;
678 x1 = charwd / 2 - .5 pen_thick#;
680 + thick / 2 * stafflinethickness# * (ne rotated -90);
682 % labels (1, 2, 3, 4, 5, 6);
684 nw = unitvector (z3 - z4);
686 up_dist = up * 0.5 pen_thick / cosd (angle (ne));
687 rt_dist = right * 0.5 pen_thick / sind (angle (ne));
688 nw_dist = (ne rotated 90) * 0.5 pen_thick;
689 ne_dist = (nw rotated -90) * 0.5 pen_thick;
695 x4 := hround (x4' + .5 pen_thick) - .5 pen_thick;
696 x5 := hfloor (x5' + xpart rt_dist) - xpart rt_dist;
697 y6 := vfloor (y6' + ypart up_dist) - ypart up_dist;
699 crz_out = (z6 + up_dist)
700 -- (z3 + nw_dist){ne}
702 .. (z3 + ne_dist){-nw}
703 -- (z4 + ne_dist){-nw}
705 .. (z4 - nw_dist){-ne}
707 crz_out := crz_out shifted (0, feta_shift)
708 -- reverse crz_out yscaled -1 shifted (0, -feta_eps);
710 -- reverse crz_out xscaled -1 shifted (-feta_eps, 0)
714 x4 := hround (x4' - xpart rt_dist) + xpart rt_dist;
715 x5 := hceiling (x5' - .5 pen_thick) + .5 pen_thick;
716 y6 := vfloor (y6' - .5 pen_thick) + .5 pen_thick;
718 crz_in = (bot z6){right}
719 .. (z6 - nw_dist){ne}
722 -- (z5 + nw_dist){-ne}
724 crz_in := crz_in shifted (0, feta_shift)
725 -- reverse crz_in yscaled -1 shifted (0, -feta_eps);
727 -- reverse crz_in xscaled -1 shifted (-feta_eps, 0)
732 currentpicture := currentpicture shifted (hround (w / 2), 0);
735 charwy := y1 + feta_shift;
737 z12 = (charwx * hppp, y1 * vppp);
743 fet_beginchar ("Whole Crossed notehead", "s0cross");
746 wid# := black_notehead_width# + 4 stafflinethickness#;
747 hei# := noteheight# + stafflinethickness#;
749 set_char_box (0, wid#, hei# / 2, hei# / 2);
753 remember_pic := currentpicture;
755 draw_staff (-2, 2, 0);
760 fet_beginchar ("Whole Crossed notehead", "s0cross");
763 wid# := black_notehead_width# + 4 stafflinethickness#;
764 hei# := noteheight# + stafflinethickness#;
766 set_char_box (0, wid#, hei# / 2, hei# / 2);
768 currentpicture := remember_pic;
770 draw_staff (-2, 2, 0.5);
775 fet_beginchar ("Half Crossed notehead", "s1cross");
778 wid# := black_notehead_width# + 2 stafflinethickness#;
779 hei# := noteheight# + stafflinethickness# / 2;
781 set_char_box (0, wid#, hei# / 2, hei# / 2);
785 remember_pic := currentpicture;
787 draw_staff (-2, 2, 0);
792 fet_beginchar ("Half Crossed notehead", "s1cross");
795 wid# := black_notehead_width# + 2 stafflinethickness#;
796 hei# := noteheight# + stafflinethickness# / 2;
798 set_char_box (0, wid#, hei# / 2, hei# / 2);
800 currentpicture := remember_pic;
802 draw_staff (-2, 2, 0.5);
807 fet_beginchar ("Crossed notehead", "s2cross");
808 wid# := black_notehead_width#;
810 set_char_box (0, wid#, hei# / 2, hei# / 2);
814 remember_pic := currentpicture;
816 draw_staff (-2, 2, 0);
821 fet_beginchar ("Crossed notehead", "s2cross");
822 wid# := black_notehead_width#;
824 set_char_box (0, wid#, hei# / 2, hei# / 2);
826 currentpicture := remember_pic;
828 draw_staff (-2, 2, 0.5);
833 fet_beginchar ("X-Circled notehead", "s2xcircle");
835 save cthick, cxd, cyd, dy;
837 wid# := black_notehead_width# * sqrt (sqrt2);
838 hei# := noteheight# * sqrt (sqrt2);
840 set_char_box (0, wid#, hei# / 2, hei# / 2);
842 d := d - feta_space_shift;
844 cthick# := (1.2 + 1/4) * stafflinethickness#;
845 define_blacker_pixels (cthick);
848 cyd := h + d - cthick / 2;
852 pickup pencircle scaled cthick;
854 fill fullcircle xscaled (cxd + cthick)
855 yscaled (cyd + cthick)
857 unfill fullcircle xscaled (cxd - cthick)
858 yscaled (cyd - cthick)
861 xpos := .5 cxd / sqrt2;
862 ypos := .5 cyd / sqrt2;
864 pickup penrazor scaled cthick rotated (angle (xpos, ypos) + 90);
865 draw (-xpos + w / 2, -ypos + dy) -- (xpos + w / 2, ypos + dy);
867 pickup penrazor scaled cthick rotated (angle (xpos, -ypos) + 90);
868 draw (-xpos + w / 2, ypos + dy) -- (xpos + w / 2, -ypos + dy);
873 z12 = (charwx * hppp, charwy * vppp);
876 remember_pic := currentpicture;
878 draw_staff (-2, 2, 0);
883 fet_beginchar ("X-Circled notehead", "s2xcircle");
885 save cthick, cxr, cyr;
887 wid# := black_notehead_width# * sqrt (sqrt2);
888 hei# := noteheight# * sqrt (sqrt2);
890 set_char_box (0, wid#, hei# / 2, hei# / 2);
892 currentpicture := remember_pic;
894 draw_staff (-2, 2, 0.5);
904 save solfa_pen_thick;
905 solfa_pen_thick# = 1.75 stafflinethickness#;
906 define_blacker_pixels (solfa_pen_thick);
909 save solfa_base_notewidth;
910 solfa_base_notewidth# := black_notehead_width#;
912 solfa_whole_width := whole_notehead_width# / black_notehead_width#;
913 solfa_half_width := half_notehead_width# / black_notehead_width#;
914 solfa_quarter_width := 1.0;
916 def draw_do_head (expr width_factor, dir) =
918 save left_dist, right_dist;
920 pair left_dist, right_dist;
922 set_char_box (0, width_factor * solfa_base_notewidth#,
923 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
925 pickup pencircle scaled solfa_pen_thick;
934 left_dist = (unitvector (z3 - z1) rotated 90) * 0.5 solfa_pen_thick;
935 right_dist = (unitvector (z2 - z3) rotated 90) * 0.5 solfa_pen_thick;
937 p_in := (((z1 - left_dist) -- (z3 - left_dist)) intersectionpoint
939 -- ((top z1 -- top z2) intersectionpoint
940 ((z2 - right_dist) -- (z3 - right_dist)))
941 -- (((z2 - right_dist) -- (z3 - right_dist)) intersectionpoint
942 ((z1 - left_dist) -- (z3 - left_dist)))
948 .. (z2 + right_dist){z3 - z2}
949 -- (z3 + right_dist){z3 - z2}
951 .. (z3 + left_dist){z1 - z3}
952 -- (z1 + left_dist){z1 - z3}
960 charwy := -chardp + 0.5 stafflinethickness#;
967 fet_beginchar ("Whole dohead", "s0do");
968 draw_do_head (solfa_whole_width, 1);
974 fet_beginchar ("Half dohead", "d1do");
975 draw_do_head (solfa_half_width, -1);
981 fet_beginchar ("Half dohead", "u1do");
982 draw_do_head (solfa_half_width, 1);
988 fet_beginchar ("Quart dohead", "d2do");
989 draw_do_head (solfa_quarter_width, -1);
994 fet_beginchar ("Quart dohead", "u2do");
995 draw_do_head (solfa_quarter_width, 1);
1001 % re - flat top, curved bottom:
1002 % (0,h/2) {dir -90} .. (w/2,-h/2) .. {dir 90} (w,h/2) -- cycle;
1003 % (broader along the base and with more vertical sides for half and
1005 % stem attachment: h/2
1008 def draw_re_head (expr width_factor, dir) =
1012 set_char_box (0, width_factor * solfa_noteheight#,
1013 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1015 pickup pencircle scaled solfa_pen_thick;
1022 y2 = curve_start [y3, y1];
1030 labels (range 1 thru 5);
1032 p_in := (z1 + 0.5 solfa_pen_thick * (1, -1))
1036 -- (z5 + 0.5 solfa_pen_thick * (-1, -1))
1049 charwy := curve_start [-chardp, charht];
1057 fet_beginchar ("Whole rehead", "s0re");
1058 draw_re_head (solfa_whole_width, 1);
1064 fet_beginchar ("Half up rehead", "u1re");
1065 draw_re_head (solfa_half_width, 1);
1071 fet_beginchar ("Half down rehead", "d1re");
1072 draw_re_head (solfa_half_width, -1);
1078 fet_beginchar ("Quart rehead", "u2re");
1079 draw_re_head (solfa_quarter_width, 1);
1084 fet_beginchar ("Quart rehead", "d2re");
1085 draw_re_head (solfa_quarter_width, -1);
1090 def draw_mi_head (expr width_factor) =
1091 save path_out, path_in;
1092 save ne_dist, se_dist, ne, se;
1093 path path_out, path_in;
1094 pair ne_dist, se_dist, ne, se;
1096 set_char_box (0, width_factor * solfa_noteheight#,
1097 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1099 pickup pencircle scaled solfa_pen_thick;
1110 z6 - z5 = whatever * (z2 - z1);
1111 z8 - z7 = whatever * (z2 - z1);
1112 z8 - z5 = whatever * (z4 - z1);
1113 z6 - z7 = whatever * (z4 - z1);
1115 ne = unitvector (z4 - z1);
1116 se = unitvector (z1 - z2);
1118 ne_dist = (ne rotated 90) * 0.5 solfa_pen_thick;
1119 se_dist = (se rotated 90) * 0.5 solfa_pen_thick;
1121 z5 = whatever [z1, z4] - ne_dist;
1122 z5 = whatever [z1, z2] - 1.5 se_dist;
1124 z5 - z1 = -(z7 - z3);
1126 labels (range 1 thru 8);
1135 .. (z1 + se_dist){-se}
1136 -- (z2 + se_dist){-se}
1138 .. (z2 - ne_dist){ne}
1139 -- (z3 - ne_dist){ne}
1141 .. (z3 - se_dist){se}
1142 -- (z4 - se_dist){se}
1144 .. (z4 + ne_dist){-ne}
1145 -- (z1 + ne_dist){-ne}
1150 fet_beginchar ("Whole mihead", "s0mi");
1151 draw_mi_head (solfa_whole_width);
1157 fet_beginchar ("Half mihead", "s1mi");
1158 draw_mi_head (solfa_quarter_width);
1164 fet_beginchar ("Quart mihead", "s2mi");
1165 draw_mi_head (solfa_quarter_width);
1170 def draw_fa_head (expr width_factor) =
1171 set_char_box (0, width_factor * solfa_noteheight#,
1172 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1174 save p_down_in, p_down_out, p_up_in, p_up_out, nw_dist, nw;
1175 path p_down_in, p_down_out, p_up_in, p_up_out;
1178 pickup pencircle scaled solfa_pen_thick;
1191 labels (1, 2, 3, 4);
1193 nw = unitvector (z1 - z3);
1194 nw_dist = (nw rotated 90) * 0.5 solfa_pen_thick;
1196 p_up_in := (((z1 - nw_dist) -- (z3 - nw_dist)) intersectionpoint
1198 -- (((z1 - nw_dist) -- (z3 - nw_dist)) intersectionpoint
1200 -- (z2 + 0.5 solfa_pen_thick * (-1, -1))
1203 p_up_out := lft z1{down}
1204 .. (z1 + nw_dist){-nw}
1205 -- (z3 + nw_dist){-nw}
1213 p_down_in := p_up_in rotated 180 shifted (w, 0);
1214 p_down_out := p_up_out rotated 180 shifted (w, 0);
1221 fet_beginchar ("Whole fa up head", "u0fa");
1222 draw_fa_head (solfa_whole_width);
1228 fet_beginchar ("Whole fa down head", "d0fa");
1229 draw_fa_head (solfa_whole_width);
1235 fet_beginchar ("half fa up head", "u1fa");
1236 draw_fa_head (solfa_half_width);
1242 fet_beginchar ("Half fa down head", "d1fa");
1243 draw_fa_head (solfa_half_width);
1249 fet_beginchar ("Quarter fa up head", "u2fa");
1250 draw_fa_head (solfa_quarter_width);
1255 fet_beginchar ("Quarter fa down head", "d2fa");
1256 draw_fa_head (solfa_quarter_width);
1261 def draw_la_head (expr width_factor) =
1262 set_char_box (0, width_factor * solfa_noteheight#,
1263 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1267 pickup pencircle scaled solfa_pen_thick;
1280 labels (range 1 thru 4);
1282 p_in := (z1 + 0.5 solfa_pen_thick * (1, -1))
1283 -- (z2 + 0.5 solfa_pen_thick * (-1, -1))
1284 -- (z3 + 0.5 solfa_pen_thick * (-1, 1))
1285 -- (z4 + 0.5 solfa_pen_thick * (1, 1))
1300 fet_beginchar ("Whole lahead", "s0la");
1301 draw_la_head (solfa_whole_width);
1307 fet_beginchar ("Half lahead", "s1la");
1308 draw_la_head (solfa_half_width);
1314 fet_beginchar ("Quart lahead", "s2la");
1315 draw_la_head (solfa_quarter_width);
1320 def draw_ti_head (expr width_factor, dir) =
1321 set_char_box (0, width_factor * solfa_noteheight#,
1322 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1323 save p_in, p_out, p_top;
1324 save nw_dist, sw_dist, nw, sw;
1325 path p_in, p_out, p_top;
1326 pair nw_dist, sw_dist, nw, sw;
1330 pickup pencircle scaled solfa_pen_thick;
1335 y2 = cone_height [y1, y3];
1341 labels (range 1 thru 4);
1343 nw = unitvector (z2 - z1);
1344 sw = unitvector (z1 - z4);
1346 nw_dist = (nw rotated 90) * 0.5 solfa_pen_thick;
1347 sw_dist = (sw rotated 90) * 0.5 solfa_pen_thick;
1349 p_top := (z2 - sw_dist)
1353 p_in := (((z1 - nw_dist) -- (z2 - nw_dist)) intersectionpoint
1354 ((z1 - sw_dist) -- (z4 - sw_dist)))
1355 -- (((z1 - nw_dist) -- (z2 - nw_dist)) intersectionpoint
1356 ((z2 + sw_dist) .. {right}(bot z3)))
1358 .. (((bot z3){right} .. (z4 + nw_dist)) intersectionpoint
1359 ((z1 - sw_dist) -- (z4 - sw_dist)))
1366 .. (z2 - sw_dist){direction 0 of p_top}
1368 & {direction infinity of p_top}(z4 - nw_dist)
1375 charwy := cone_height [-chardp, charht];
1382 fet_beginchar ("Whole up tihead", "s0ti");
1383 draw_ti_head (solfa_whole_width, 1);
1389 fet_beginchar ("Half up tihead", "u1ti");
1390 draw_ti_head (solfa_half_width, 1);
1396 fet_beginchar ("Half down tihead", "d1ti");
1397 draw_ti_head (solfa_half_width, -1);
1403 fet_beginchar ("Quart up tihead", "u2ti");
1404 draw_ti_head (solfa_quarter_width, 1);
1409 fet_beginchar ("Quart down tihead", "d2ti");
1410 draw_ti_head (solfa_quarter_width, -1);
1415 fet_endgroup ("noteheads");
1419 % we derive black_notehead_width# from the quarter head,
1420 % so we have to define black_notehead_width (pixel qty)
1421 % after the black_notehead_width# itself.
1423 % Let's keep it outside the group as well.
1426 define_pixels (black_notehead_width);