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));
339 def define_triangle_shape (expr stemdir) =
340 save triangle_a, triangle_b, triangle_c;
341 save triangle_out_a, triangle_out_b, triangle_out_c;
342 save triangle_in, triangle_out;
343 save width, depth, height;
344 save origin, left_up_dir;
345 save exact_left_point, exact_right_point, exact_down_point;
347 path triangle_a, triangle_b, triangle_c;
348 path triangle_out_a, triangle_out_b, triangle_out_c;
349 path triangle_in, triangle_out;
350 pair origin, left_up_dir;
351 pair exact_down_point, exact_left_point, exact_right_point;
354 pen_thick# = stafflinethickness# + .1 staff_space#;
355 define_pixels (llap);
356 define_blacker_pixels (pen_thick);
358 left_up_dir = llap# * dir (90 + tilt);
360 xpart (left_up_dir) * xs - (pen_thick# * xs) / 2 + xpart origin = 0;
363 exact_left_point := origin + (left_up_dir xscaled xs);
364 exact_down_point := origin + (left_up_dir rotated 120 xscaled xs);
365 exact_right_point := origin + (left_up_dir rotated 240 xscaled xs);
367 height# = ypart (exact_left_point + origin) + pen_thick# / 2;
368 depth# = -ypart (exact_down_point + origin) + pen_thick# / 2;
369 width# = xpart (exact_right_point - exact_left_point)
372 set_char_box (0, width#, depth#, height#);
374 % Formerly, the shape has simply been drawn with an elliptical pen
375 % (`scaled pen_thick xsaled xs'), but the envelope of such a curve
376 % is of 6th degree. For the sake of mf2pt1, we approximate it.
378 pickup pencircle scaled pen_thick xscaled xs;
380 z0 = (hround_pixels (xpart origin), 0);
382 z1 = z1' = z0 + llap * dir (90 + tilt) xscaled xs;
383 z2 = z2' = z0 + llap * dir (90 + tilt + 120) xscaled xs;
384 z3 = z3' = z0 + llap * dir (90 + tilt + 240) xscaled xs;
386 z12 = caveness [.5[z1, z2], z3];
387 z23 = caveness [.5[z2, z3], z1];
388 z31 = caveness [.5[z3, z1], z2];
390 triangle_a = z1 .. z12 .. z2;
391 triangle_b = z2 .. z23 .. z3;
392 triangle_c = z3 .. z31 .. z1;
394 penposx1 (angle (direction 0 of triangle_a) - 90);
395 penposx2 (angle (direction 0 of triangle_b) - 90);
396 penposx3 (angle (direction 0 of triangle_c) - 90);
398 penposx1' (angle (direction infinity of triangle_c) + 90);
399 penposx2' (angle (direction infinity of triangle_a) + 90);
400 penposx3' (angle (direction infinity of triangle_b) + 90);
402 penposx12 (angle (z12 - z0));
403 penposx23 (angle (z23 - z0));
404 penposx31 (angle (z31 - z0));
406 z10 = (z0 -- z1) intersectionpoint (z1l .. z12l .. z2'r);
407 z20 = (z0 -- z2) intersectionpoint (z2l .. z23l .. z3'r);
408 z30 = (z0 -- z3) intersectionpoint (z3l .. z31l .. z1'r);
421 triangle_out_a = z1r .. z12r .. z2'l;
422 triangle_out_b = z2r .. z23r .. z3'l;
423 triangle_out_c = z3r .. z31r .. z1'l;
425 triangle_out = top z1
427 .. z1r{direction 0 of triangle_out_a}
429 & {direction infinity of triangle_out_a}z2'l
432 .. z2r{direction 0 of triangle_out_b}
434 & {direction infinity of triangle_out_b}z3'l
437 .. z3r{direction 0 of triangle_out_c}
439 & {direction infinity of triangle_out_c}z1'l
442 labels (0, 10, 20, 30);
443 penlabels (1, 1', 2, 2', 3, 3', 12, 23, 31);
447 charwy := ypart exact_right_point;
448 charwx := xpart exact_right_point;
450 charwy := -ypart exact_down_point;
451 charwx := (width# - xpart exact_down_point);
456 def draw_whole_triangle_head =
462 llap# = 3/4 noteheight#;
466 define_triangle_shape (1);
472 fet_beginchar ("Whole trianglehead", "s0triangle");
473 draw_whole_triangle_head;
475 draw_staff (-2, 2, 0);
480 fet_beginchar ("Whole trianglehead", "s0triangle");
481 draw_whole_triangle_head;
483 draw_staff (-2, 2, 0.5);
488 def draw_small_triangle_head (expr dir) =
494 llap# = 2/3 noteheight#;
497 define_triangle_shape (dir);
501 filldraw triangle_out;
502 unfilldraw triangle_in;
506 fet_beginchar ("Half trianglehead", "d1triangle");
507 draw_small_triangle_head (-1);
509 draw_staff (-2, 2, 0);
513 fet_beginchar ("Half trianglehead", "u1triangle");
514 draw_small_triangle_head (1);
516 draw_staff (-2, 2, 0.5);
520 def draw_closed_triangle_head (expr dir) =
526 llap# = 2/3 noteheight#;
529 define_triangle_shape (dir);
534 fet_beginchar ("Quart trianglehead", "u2triangle");
535 draw_closed_triangle_head (1);
537 draw_staff (-2, 2, 0);
541 fet_beginchar ("Quart trianglehead", "d2triangle");
542 draw_closed_triangle_head (-1);
544 draw_staff (-2, 2, 0.5);
548 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
550 % Slash heads are for indicating improvisation. They are
551 % twice as high as normal heads.
553 def draw_slash (expr hwid_hash) =
557 exact_height = staff_space# + stafflinethickness# / 2;
559 set_char_box (0, 2 exact_height / slash_slope + hwid_hash,
560 exact_height, exact_height);
569 pickup pencircle scaled blot_diameter;
574 lft x2 = 2 h / slash_slope;
581 ne = unitvector (z3 - z4);
582 nw_dist = (ne rotated 90) * 0.5 blot_diameter;
585 .. (z1 + nw_dist){ne}
586 -- (z2 + nw_dist){ne}
589 .. (z3 - nw_dist){-ne}
590 -- (z4 - nw_dist){-ne}
594 if hwid_hash > 2 slash_thick#:
597 th = slash_thick - blot_diameter;
602 z6 - z5 = whatever * ne;
603 z8 - z7 = whatever * ne;
605 z5 = z1 + whatever * ne + th * (ne rotated -90);
606 z8 = z4 + whatever * ne + th * (ne rotated 90);
614 labels (range 1 thru 10);
618 fet_beginchar ("Whole slashhead", "s0slash");
619 draw_slash (4 slash_thick# + 0.5 staff_space#);
621 draw_staff (-2, 2, 0);
625 fet_beginchar ("Half slashhead", "s1slash");
626 draw_slash (3.0 slash_thick# + 0.15 staff_space#);
628 draw_staff (-2, 2, 0);
632 fet_beginchar ("Quart slashhead", "s2slash");
633 draw_slash (1.5 slash_thick#);
635 draw_staff (-2, 2, 0);
639 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
641 % `thick' is the distance between the NE/SW parallel lines in the cross
642 % (distance between centres of lines) in multiples of stafflinethickness
644 def draw_cross (expr thick) =
646 save ne_dist, nw_dist, rt_dist, up_dist;
647 save crz_in, crz_out;
650 pair ne_dist, nw_dist, rt_dist, up_dist;
651 path crz_in, crz_out;
653 pen_thick# := 1.2 stafflinethickness#;
654 thickness# := thick * stafflinethickness#;
655 define_pixels (thickness);
656 define_blacker_pixels (pen_thick);
658 pickup pencircle scaled pen_thick;
663 ne = unitvector ((1, (2 h - pen_thick) / (w - pen_thick)));
666 z4 - z5 = whatever * ne;
668 z6 - z3 = whatever * ne;
669 z3 - z4 = whatever * (ne yscaled -1);
671 z4 - z3 = whatever * (ne) + (ne rotated -90) * thickness;
674 x1 = charwd / 2 - .5 pen_thick#;
676 + thick / 2 * stafflinethickness# * (ne rotated -90);
678 % labels (1, 2, 3, 4, 5, 6);
680 nw = unitvector (z3 - z4);
682 up_dist = up * 0.5 pen_thick / cosd (angle (ne));
683 rt_dist = right * 0.5 pen_thick / sind (angle (ne));
684 nw_dist = (ne rotated 90) * 0.5 pen_thick;
685 ne_dist = (nw rotated -90) * 0.5 pen_thick;
691 x4 := hround (x4' + .5 pen_thick) - .5 pen_thick;
692 x5 := hfloor (x5' + xpart rt_dist) - xpart rt_dist;
693 y6 := vfloor (y6' + ypart up_dist) - ypart up_dist;
695 crz_out = (z6 + up_dist)
696 -- (z3 + nw_dist){ne}
698 .. (z3 + ne_dist){-nw}
699 -- (z4 + ne_dist){-nw}
701 .. (z4 - nw_dist){-ne}
703 crz_out := crz_out shifted (0, feta_shift)
704 -- reverse crz_out yscaled -1 shifted (0, -feta_eps);
706 -- reverse crz_out xscaled -1 shifted (-feta_eps, 0)
710 x4 := hround (x4' - xpart rt_dist) + xpart rt_dist;
711 x5 := hceiling (x5' - .5 pen_thick) + .5 pen_thick;
712 y6 := vfloor (y6' - .5 pen_thick) + .5 pen_thick;
714 crz_in = (bot z6){right}
715 .. (z6 - nw_dist){ne}
718 -- (z5 + nw_dist){-ne}
720 crz_in := crz_in shifted (0, feta_shift)
721 -- reverse crz_in yscaled -1 shifted (0, -feta_eps);
723 -- reverse crz_in xscaled -1 shifted (-feta_eps, 0)
728 currentpicture := currentpicture shifted (hround (w / 2), 0);
731 charwy := y1 + feta_shift;
733 z12 = (charwx * hppp, y1 * vppp);
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);
749 remember_pic := currentpicture;
751 draw_staff (-2, 2, 0);
756 fet_beginchar ("Whole Crossed notehead", "s0cross");
759 wid# := black_notehead_width# + 4 stafflinethickness#;
760 hei# := noteheight# + stafflinethickness#;
762 set_char_box (0, wid#, hei# / 2, hei# / 2);
764 currentpicture := remember_pic;
766 draw_staff (-2, 2, 0.5);
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);
781 remember_pic := currentpicture;
783 draw_staff (-2, 2, 0);
788 fet_beginchar ("Half Crossed notehead", "s1cross");
791 wid# := black_notehead_width# + 2 stafflinethickness#;
792 hei# := noteheight# + stafflinethickness# / 2;
794 set_char_box (0, wid#, hei# / 2, hei# / 2);
796 currentpicture := remember_pic;
798 draw_staff (-2, 2, 0.5);
803 fet_beginchar ("Crossed notehead", "s2cross");
804 wid# := black_notehead_width#;
806 set_char_box (0, wid#, hei# / 2, hei# / 2);
810 remember_pic := currentpicture;
812 draw_staff (-2, 2, 0);
817 fet_beginchar ("Crossed notehead", "s2cross");
818 wid# := black_notehead_width#;
820 set_char_box (0, wid#, hei# / 2, hei# / 2);
822 currentpicture := remember_pic;
824 draw_staff (-2, 2, 0.5);
829 fet_beginchar ("X-Circled notehead", "s2xcircle");
831 save cthick, cxd, cyd, dy;
833 wid# := black_notehead_width# * sqrt (sqrt2);
834 hei# := noteheight# * sqrt (sqrt2);
836 set_char_box (0, wid#, hei# / 2, hei# / 2);
838 d := d - feta_space_shift;
840 cthick# := (1.2 + 1/4) * stafflinethickness#;
841 define_blacker_pixels (cthick);
844 cyd := h + d - cthick / 2;
848 pickup pencircle scaled cthick;
850 fill fullcircle xscaled (cxd + cthick)
851 yscaled (cyd + cthick)
853 unfill fullcircle xscaled (cxd - cthick)
854 yscaled (cyd - cthick)
857 xpos := .5 cxd / sqrt2;
858 ypos := .5 cyd / sqrt2;
860 pickup penrazor scaled cthick rotated (angle (xpos, ypos) + 90);
861 draw (-xpos + w / 2, -ypos + dy) -- (xpos + w / 2, ypos + dy);
863 pickup penrazor scaled cthick rotated (angle (xpos, -ypos) + 90);
864 draw (-xpos + w / 2, ypos + dy) -- (xpos + w / 2, -ypos + dy);
869 z12 = (charwx * hppp, charwy * vppp);
872 remember_pic := currentpicture;
874 draw_staff (-2, 2, 0);
879 fet_beginchar ("X-Circled notehead", "s2xcircle");
881 save cthick, cxr, cyr;
883 wid# := black_notehead_width# * sqrt (sqrt2);
884 hei# := noteheight# * sqrt (sqrt2);
886 set_char_box (0, wid#, hei# / 2, hei# / 2);
888 currentpicture := remember_pic;
890 draw_staff (-2, 2, 0.5);
900 save solfa_pen_thick;
901 solfa_pen_thick# = 1.75 stafflinethickness#;
902 define_blacker_pixels (solfa_pen_thick);
905 save solfa_base_notewidth;
906 solfa_base_notewidth# := black_notehead_width#;
908 solfa_whole_width := whole_notehead_width# / black_notehead_width#;
909 solfa_half_width := half_notehead_width# / black_notehead_width#;
910 solfa_quarter_width := 1.0;
912 def draw_do_head (expr width_factor, dir) =
914 save left_dist, right_dist;
916 pair left_dist, right_dist;
918 set_char_box (0, width_factor * solfa_base_notewidth#,
919 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
921 pickup pencircle scaled solfa_pen_thick;
930 left_dist = (unitvector (z3 - z1) rotated 90) * 0.5 solfa_pen_thick;
931 right_dist = (unitvector (z2 - z3) rotated 90) * 0.5 solfa_pen_thick;
933 p_in := (((z1 - left_dist) -- (z3 - left_dist)) intersectionpoint
935 -- ((top z1 -- top z2) intersectionpoint
936 ((z2 - right_dist) -- (z3 - right_dist)))
937 -- (((z2 - right_dist) -- (z3 - right_dist)) intersectionpoint
938 ((z1 - left_dist) -- (z3 - left_dist)))
944 .. (z2 + right_dist){z3 - z2}
945 -- (z3 + right_dist){z3 - z2}
947 .. (z3 + left_dist){z1 - z3}
948 -- (z1 + left_dist){z1 - z3}
956 charwy := -chardp + 0.5 stafflinethickness#;
963 fet_beginchar ("Whole dohead", "s0do");
964 draw_do_head (solfa_whole_width, 1);
970 fet_beginchar ("Half dohead", "d1do");
971 draw_do_head (solfa_half_width, -1);
977 fet_beginchar ("Half dohead", "u1do");
978 draw_do_head (solfa_half_width, 1);
984 fet_beginchar ("Quart dohead", "d2do");
985 draw_do_head (solfa_quarter_width, -1);
990 fet_beginchar ("Quart dohead", "u2do");
991 draw_do_head (solfa_quarter_width, 1);
997 % re - flat top, curved bottom:
998 % (0,h/2) {dir -90} .. (w/2,-h/2) .. {dir 90} (w,h/2) -- cycle;
999 % (broader along the base and with more vertical sides for half and
1001 % stem attachment: h/2
1004 def draw_re_head (expr width_factor, dir) =
1008 set_char_box (0, width_factor * solfa_noteheight#,
1009 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1011 pickup pencircle scaled solfa_pen_thick;
1018 y2 = curve_start [y3, y1];
1026 labels (range 1 thru 5);
1028 p_in := (z1 + 0.5 solfa_pen_thick * (1, -1))
1032 -- (z5 + 0.5 solfa_pen_thick * (-1, -1))
1045 charwy := curve_start [-chardp, charht];
1053 fet_beginchar ("Whole rehead", "s0re");
1054 draw_re_head (solfa_whole_width, 1);
1060 fet_beginchar ("Half up rehead", "u1re");
1061 draw_re_head (solfa_half_width, 1);
1067 fet_beginchar ("Half down rehead", "d1re");
1068 draw_re_head (solfa_half_width, -1);
1074 fet_beginchar ("Quart rehead", "u2re");
1075 draw_re_head (solfa_quarter_width, 1);
1080 fet_beginchar ("Quart rehead", "d2re");
1081 draw_re_head (solfa_quarter_width, -1);
1086 def draw_mi_head (expr width_factor) =
1087 save path_out, path_in;
1088 save ne_dist, se_dist, ne, se;
1089 path path_out, path_in;
1090 pair ne_dist, se_dist, ne, se;
1092 set_char_box (0, width_factor * solfa_noteheight#,
1093 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1095 pickup pencircle scaled solfa_pen_thick;
1106 z6 - z5 = whatever * (z2 - z1);
1107 z8 - z7 = whatever * (z2 - z1);
1108 z8 - z5 = whatever * (z4 - z1);
1109 z6 - z7 = whatever * (z4 - z1);
1111 ne = unitvector (z4 - z1);
1112 se = unitvector (z1 - z2);
1114 ne_dist = (ne rotated 90) * 0.5 solfa_pen_thick;
1115 se_dist = (se rotated 90) * 0.5 solfa_pen_thick;
1117 z5 = whatever [z1, z4] - ne_dist;
1118 z5 = whatever [z1, z2] - 1.5 se_dist;
1120 z5 - z1 = -(z7 - z3);
1122 labels (range 1 thru 8);
1131 .. (z1 + se_dist){-se}
1132 -- (z2 + se_dist){-se}
1134 .. (z2 - ne_dist){ne}
1135 -- (z3 - ne_dist){ne}
1137 .. (z3 - se_dist){se}
1138 -- (z4 - se_dist){se}
1140 .. (z4 + ne_dist){-ne}
1141 -- (z1 + ne_dist){-ne}
1146 fet_beginchar ("Whole mihead", "s0mi");
1147 draw_mi_head (solfa_whole_width);
1153 fet_beginchar ("Half mihead", "s1mi");
1154 draw_mi_head (solfa_quarter_width);
1160 fet_beginchar ("Quart mihead", "s2mi");
1161 draw_mi_head (solfa_quarter_width);
1166 def draw_fa_head (expr width_factor) =
1167 set_char_box (0, width_factor * solfa_noteheight#,
1168 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1170 save p_down_in, p_down_out, p_up_in, p_up_out, nw_dist, nw;
1171 path p_down_in, p_down_out, p_up_in, p_up_out;
1174 pickup pencircle scaled solfa_pen_thick;
1187 labels (1, 2, 3, 4);
1189 nw = unitvector (z1 - z3);
1190 nw_dist = (nw rotated 90) * 0.5 solfa_pen_thick;
1192 p_up_in := (((z1 - nw_dist) -- (z3 - nw_dist)) intersectionpoint
1194 -- (((z1 - nw_dist) -- (z3 - nw_dist)) intersectionpoint
1196 -- (z2 + 0.5 solfa_pen_thick * (-1, -1))
1199 p_up_out := lft z1{down}
1200 .. (z1 + nw_dist){-nw}
1201 -- (z3 + nw_dist){-nw}
1209 p_down_in := p_up_in rotated 180 shifted (w, 0);
1210 p_down_out := p_up_out rotated 180 shifted (w, 0);
1217 fet_beginchar ("Whole fa up head", "u0fa");
1218 draw_fa_head (solfa_whole_width);
1224 fet_beginchar ("Whole fa down head", "d0fa");
1225 draw_fa_head (solfa_whole_width);
1231 fet_beginchar ("half fa up head", "u1fa");
1232 draw_fa_head (solfa_half_width);
1238 fet_beginchar ("Half fa down head", "d1fa");
1239 draw_fa_head (solfa_half_width);
1245 fet_beginchar ("Quarter fa up head", "u2fa");
1246 draw_fa_head (solfa_quarter_width);
1251 fet_beginchar ("Quarter fa down head", "d2fa");
1252 draw_fa_head (solfa_quarter_width);
1257 def draw_la_head (expr width_factor) =
1258 set_char_box (0, width_factor * solfa_noteheight#,
1259 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1263 pickup pencircle scaled solfa_pen_thick;
1276 labels (range 1 thru 4);
1278 p_in := (z1 + 0.5 solfa_pen_thick * (1, -1))
1279 -- (z2 + 0.5 solfa_pen_thick * (-1, -1))
1280 -- (z3 + 0.5 solfa_pen_thick * (-1, 1))
1281 -- (z4 + 0.5 solfa_pen_thick * (1, 1))
1296 fet_beginchar ("Whole lahead", "s0la");
1297 draw_la_head (solfa_whole_width);
1303 fet_beginchar ("Half lahead", "s1la");
1304 draw_la_head (solfa_half_width);
1310 fet_beginchar ("Quart lahead", "s2la");
1311 draw_la_head (solfa_quarter_width);
1316 def draw_ti_head (expr width_factor, dir) =
1317 set_char_box (0, width_factor * solfa_noteheight#,
1318 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1319 save p_in, p_out, p_top;
1320 save nw_dist, sw_dist, nw, sw;
1321 path p_in, p_out, p_top;
1322 pair nw_dist, sw_dist, nw, sw;
1326 pickup pencircle scaled solfa_pen_thick;
1331 y2 = cone_height [y1, y3];
1337 labels (range 1 thru 4);
1339 nw = unitvector (z2 - z1);
1340 sw = unitvector (z1 - z4);
1342 nw_dist = (nw rotated 90) * 0.5 solfa_pen_thick;
1343 sw_dist = (sw rotated 90) * 0.5 solfa_pen_thick;
1345 p_top := (z2 - sw_dist)
1349 p_in := (((z1 - nw_dist) -- (z2 - nw_dist)) intersectionpoint
1350 ((z1 - sw_dist) -- (z4 - sw_dist)))
1351 -- (((z1 - nw_dist) -- (z2 - nw_dist)) intersectionpoint
1352 ((z2 + sw_dist) .. {right}(bot z3)))
1354 .. (((bot z3){right} .. (z4 + nw_dist)) intersectionpoint
1355 ((z1 - sw_dist) -- (z4 - sw_dist)))
1362 .. (z2 - sw_dist){direction 0 of p_top}
1364 & {direction infinity of p_top}(z4 - nw_dist)
1371 charwy := cone_height [-chardp, charht];
1378 fet_beginchar ("Whole up tihead", "s0ti");
1379 draw_ti_head (solfa_whole_width, 1);
1385 fet_beginchar ("Half up tihead", "u1ti");
1386 draw_ti_head (solfa_half_width, 1);
1392 fet_beginchar ("Half down tihead", "d1ti");
1393 draw_ti_head (solfa_half_width, -1);
1399 fet_beginchar ("Quart up tihead", "u2ti");
1400 draw_ti_head (solfa_quarter_width, 1);
1405 fet_beginchar ("Quart down tihead", "d2ti");
1406 draw_ti_head (solfa_quarter_width, -1);
1411 fet_endgroup ("noteheads");
1415 % we derive black_notehead_width# from the quarter head,
1416 % so we have to define black_notehead_width (pixel qty)
1417 % after the black_notehead_width# itself.
1419 % Let's keep it outside the group as well.
1422 define_pixels (black_notehead_width);