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);
250 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
253 fet_beginchar ("Whole diamondhead", "s0diamond");
254 draw_outside_ellipse (1.80, 0, 0.495, 0);
255 undraw_inside_ellipse (1.30, 125, 0.6,
256 .4 staff_space# + stafflinethickness#);
258 draw_staff (-2, 2, 0);
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.5);
273 fet_beginchar ("Half diamondhead", "s1diamond");
274 draw_outside_ellipse (1.50, 34, 0.49, 0.17);
275 undraw_inside_ellipse (3.5, 33, 0.80,
276 .3 staff_space# + 1.5 stafflinethickness#);
278 draw_staff (-2, 2, 0);
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,
287 + 1.5 stafflinethickness#);
289 draw_staff (-2, 2, 0.5);
294 fet_beginchar ("Quart diamondhead", "s2diamond");
295 draw_outside_ellipse (1.80, 35, 0.495, -0.25);
297 draw_staff (-2, 2, 0);
302 fet_beginchar ("Quart diamondhead", "s2diamond");
303 draw_outside_ellipse (1.80, 35, 0.495, -0.25);
305 draw_staff (-2, 2, 0.5);
310 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
313 vardef penposx@# (expr d) =
323 z@#l = pat intersectionpoint (z@# -- infinity * dir (d + 180));
324 z@#r = pat intersectionpoint (z@# -- infinity * dir (d));
329 def define_triangle_shape (expr stemdir) =
330 save triangle_a, triangle_b, triangle_c;
331 save triangle_out_a, triangle_out_b, triangle_out_c;
332 save triangle_in, triangle_out;
333 save width, depth, height;
334 save origin, left_up_dir;
335 save exact_left_point, exact_right_point, exact_down_point;
337 path triangle_a, triangle_b, triangle_c;
338 path triangle_out_a, triangle_out_b, triangle_out_c;
339 path triangle_in, triangle_out;
340 pair origin, left_up_dir;
341 pair exact_down_point, exact_left_point, exact_right_point;
344 pen_thick# = stafflinethickness# + .1 staff_space#;
345 define_pixels (llap);
346 define_blacker_pixels (pen_thick);
348 left_up_dir = llap# * dir (90 + tilt);
350 xpart (left_up_dir) * xs - (pen_thick# * xs) / 2 + xpart origin = 0;
353 exact_left_point := origin + (left_up_dir xscaled xs);
354 exact_down_point := origin + (left_up_dir rotated 120 xscaled xs);
355 exact_right_point := origin + (left_up_dir rotated 240 xscaled xs);
357 height# = ypart (exact_left_point + origin) + pen_thick# / 2;
358 depth# = -ypart (exact_down_point + origin) + pen_thick# / 2;
359 width# = xpart (exact_right_point - exact_left_point)
362 set_char_box (0, width#, depth#, height#);
364 % Formerly, the shape has simply been drawn with an elliptical pen
365 % (`scaled pen_thick xsaled xs'), but the envelope of such a curve
366 % is of 6th degree. For the sake of mf2pt1, we approximate it.
368 pickup pencircle scaled pen_thick xscaled xs;
370 z0 = (hround_pixels (xpart origin), 0);
372 z1 = z1' = z0 + llap * dir (90 + tilt) xscaled xs;
373 z2 = z2' = z0 + llap * dir (90 + tilt + 120) xscaled xs;
374 z3 = z3' = z0 + llap * dir (90 + tilt + 240) xscaled xs;
376 z12 = caveness [.5[z1, z2], z3];
377 z23 = caveness [.5[z2, z3], z1];
378 z31 = caveness [.5[z3, z1], z2];
380 triangle_a = z1 .. z12 .. z2;
381 triangle_b = z2 .. z23 .. z3;
382 triangle_c = z3 .. z31 .. z1;
384 penposx1 (angle (direction 0 of triangle_a) - 90);
385 penposx2 (angle (direction 0 of triangle_b) - 90);
386 penposx3 (angle (direction 0 of triangle_c) - 90);
388 penposx1' (angle (direction infinity of triangle_c) + 90);
389 penposx2' (angle (direction infinity of triangle_a) + 90);
390 penposx3' (angle (direction infinity of triangle_b) + 90);
392 penposx12 (angle (z12 - z0));
393 penposx23 (angle (z23 - z0));
394 penposx31 (angle (z31 - z0));
396 z10 = (z0 -- z1) intersectionpoint (z1l .. z12l .. z2'r);
397 z20 = (z0 -- z2) intersectionpoint (z2l .. z23l .. z3'r);
398 z30 = (z0 -- z3) intersectionpoint (z3l .. z31l .. z1'r);
411 triangle_out_a = z1r .. z12r .. z2'l;
412 triangle_out_b = z2r .. z23r .. z3'l;
413 triangle_out_c = z3r .. z31r .. z1'l;
415 triangle_out = top z1
417 .. z1r{direction 0 of triangle_out_a}
419 & {direction infinity of triangle_out_a}z2'l
422 .. z2r{direction 0 of triangle_out_b}
424 & {direction infinity of triangle_out_b}z3'l
427 .. z3r{direction 0 of triangle_out_c}
429 & {direction infinity of triangle_out_c}z1'l
432 labels (0, 10, 20, 30);
433 penlabels (1, 1', 2, 2', 3, 3', 12, 23, 31);
437 charwy := ypart exact_right_point;
438 charwx := xpart exact_right_point;
440 charwy := -ypart exact_down_point;
441 charwx := (width# - xpart exact_down_point);
446 def draw_whole_triangle_head =
452 llap# = 3/4 noteheight#;
456 define_triangle_shape (1);
462 fet_beginchar ("Whole trianglehead", "s0triangle");
463 draw_whole_triangle_head;
465 draw_staff (-2, 2, 0);
470 fet_beginchar ("Whole trianglehead", "s0triangle");
471 draw_whole_triangle_head;
473 draw_staff (-2, 2, 0.5);
478 def draw_small_triangle_head (expr dir) =
484 llap# = 2/3 noteheight#;
487 define_triangle_shape (dir);
491 filldraw triangle_out;
492 unfilldraw triangle_in;
496 fet_beginchar ("Half trianglehead", "d1triangle");
497 draw_small_triangle_head (-1);
499 draw_staff (-2, 2, 0);
503 fet_beginchar ("Half trianglehead", "u1triangle");
504 draw_small_triangle_head (1);
506 draw_staff (-2, 2, 0.5);
510 def draw_closed_triangle_head (expr dir) =
516 llap# = 2/3 noteheight#;
519 define_triangle_shape (dir);
524 fet_beginchar ("Quart trianglehead", "u2triangle");
525 draw_closed_triangle_head (1);
527 draw_staff (-2, 2, 0);
531 fet_beginchar ("Quart trianglehead", "d2triangle");
532 draw_closed_triangle_head (-1);
534 draw_staff (-2, 2, 0.5);
538 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
540 % Slash heads are for indicating improvisation. They are
541 % twice as high as normal heads.
543 def draw_slash (expr hwid_hash) =
547 exact_height = staff_space# + stafflinethickness# / 2;
549 set_char_box (0, 2 exact_height / slash_slope + hwid_hash,
550 exact_height, exact_height);
559 pickup pencircle scaled blot_diameter;
564 lft x2 = 2 h / slash_slope;
571 ne = unitvector (z3 - z4);
572 nw_dist = (ne rotated 90) * 0.5 blot_diameter;
575 .. (z1 + nw_dist){ne}
576 -- (z2 + nw_dist){ne}
579 .. (z3 - nw_dist){-ne}
580 -- (z4 - nw_dist){-ne}
584 if hwid_hash > 2 slash_thick#:
587 th = slash_thick - blot_diameter;
592 z6 - z5 = whatever * ne;
593 z8 - z7 = whatever * ne;
595 z5 = z1 + whatever * ne + th * (ne rotated -90);
596 z8 = z4 + whatever * ne + th * (ne rotated 90);
604 labels (range 1 thru 10);
608 fet_beginchar ("Whole slashhead", "s0slash");
609 draw_slash (4 slash_thick# + 0.5 staff_space#);
611 draw_staff (-2, 2, 0);
615 fet_beginchar ("Half slashhead", "s1slash");
616 draw_slash (3.0 slash_thick# + 0.15 staff_space#);
618 draw_staff (-2, 2, 0);
622 fet_beginchar ("Quart slashhead", "s2slash");
623 draw_slash (1.5 slash_thick#);
625 draw_staff (-2, 2, 0);
629 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
631 % `thick' is the distance between the NE/SW parallel lines in the cross
632 % (distance between centres of lines) in multiples of stafflinethickness
634 def draw_cross (expr thick) =
636 save ne_dist, nw_dist, rt_dist, up_dist;
637 save crz_in, crz_out;
640 pair ne_dist, nw_dist, rt_dist, up_dist;
641 path crz_in, crz_out;
643 pen_thick# := 1.2 stafflinethickness#;
644 thickness# := thick * stafflinethickness#;
645 define_pixels (thickness);
646 define_blacker_pixels (pen_thick);
648 pickup pencircle scaled pen_thick;
653 ne = unitvector ((1, (2 h - pen_thick) / (w - pen_thick)));
656 z4 - z5 = whatever * ne;
658 z6 - z3 = whatever * ne;
659 z3 - z4 = whatever * (ne yscaled -1);
661 z4 - z3 = whatever * (ne) + (ne rotated -90) * thickness;
664 x1 = charwd / 2 - .5 pen_thick#;
666 + thick / 2 * stafflinethickness# * (ne rotated -90);
668 % labels (1, 2, 3, 4, 5, 6);
670 nw = unitvector (z3 - z4);
672 up_dist = up * 0.5 pen_thick / cosd (angle (ne));
673 rt_dist = right * 0.5 pen_thick / sind (angle (ne));
674 nw_dist = (ne rotated 90) * 0.5 pen_thick;
675 ne_dist = (nw rotated -90) * 0.5 pen_thick;
681 x4 := hround (x4' + .5 pen_thick) - .5 pen_thick;
682 x5 := hfloor (x5' + xpart rt_dist) - xpart rt_dist;
683 y6 := vfloor (y6' + ypart up_dist) - ypart up_dist;
685 crz_out = (z6 + up_dist)
686 -- (z3 + nw_dist){ne}
688 .. (z3 + ne_dist){-nw}
689 -- (z4 + ne_dist){-nw}
691 .. (z4 - nw_dist){-ne}
693 crz_out := crz_out shifted (0, feta_shift)
694 -- reverse crz_out yscaled -1 shifted (0, -feta_eps);
696 -- reverse crz_out xscaled -1 shifted (-feta_eps, 0)
700 x4 := hround (x4' - xpart rt_dist) + xpart rt_dist;
701 x5 := hceiling (x5' - .5 pen_thick) + .5 pen_thick;
702 y6 := vfloor (y6' - .5 pen_thick) + .5 pen_thick;
704 crz_in = (bot z6){right}
705 .. (z6 - nw_dist){ne}
708 -- (z5 + nw_dist){-ne}
710 crz_in := crz_in shifted (0, feta_shift)
711 -- reverse crz_in yscaled -1 shifted (0, -feta_eps);
713 -- reverse crz_in xscaled -1 shifted (-feta_eps, 0)
718 currentpicture := currentpicture shifted (hround (w / 2), 0);
721 charwy := y1 + feta_shift;
723 z12 = (charwx * hppp, y1 * vppp);
729 fet_beginchar ("Whole Crossed notehead", "s0cross");
732 wid# := black_notehead_width# + 4 stafflinethickness#;
733 hei# := noteheight# + stafflinethickness#;
735 set_char_box (0, wid#, hei# / 2, hei# / 2);
739 remember_pic := currentpicture;
741 draw_staff (-2, 2, 0);
746 fet_beginchar ("Whole Crossed notehead", "s0cross");
749 wid# := black_notehead_width# + 4 stafflinethickness#;
750 hei# := noteheight# + stafflinethickness#;
752 set_char_box (0, wid#, hei# / 2, hei# / 2);
754 currentpicture := remember_pic;
756 draw_staff (-2, 2, 0.5);
761 fet_beginchar ("Half Crossed notehead", "s1cross");
764 wid# := black_notehead_width# + 2 stafflinethickness#;
765 hei# := noteheight# + stafflinethickness# / 2;
767 set_char_box (0, wid#, hei# / 2, hei# / 2);
771 remember_pic := currentpicture;
773 draw_staff (-2, 2, 0);
778 fet_beginchar ("Half Crossed notehead", "s1cross");
781 wid# := black_notehead_width# + 2 stafflinethickness#;
782 hei# := noteheight# + stafflinethickness# / 2;
784 set_char_box (0, wid#, hei# / 2, hei# / 2);
786 currentpicture := remember_pic;
788 draw_staff (-2, 2, 0.5);
793 fet_beginchar ("Crossed notehead", "s2cross");
794 wid# := black_notehead_width#;
796 set_char_box (0, wid#, hei# / 2, hei# / 2);
800 remember_pic := currentpicture;
802 draw_staff (-2, 2, 0);
807 fet_beginchar ("Crossed notehead", "s2cross");
808 wid# := black_notehead_width#;
810 set_char_box (0, wid#, hei# / 2, hei# / 2);
812 currentpicture := remember_pic;
814 draw_staff (-2, 2, 0.5);
819 fet_beginchar ("X-Circled notehead", "s2xcircle");
821 save cthick, cxd, cyd, dy;
823 wid# := black_notehead_width# * sqrt (sqrt2);
824 hei# := noteheight# * sqrt (sqrt2);
826 set_char_box (0, wid#, hei# / 2, hei# / 2);
828 d := d - feta_space_shift;
830 cthick# := (1.2 + 1/4) * stafflinethickness#;
831 define_blacker_pixels (cthick);
834 cyd := h + d - cthick / 2;
838 pickup pencircle scaled cthick;
840 fill fullcircle xscaled (cxd + cthick)
841 yscaled (cyd + cthick)
843 unfill fullcircle xscaled (cxd - cthick)
844 yscaled (cyd - cthick)
847 xpos := .5 cxd / sqrt2;
848 ypos := .5 cyd / sqrt2;
850 pickup penrazor scaled cthick rotated (angle (xpos, ypos) + 90);
851 draw (-xpos + w / 2, -ypos + dy) -- (xpos + w / 2, ypos + dy);
853 pickup penrazor scaled cthick rotated (angle (xpos, -ypos) + 90);
854 draw (-xpos + w / 2, ypos + dy) -- (xpos + w / 2, -ypos + dy);
859 z12 = (charwx * hppp, charwy * vppp);
862 remember_pic := currentpicture;
864 draw_staff (-2, 2, 0);
869 fet_beginchar ("X-Circled notehead", "s2xcircle");
871 save cthick, cxr, cyr;
873 wid# := black_notehead_width# * sqrt (sqrt2);
874 hei# := noteheight# * sqrt (sqrt2);
876 set_char_box (0, wid#, hei# / 2, hei# / 2);
878 currentpicture := remember_pic;
880 draw_staff (-2, 2, 0.5);
890 save solfa_pen_thick;
891 solfa_pen_thick# = 2 stafflinethickness#;
892 define_blacker_pixels (solfa_pen_thick);
895 solfa_whole_width := 1.8;
896 solfa_half_width := 1.35;
897 solfa_quarter_width := 1.35;
900 def draw_do_head (expr width_factor, dir) =
902 save left_dist, right_dist;
904 pair left_dist, right_dist;
906 set_char_box (0, width_factor * solfa_noteheight#,
907 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
909 pickup pencircle scaled solfa_pen_thick;
918 left_dist = (unitvector (z3 - z1) rotated 90) * 0.5 solfa_pen_thick;
919 right_dist = (unitvector (z2 - z3) rotated 90) * 0.5 solfa_pen_thick;
921 p_in := (((z1 - left_dist) -- (z3 - left_dist)) intersectionpoint
923 -- ((top z1 -- top z2) intersectionpoint
924 ((z2 - right_dist) -- (z3 - right_dist)))
925 -- (((z2 - right_dist) -- (z3 - right_dist)) intersectionpoint
926 ((z1 - left_dist) -- (z3 - left_dist)))
932 .. (z2 + right_dist){z3 - z2}
933 -- (z3 + right_dist){z3 - z2}
935 .. (z3 + left_dist){z1 - z3}
936 -- (z1 + left_dist){z1 - z3}
944 charwy := -chardp + 0.5 stafflinethickness#;
951 fet_beginchar ("Whole dohead", "s0do");
952 draw_do_head (solfa_whole_width, 1);
958 fet_beginchar ("Half dohead", "d1do");
959 draw_do_head (solfa_half_width, -1);
965 fet_beginchar ("Half dohead", "u1do");
966 draw_do_head (solfa_half_width, 1);
972 fet_beginchar ("Quart dohead", "d2do");
973 draw_do_head (solfa_quarter_width, -1);
978 fet_beginchar ("Quart dohead", "u2do");
979 draw_do_head (solfa_quarter_width, 1);
985 % re - flat top, curved bottom:
986 % (0,h/2) {dir -90} .. (w/2,-h/2) .. {dir 90} (w,h/2) -- cycle;
987 % (broader along the base and with more vertical sides for half and
989 % stem attachment: h/2
992 def draw_re_head (expr width_factor, dir) =
996 set_char_box (0, width_factor * solfa_noteheight#,
997 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
999 pickup pencircle scaled solfa_pen_thick;
1006 y2 = curve_start [y3, y1];
1014 labels (range 1 thru 5);
1016 p_in := (z1 + 0.5 solfa_pen_thick * (1, -1))
1020 -- (z5 + 0.5 solfa_pen_thick * (-1, -1))
1033 charwy := curve_start [-chardp, charht];
1041 fet_beginchar ("Whole rehead", "s0re");
1042 draw_re_head (solfa_whole_width, 1);
1048 fet_beginchar ("Half up rehead", "u1re");
1049 draw_re_head (solfa_half_width, 1);
1055 fet_beginchar ("Half down rehead", "d1re");
1056 draw_re_head (solfa_half_width, -1);
1062 fet_beginchar ("Quart rehead", "u2re");
1063 draw_re_head (solfa_quarter_width, 1);
1068 fet_beginchar ("Quart rehead", "d2re");
1069 draw_re_head (solfa_quarter_width, -1);
1074 def draw_mi_head (expr width_factor) =
1075 save path_out, path_in;
1076 save ne_dist, se_dist, ne, se;
1077 path path_out, path_in;
1078 pair ne_dist, se_dist, ne, se;
1080 set_char_box (0, width_factor * solfa_noteheight#,
1081 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1083 pickup pencircle scaled solfa_pen_thick;
1094 z6 - z5 = whatever * (z2 - z1);
1095 z8 - z7 = whatever * (z2 - z1);
1096 z8 - z5 = whatever * (z4 - z1);
1097 z6 - z7 = whatever * (z4 - z1);
1099 ne = unitvector (z4 - z1);
1100 se = unitvector (z1 - z2);
1102 ne_dist = (ne rotated 90) * 0.5 solfa_pen_thick;
1103 se_dist = (se rotated 90) * 0.5 solfa_pen_thick;
1105 z5 = whatever [z1, z4] - ne_dist;
1106 z5 = whatever [z1, z2] - 1.5 se_dist;
1108 z5 - z1 = -(z7 - z3);
1110 labels (range 1 thru 8);
1119 .. (z1 + se_dist){-se}
1120 -- (z2 + se_dist){-se}
1122 .. (z2 - ne_dist){ne}
1123 -- (z3 - ne_dist){ne}
1125 .. (z3 - se_dist){se}
1126 -- (z4 - se_dist){se}
1128 .. (z4 + ne_dist){-ne}
1129 -- (z1 + ne_dist){-ne}
1134 fet_beginchar ("Whole mihead", "s0mi");
1135 draw_mi_head (solfa_whole_width);
1141 fet_beginchar ("Half mihead", "s1mi");
1142 draw_mi_head (solfa_quarter_width);
1148 fet_beginchar ("Quart mihead", "s2mi");
1149 draw_mi_head (solfa_quarter_width);
1154 def draw_fa_head (expr width_factor) =
1155 set_char_box (0, width_factor * solfa_noteheight#,
1156 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1158 save p_down_in, p_down_out, p_up_in, p_up_out, nw_dist, nw;
1159 path p_down_in, p_down_out, p_up_in, p_up_out;
1162 pickup pencircle scaled solfa_pen_thick;
1175 labels (1, 2, 3, 4);
1177 nw = unitvector (z1 - z3);
1178 nw_dist = (nw rotated 90) * 0.5 solfa_pen_thick;
1180 p_up_in := (((z1 - nw_dist) -- (z3 - nw_dist)) intersectionpoint
1182 -- (((z1 - nw_dist) -- (z3 - nw_dist)) intersectionpoint
1184 -- (z2 + 0.5 solfa_pen_thick * (-1, -1))
1187 p_up_out := lft z1{down}
1188 .. (z1 + nw_dist){-nw}
1189 -- (z3 + nw_dist){-nw}
1197 p_down_in := p_up_in rotated 180 shifted (w, 0);
1198 p_down_out := p_up_out rotated 180 shifted (w, 0);
1205 fet_beginchar ("Whole fa up head", "u0fa");
1206 draw_fa_head (solfa_whole_width);
1212 fet_beginchar ("Whole fa down head", "d0fa");
1213 draw_fa_head (solfa_whole_width);
1219 fet_beginchar ("half fa up head", "u1fa");
1220 draw_fa_head (solfa_half_width);
1226 fet_beginchar ("Half fa down head", "d1fa");
1227 draw_fa_head (solfa_half_width);
1233 fet_beginchar ("Quarter fa up head", "u2fa");
1234 draw_fa_head (solfa_quarter_width);
1239 fet_beginchar ("Quarter fa down head", "d2fa");
1240 draw_fa_head (solfa_quarter_width);
1245 def draw_la_head (expr width_factor) =
1246 set_char_box (0, width_factor * solfa_noteheight#,
1247 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1251 pickup pencircle scaled solfa_pen_thick;
1264 labels (range 1 thru 4);
1266 p_in := (z1 + 0.5 solfa_pen_thick * (1, -1))
1267 -- (z2 + 0.5 solfa_pen_thick * (-1, -1))
1268 -- (z3 + 0.5 solfa_pen_thick * (-1, 1))
1269 -- (z4 + 0.5 solfa_pen_thick * (1, 1))
1284 fet_beginchar ("Whole lahead", "s0la");
1285 draw_la_head (solfa_whole_width);
1291 fet_beginchar ("Half lahead", "s1la");
1292 draw_la_head (solfa_half_width);
1298 fet_beginchar ("Quart lahead", "s2la");
1299 draw_la_head (solfa_quarter_width);
1304 def draw_ti_head (expr width_factor, dir) =
1305 set_char_box (0, width_factor * solfa_noteheight#,
1306 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1307 save p_in, p_out, p_top;
1308 save nw_dist, sw_dist, nw, sw;
1309 path p_in, p_out, p_top;
1310 pair nw_dist, sw_dist, nw, sw;
1314 pickup pencircle scaled solfa_pen_thick;
1319 y2 = cone_height [y1, y3];
1325 labels (range 1 thru 4);
1327 nw = unitvector (z2 - z1);
1328 sw = unitvector (z1 - z4);
1330 nw_dist = (nw rotated 90) * 0.5 solfa_pen_thick;
1331 sw_dist = (sw rotated 90) * 0.5 solfa_pen_thick;
1333 p_top := (z2 - sw_dist)
1337 p_in := (((z1 - nw_dist) -- (z2 - nw_dist)) intersectionpoint
1338 ((z1 - sw_dist) -- (z4 - sw_dist)))
1339 -- (((z1 - nw_dist) -- (z2 - nw_dist)) intersectionpoint
1340 ((z2 + sw_dist) .. {right}(bot z3)))
1342 .. (((bot z3){right} .. (z4 + nw_dist)) intersectionpoint
1343 ((z1 - sw_dist) -- (z4 - sw_dist)))
1350 .. (z2 - sw_dist){direction 0 of p_top}
1352 & {direction infinity of p_top}(z4 - nw_dist)
1359 charwy := cone_height [-chardp, charht];
1366 fet_beginchar ("Whole up tihead", "s0ti");
1367 draw_ti_head (solfa_whole_width, 1);
1373 fet_beginchar ("Half up tihead", "u1ti");
1374 draw_ti_head (solfa_half_width, 1);
1380 fet_beginchar ("Half down tihead", "d1ti");
1381 draw_ti_head (solfa_half_width, -1);
1387 fet_beginchar ("Quart up tihead", "u2ti");
1388 draw_ti_head (solfa_quarter_width, 1);
1393 fet_beginchar ("Quart down tihead", "d2ti");
1394 draw_ti_head (solfa_quarter_width, -1);
1399 fet_endgroup ("noteheads");
1403 % we derive black_notehead_width# from the quarter head,
1404 % so we have to define black_notehead_width (pixel qty)
1405 % after the black_notehead_width# itself.
1407 % Let's keep it outside the group as well.
1410 define_pixels (black_notehead_width);