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);
210 fet_beginchar ("Half notehead", "s1");
211 draw_outside_ellipse (1.53 - puff_up_factor / 3.0, 34, 0.66, 0.17);
212 undraw_inside_ellipse (3.25, 33, 0.81, 2.5 stafflinethickness#);
214 draw_staff (-2, 2, 0);
219 fet_beginchar ("Half notehead", "s1");
220 draw_outside_ellipse (1.53 - puff_up_factor / 3.0, 34,
222 undraw_inside_ellipse (3.25, 33, 0.81,
223 2.5 stafflinethickness#);
225 draw_staff (-2, 2, 0.5);
230 fet_beginchar ("Quart notehead", "s2");
231 % used to have 32. With 31, they are slightly bolder.
232 draw_outside_ellipse (1.49 - puff_up_factor / 3.0, 31, 0.707, 0);
233 black_notehead_width# := charwd;
235 draw_staff (-2, 2, 0);
240 fet_beginchar ("Quart notehead", "s2");
241 draw_outside_ellipse (1.49 - puff_up_factor / 3.0, 31,
244 draw_staff (-2, 2, 0.5);
249 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
252 fet_beginchar ("Whole diamondhead", "s0diamond");
253 draw_outside_ellipse (1.80, 0, 0.495, 0);
254 undraw_inside_ellipse (1.30, 125, 0.6,
255 .4 staff_space# + stafflinethickness#);
257 draw_staff (-2, 2, 0);
262 fet_beginchar ("Whole diamondhead", "s0diamond");
263 draw_outside_ellipse (1.80, 0, 0.495, 0);
264 undraw_inside_ellipse (1.30, 125, 0.6,
265 .4 staff_space# + stafflinethickness#);
267 draw_staff (-2, 2, 0.5);
272 fet_beginchar ("Half diamondhead", "s1diamond");
273 draw_outside_ellipse (1.50, 34, 0.49, 0.17);
274 undraw_inside_ellipse (3.5, 33, 0.80,
275 .3 staff_space# + 1.5 stafflinethickness#);
277 draw_staff (-2, 2, 0);
282 fet_beginchar ("Half diamondhead", "s1diamond");
283 draw_outside_ellipse (1.50, 34, 0.49, 0.17);
284 undraw_inside_ellipse (3.5, 33, 0.80,
286 + 1.5 stafflinethickness#);
288 draw_staff (-2, 2, 0.5);
293 fet_beginchar ("Quart diamondhead", "s2diamond");
294 draw_outside_ellipse (1.80, 35, 0.495, -0.25);
296 draw_staff (-2, 2, 0);
301 fet_beginchar ("Quart diamondhead", "s2diamond");
302 draw_outside_ellipse (1.80, 35, 0.495, -0.25);
304 draw_staff (-2, 2, 0.5);
309 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
312 vardef penposx@# (expr d) =
322 z@#l = pat intersectionpoint (z@# -- infinity * dir (d + 180));
323 z@#r = pat intersectionpoint (z@# -- infinity * dir (d));
328 def define_triangle_shape (expr stemdir) =
329 save triangle_a, triangle_b, triangle_c;
330 save triangle_out_a, triangle_out_b, triangle_out_c;
331 save triangle_in, triangle_out;
332 save width, depth, height;
333 save origin, left_up_dir;
334 save exact_left_point, exact_right_point, exact_down_point;
336 path triangle_a, triangle_b, triangle_c;
337 path triangle_out_a, triangle_out_b, triangle_out_c;
338 path triangle_in, triangle_out;
339 pair origin, left_up_dir;
340 pair exact_down_point, exact_left_point, exact_right_point;
343 pen_thick# = stafflinethickness# + .1 staff_space#;
344 define_pixels (llap);
345 define_blacker_pixels (pen_thick);
347 left_up_dir = llap# * dir (90 + tilt);
349 xpart (left_up_dir) * xs - (pen_thick# * xs) / 2 + xpart origin = 0;
352 exact_left_point := origin + (left_up_dir xscaled xs);
353 exact_down_point := origin + (left_up_dir rotated 120 xscaled xs);
354 exact_right_point := origin + (left_up_dir rotated 240 xscaled xs);
356 height# = ypart (exact_left_point + origin) + pen_thick# / 2;
357 depth# = -ypart (exact_down_point + origin) + pen_thick# / 2;
358 width# = xpart (exact_right_point - exact_left_point)
361 set_char_box (0, width#, depth#, height#);
363 % Formerly, the shape has simply been drawn with an elliptical pen
364 % (`scaled pen_thick xsaled xs'), but the envelope of such a curve
365 % is of 6th degree. For the sake of mf2pt1, we approximate it.
367 pickup pencircle scaled pen_thick xscaled xs;
369 z0 = (hround_pixels (xpart origin), 0);
371 z1 = z1' = z0 + llap * dir (90 + tilt) xscaled xs;
372 z2 = z2' = z0 + llap * dir (90 + tilt + 120) xscaled xs;
373 z3 = z3' = z0 + llap * dir (90 + tilt + 240) xscaled xs;
375 z12 = caveness [.5[z1, z2], z3];
376 z23 = caveness [.5[z2, z3], z1];
377 z31 = caveness [.5[z3, z1], z2];
379 triangle_a = z1 .. z12 .. z2;
380 triangle_b = z2 .. z23 .. z3;
381 triangle_c = z3 .. z31 .. z1;
383 penposx1 (angle (direction 0 of triangle_a) - 90);
384 penposx2 (angle (direction 0 of triangle_b) - 90);
385 penposx3 (angle (direction 0 of triangle_c) - 90);
387 penposx1' (angle (direction infinity of triangle_c) + 90);
388 penposx2' (angle (direction infinity of triangle_a) + 90);
389 penposx3' (angle (direction infinity of triangle_b) + 90);
391 penposx12 (angle (z12 - z0));
392 penposx23 (angle (z23 - z0));
393 penposx31 (angle (z31 - z0));
395 z10 = (z0 -- z1) intersectionpoint (z1l .. z12l .. z2'r);
396 z20 = (z0 -- z2) intersectionpoint (z2l .. z23l .. z3'r);
397 z30 = (z0 -- z3) intersectionpoint (z3l .. z31l .. z1'r);
410 triangle_out_a = z1r .. z12r .. z2'l;
411 triangle_out_b = z2r .. z23r .. z3'l;
412 triangle_out_c = z3r .. z31r .. z1'l;
414 triangle_out = top z1
416 .. z1r{direction 0 of triangle_out_a}
418 & {direction infinity of triangle_out_a}z2'l
421 .. z2r{direction 0 of triangle_out_b}
423 & {direction infinity of triangle_out_b}z3'l
426 .. z3r{direction 0 of triangle_out_c}
428 & {direction infinity of triangle_out_c}z1'l
431 labels (0, 10, 20, 30);
432 penlabels (1, 1', 2, 2', 3, 3', 12, 23, 31);
436 charwy := ypart exact_right_point;
437 charwx := xpart exact_right_point;
439 charwy := -ypart exact_down_point;
440 charwx := (width# - xpart exact_down_point);
445 def draw_whole_triangle_head =
451 llap# = 3/4 noteheight#;
455 define_triangle_shape (1);
461 fet_beginchar ("Whole trianglehead", "s0triangle");
462 draw_whole_triangle_head;
464 draw_staff (-2, 2, 0);
469 fet_beginchar ("Whole trianglehead", "s0triangle");
470 draw_whole_triangle_head;
472 draw_staff (-2, 2, 0.5);
477 def draw_small_triangle_head (expr dir) =
483 llap# = 2/3 noteheight#;
486 define_triangle_shape (dir);
490 filldraw triangle_out;
491 unfilldraw triangle_in;
495 fet_beginchar ("Half trianglehead", "d1triangle");
496 draw_small_triangle_head (-1);
498 draw_staff (-2, 2, 0);
502 fet_beginchar ("Half trianglehead", "u1triangle");
503 draw_small_triangle_head (1);
505 draw_staff (-2, 2, 0.5);
509 def draw_closed_triangle_head (expr dir) =
515 llap# = 2/3 noteheight#;
518 define_triangle_shape (dir);
523 fet_beginchar ("Quart trianglehead", "u2triangle");
524 draw_closed_triangle_head (1);
526 draw_staff (-2, 2, 0);
530 fet_beginchar ("Quart trianglehead", "d2triangle");
531 draw_closed_triangle_head (-1);
533 draw_staff (-2, 2, 0.5);
537 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
539 % Slash heads are for indicating improvisation. They are
540 % twice as high as normal heads.
542 def draw_slash (expr hwid_hash) =
546 exact_height = staff_space# + stafflinethickness# / 2;
548 set_char_box (0, 2 exact_height / slash_slope + hwid_hash,
549 exact_height, exact_height);
558 pickup pencircle scaled blot_diameter;
563 lft x2 = 2 h / slash_slope;
570 ne = unitvector (z3 - z4);
571 nw_dist = (ne rotated 90) * 0.5 blot_diameter;
574 .. (z1 + nw_dist){ne}
575 -- (z2 + nw_dist){ne}
578 .. (z3 - nw_dist){-ne}
579 -- (z4 - nw_dist){-ne}
583 if hwid_hash > 2 slash_thick#:
586 th = slash_thick - blot_diameter;
591 z6 - z5 = whatever * ne;
592 z8 - z7 = whatever * ne;
594 z5 = z1 + whatever * ne + th * (ne rotated -90);
595 z8 = z4 + whatever * ne + th * (ne rotated 90);
603 labels (range 1 thru 10);
607 fet_beginchar ("Whole slashhead", "s0slash");
608 draw_slash (4 slash_thick# + 0.5 staff_space#);
610 draw_staff (-2, 2, 0);
614 fet_beginchar ("Half slashhead", "s1slash");
615 draw_slash (3.0 slash_thick# + 0.15 staff_space#);
617 draw_staff (-2, 2, 0);
621 fet_beginchar ("Quart slashhead", "s2slash");
622 draw_slash (1.5 slash_thick#);
624 draw_staff (-2, 2, 0);
628 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
630 % `thick' is the distance between the NE/SW parallel lines in the cross
631 % (distance between centres of lines) in multiples of stafflinethickness
633 def draw_cross (expr thick) =
635 save ne_dist, nw_dist, rt_dist, up_dist;
636 save crz_in, crz_out;
639 pair ne_dist, nw_dist, rt_dist, up_dist;
640 path crz_in, crz_out;
642 pen_thick# := 1.2 stafflinethickness#;
643 thickness# := thick * stafflinethickness#;
644 define_pixels (thickness);
645 define_blacker_pixels (pen_thick);
647 pickup pencircle scaled pen_thick;
652 ne = unitvector ((1, (2 h - pen_thick) / (w - pen_thick)));
655 z4 - z5 = whatever * ne;
657 z6 - z3 = whatever * ne;
658 z3 - z4 = whatever * (ne yscaled -1);
660 z4 - z3 = whatever * (ne) + (ne rotated -90) * thickness;
663 x1 = charwd / 2 - .5 pen_thick#;
665 + thick / 2 * stafflinethickness# * (ne rotated -90);
667 % labels (1, 2, 3, 4, 5, 6);
669 nw = unitvector (z3 - z4);
671 up_dist = up * 0.5 pen_thick / cosd (angle (ne));
672 rt_dist = right * 0.5 pen_thick / sind (angle (ne));
673 nw_dist = (ne rotated 90) * 0.5 pen_thick;
674 ne_dist = (nw rotated -90) * 0.5 pen_thick;
680 x4 := hround (x4' + .5 pen_thick) - .5 pen_thick;
681 x5 := hfloor (x5' + xpart rt_dist) - xpart rt_dist;
682 y6 := vfloor (y6' + ypart up_dist) - ypart up_dist;
684 crz_out = (z6 + up_dist)
685 -- (z3 + nw_dist){ne}
687 .. (z3 + ne_dist){-nw}
688 -- (z4 + ne_dist){-nw}
690 .. (z4 - nw_dist){-ne}
692 crz_out := crz_out shifted (0, feta_shift)
693 -- reverse crz_out yscaled -1 shifted (0, -feta_eps);
695 -- reverse crz_out xscaled -1 shifted (-feta_eps, 0)
699 x4 := hround (x4' - xpart rt_dist) + xpart rt_dist;
700 x5 := hceiling (x5' - .5 pen_thick) + .5 pen_thick;
701 y6 := vfloor (y6' - .5 pen_thick) + .5 pen_thick;
703 crz_in = (bot z6){right}
704 .. (z6 - nw_dist){ne}
707 -- (z5 + nw_dist){-ne}
709 crz_in := crz_in shifted (0, feta_shift)
710 -- reverse crz_in yscaled -1 shifted (0, -feta_eps);
712 -- reverse crz_in xscaled -1 shifted (-feta_eps, 0)
717 currentpicture := currentpicture shifted (hround (w / 2), 0);
720 charwy := y1 + feta_shift;
722 z12 = (charwx * hppp, y1 * vppp);
728 fet_beginchar ("Whole Crossed notehead", "s0cross");
731 wid# := black_notehead_width# + 4 stafflinethickness#;
732 hei# := noteheight# + stafflinethickness#;
734 set_char_box (0, wid#, hei# / 2, hei# / 2);
738 remember_pic := currentpicture;
740 draw_staff (-2, 2, 0);
745 fet_beginchar ("Whole Crossed notehead", "s0cross");
748 wid# := black_notehead_width# + 4 stafflinethickness#;
749 hei# := noteheight# + stafflinethickness#;
751 set_char_box (0, wid#, hei# / 2, hei# / 2);
753 currentpicture := remember_pic;
755 draw_staff (-2, 2, 0.5);
760 fet_beginchar ("Half Crossed notehead", "s1cross");
763 wid# := black_notehead_width# + 2 stafflinethickness#;
764 hei# := noteheight# + stafflinethickness# / 2;
766 set_char_box (0, wid#, hei# / 2, hei# / 2);
770 remember_pic := currentpicture;
772 draw_staff (-2, 2, 0);
777 fet_beginchar ("Half Crossed notehead", "s1cross");
780 wid# := black_notehead_width# + 2 stafflinethickness#;
781 hei# := noteheight# + stafflinethickness# / 2;
783 set_char_box (0, wid#, hei# / 2, hei# / 2);
785 currentpicture := remember_pic;
787 draw_staff (-2, 2, 0.5);
792 fet_beginchar ("Crossed notehead", "s2cross");
793 wid# := black_notehead_width#;
795 set_char_box (0, wid#, hei# / 2, hei# / 2);
799 remember_pic := currentpicture;
801 draw_staff (-2, 2, 0);
806 fet_beginchar ("Crossed notehead", "s2cross");
807 wid# := black_notehead_width#;
809 set_char_box (0, wid#, hei# / 2, hei# / 2);
811 currentpicture := remember_pic;
813 draw_staff (-2, 2, 0.5);
818 fet_beginchar ("X-Circled notehead", "s2xcircle");
820 save cthick, cxd, cyd, dy;
822 wid# := black_notehead_width# * sqrt (sqrt2);
823 hei# := noteheight# * sqrt (sqrt2);
825 set_char_box (0, wid#, hei# / 2, hei# / 2);
827 d := d - feta_space_shift;
829 cthick# := (1.2 + 1/4) * stafflinethickness#;
830 define_blacker_pixels (cthick);
833 cyd := h + d - cthick / 2;
837 pickup pencircle scaled cthick;
839 fill fullcircle xscaled (cxd + cthick)
840 yscaled (cyd + cthick)
842 unfill fullcircle xscaled (cxd - cthick)
843 yscaled (cyd - cthick)
846 xpos := .5 cxd / sqrt2;
847 ypos := .5 cyd / sqrt2;
849 pickup penrazor scaled cthick rotated (angle (xpos, ypos) + 90);
850 draw (-xpos + w / 2, -ypos + dy) -- (xpos + w / 2, ypos + dy);
852 pickup penrazor scaled cthick rotated (angle (xpos, -ypos) + 90);
853 draw (-xpos + w / 2, ypos + dy) -- (xpos + w / 2, -ypos + dy);
858 z12 = (charwx * hppp, charwy * vppp);
861 remember_pic := currentpicture;
863 draw_staff (-2, 2, 0);
868 fet_beginchar ("X-Circled notehead", "s2xcircle");
870 save cthick, cxr, cyr;
872 wid# := black_notehead_width# * sqrt (sqrt2);
873 hei# := noteheight# * sqrt (sqrt2);
875 set_char_box (0, wid#, hei# / 2, hei# / 2);
877 currentpicture := remember_pic;
879 draw_staff (-2, 2, 0.5);
889 save solfa_pen_thick;
890 solfa_pen_thick# = 2 stafflinethickness#;
891 define_blacker_pixels (solfa_pen_thick);
894 solfa_whole_width := 1.8;
895 solfa_half_width := 1.35;
896 solfa_quarter_width := 1.35;
899 def draw_do_head (expr width_factor, dir) =
901 save left_dist, right_dist;
903 pair left_dist, right_dist;
905 set_char_box (0, width_factor * solfa_noteheight#,
906 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
908 pickup pencircle scaled solfa_pen_thick;
917 left_dist = (unitvector (z3 - z1) rotated 90) * 0.5 solfa_pen_thick;
918 right_dist = (unitvector (z2 - z3) rotated 90) * 0.5 solfa_pen_thick;
920 p_in := (((z1 - left_dist) -- (z3 - left_dist)) intersectionpoint
922 -- ((top z1 -- top z2) intersectionpoint
923 ((z2 - right_dist) -- (z3 - right_dist)))
924 -- (((z2 - right_dist) -- (z3 - right_dist)) intersectionpoint
925 ((z1 - left_dist) -- (z3 - left_dist)))
931 .. (z2 + right_dist){z3 - z2}
932 -- (z3 + right_dist){z3 - z2}
934 .. (z3 + left_dist){z1 - z3}
935 -- (z1 + left_dist){z1 - z3}
943 charwy := -chardp + 0.5 stafflinethickness#;
950 fet_beginchar ("Whole dohead", "s0do");
951 draw_do_head (solfa_whole_width, 1);
957 fet_beginchar ("Half dohead", "d1do");
958 draw_do_head (solfa_half_width, -1);
964 fet_beginchar ("Half dohead", "u1do");
965 draw_do_head (solfa_half_width, 1);
971 fet_beginchar ("Quart dohead", "d2do");
972 draw_do_head (solfa_quarter_width, -1);
977 fet_beginchar ("Quart dohead", "u2do");
978 draw_do_head (solfa_quarter_width, 1);
984 % re - flat top, curved bottom:
985 % (0,h/2) {dir -90} .. (w/2,-h/2) .. {dir 90} (w,h/2) -- cycle;
986 % (broader along the base and with more vertical sides for half and
988 % stem attachment: h/2
991 def draw_re_head (expr width_factor, dir) =
995 set_char_box (0, width_factor * solfa_noteheight#,
996 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
998 pickup pencircle scaled solfa_pen_thick;
1005 y2 = curve_start [y3, y1];
1013 labels (range 1 thru 5);
1015 p_in := (z1 + 0.5 solfa_pen_thick * (1, -1))
1019 -- (z5 + 0.5 solfa_pen_thick * (-1, -1))
1032 charwy := curve_start [-chardp, charht];
1040 fet_beginchar ("Whole rehead", "s0re");
1041 draw_re_head (solfa_whole_width, 1);
1047 fet_beginchar ("Half up rehead", "u1re");
1048 draw_re_head (solfa_half_width, 1);
1054 fet_beginchar ("Half down rehead", "d1re");
1055 draw_re_head (solfa_half_width, -1);
1061 fet_beginchar ("Quart rehead", "u2re");
1062 draw_re_head (solfa_quarter_width, 1);
1067 fet_beginchar ("Quart rehead", "d2re");
1068 draw_re_head (solfa_quarter_width, -1);
1073 def draw_mi_head (expr width_factor) =
1074 save path_out, path_in;
1075 save ne_dist, se_dist, ne, se;
1076 path path_out, path_in;
1077 pair ne_dist, se_dist, ne, se;
1079 set_char_box (0, width_factor * solfa_noteheight#,
1080 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1082 pickup pencircle scaled solfa_pen_thick;
1093 z6 - z5 = whatever * (z2 - z1);
1094 z8 - z7 = whatever * (z2 - z1);
1095 z8 - z5 = whatever * (z4 - z1);
1096 z6 - z7 = whatever * (z4 - z1);
1098 ne = unitvector (z4 - z1);
1099 se = unitvector (z1 - z2);
1101 ne_dist = (ne rotated 90) * 0.5 solfa_pen_thick;
1102 se_dist = (se rotated 90) * 0.5 solfa_pen_thick;
1104 z5 = whatever [z1, z4] - ne_dist;
1105 z5 = whatever [z1, z2] - 1.5 se_dist;
1107 z5 - z1 = -(z7 - z3);
1109 labels (range 1 thru 8);
1118 .. (z1 + se_dist){-se}
1119 -- (z2 + se_dist){-se}
1121 .. (z2 - ne_dist){ne}
1122 -- (z3 - ne_dist){ne}
1124 .. (z3 - se_dist){se}
1125 -- (z4 - se_dist){se}
1127 .. (z4 + ne_dist){-ne}
1128 -- (z1 + ne_dist){-ne}
1133 fet_beginchar ("Whole mihead", "s0mi");
1134 draw_mi_head (solfa_whole_width);
1140 fet_beginchar ("Half mihead", "s1mi");
1141 draw_mi_head (solfa_quarter_width);
1147 fet_beginchar ("Quart mihead", "s2mi");
1148 draw_mi_head (solfa_quarter_width);
1153 def draw_fa_head (expr width_factor) =
1154 set_char_box (0, width_factor * solfa_noteheight#,
1155 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1157 save p_down_in, p_down_out, p_up_in, p_up_out, nw_dist, nw;
1158 path p_down_in, p_down_out, p_up_in, p_up_out;
1161 pickup pencircle scaled solfa_pen_thick;
1174 labels (1, 2, 3, 4);
1176 nw = unitvector (z1 - z3);
1177 nw_dist = (nw rotated 90) * 0.5 solfa_pen_thick;
1179 p_up_in := (((z1 - nw_dist) -- (z3 - nw_dist)) intersectionpoint
1181 -- (((z1 - nw_dist) -- (z3 - nw_dist)) intersectionpoint
1183 -- (z2 + 0.5 solfa_pen_thick * (-1, -1))
1186 p_up_out := lft z1{down}
1187 .. (z1 + nw_dist){-nw}
1188 -- (z3 + nw_dist){-nw}
1196 p_down_in := p_up_in rotated 180 shifted (w, 0);
1197 p_down_out := p_up_out rotated 180 shifted (w, 0);
1204 fet_beginchar ("Whole fa up head", "u0fa");
1205 draw_fa_head (solfa_whole_width);
1211 fet_beginchar ("Whole fa down head", "d0fa");
1212 draw_fa_head (solfa_whole_width);
1218 fet_beginchar ("half fa up head", "u1fa");
1219 draw_fa_head (solfa_half_width);
1225 fet_beginchar ("Half fa down head", "d1fa");
1226 draw_fa_head (solfa_half_width);
1232 fet_beginchar ("Quarter fa up head", "u2fa");
1233 draw_fa_head (solfa_quarter_width);
1238 fet_beginchar ("Quarter fa down head", "d2fa");
1239 draw_fa_head (solfa_quarter_width);
1244 def draw_la_head (expr width_factor) =
1245 set_char_box (0, width_factor * solfa_noteheight#,
1246 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1250 pickup pencircle scaled solfa_pen_thick;
1263 labels (range 1 thru 4);
1265 p_in := (z1 + 0.5 solfa_pen_thick * (1, -1))
1266 -- (z2 + 0.5 solfa_pen_thick * (-1, -1))
1267 -- (z3 + 0.5 solfa_pen_thick * (-1, 1))
1268 -- (z4 + 0.5 solfa_pen_thick * (1, 1))
1283 fet_beginchar ("Whole lahead", "s0la");
1284 draw_la_head (solfa_whole_width);
1290 fet_beginchar ("Half lahead", "s1la");
1291 draw_la_head (solfa_half_width);
1297 fet_beginchar ("Quart lahead", "s2la");
1298 draw_la_head (solfa_quarter_width);
1303 def draw_ti_head (expr width_factor, dir) =
1304 set_char_box (0, width_factor * solfa_noteheight#,
1305 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1306 save p_in, p_out, p_top;
1307 save nw_dist, sw_dist, nw, sw;
1308 path p_in, p_out, p_top;
1309 pair nw_dist, sw_dist, nw, sw;
1313 pickup pencircle scaled solfa_pen_thick;
1318 y2 = cone_height [y1, y3];
1324 labels (range 1 thru 4);
1326 nw = unitvector (z2 - z1);
1327 sw = unitvector (z1 - z4);
1329 nw_dist = (nw rotated 90) * 0.5 solfa_pen_thick;
1330 sw_dist = (sw rotated 90) * 0.5 solfa_pen_thick;
1332 p_top := (z2 - sw_dist)
1336 p_in := (((z1 - nw_dist) -- (z2 - nw_dist)) intersectionpoint
1337 ((z1 - sw_dist) -- (z4 - sw_dist)))
1338 -- (((z1 - nw_dist) -- (z2 - nw_dist)) intersectionpoint
1339 ((z2 + sw_dist) .. {right}(bot z3)))
1341 .. (((bot z3){right} .. (z4 + nw_dist)) intersectionpoint
1342 ((z1 - sw_dist) -- (z4 - sw_dist)))
1349 .. (z2 - sw_dist){direction 0 of p_top}
1351 & {direction infinity of p_top}(z4 - nw_dist)
1358 charwy := cone_height [-chardp, charht];
1365 fet_beginchar ("Whole up tihead", "s0ti");
1366 draw_ti_head (solfa_whole_width, 1);
1372 fet_beginchar ("Half up tihead", "u1ti");
1373 draw_ti_head (solfa_half_width, 1);
1379 fet_beginchar ("Half down tihead", "d1ti");
1380 draw_ti_head (solfa_half_width, -1);
1386 fet_beginchar ("Quart up tihead", "u2ti");
1387 draw_ti_head (solfa_quarter_width, 1);
1392 fet_beginchar ("Quart down tihead", "d2ti");
1393 draw_ti_head (solfa_quarter_width, -1);
1398 fet_endgroup ("noteheads");
1402 % we derive black_notehead_width# from the quarter head,
1403 % so we have to define black_notehead_width (pixel qty)
1404 % after the black_notehead_width# itself.
1406 % Let's keep it outside the group as well.
1409 define_pixels (black_notehead_width);