1 % Feta (not the Font-En-Tja) music font -- implement noteheads
2 % This file is part of LilyPond, the GNU music typesetter.
4 % Copyright (C) 1997--2014 Jan Nieuwenhuizen <janneke@gnu.org>
5 % & Han-Wen Nienhuys <hanwen@xs4all.nl>
6 % & Juergen Reuter <reuter@ipd.uka.de>
8 % The LilyPond font is free software: you can redistribute it and/or modify
9 % it under the terms of the GNU General Public License as published by
10 % the Free Software Foundation, either version 3 of the License, or
11 % (at your option) any later version, or under the SIL Open Font License.
13 % LilyPond is distributed in the hope that it will be useful,
14 % but WITHOUT ANY WARRANTY; without even the implied warranty of
15 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 % GNU General Public License for more details.
18 % You should have received a copy of the GNU General Public License
19 % along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
24 % Most beautiful noteheads are pronounced, not circular,
25 % and not even symmetric.
26 % These examples are inspired by [Wanske]; see literature list.
29 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
31 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
33 save half_notehead_width, whole_notehead_width;
34 save solfa_noteheight;
36 numeric whole_notehead_width;
37 numeric half_notehead_width;
39 fet_begingroup ("noteheads");
43 % solfa heads should not overlap on chords.
45 solfa_noteheight# := staff_space# - stafflinethickness#;
47 def undraw_inside_ellipse (expr ellipticity, tilt, superness, clearance) =
52 pat := superellipse ((ellipticity, 0), (0, 1.0),
53 (-ellipticity, 0), (0, -1.0),
55 pat := pat rotated tilt;
57 save top_point, right_point;
58 pair top_point, right_point;
60 top_point := directionpoint left of pat;
61 right_point := directionpoint up of pat;
65 height# = staff_space# + stafflinethickness# - clearance;
66 scaling# = height# / (2 ypart (top_point));
67 define_pixels (scaling);
68 pat := pat scaled scaling shifted (w / 2, .5 (h - d));
79 def draw_longa (expr up) =
80 save stemthick, fudge;
82 stemthick# = 2 stafflinethickness#;
83 define_whole_blacker_pixels (stemthick);
85 % Longas of smaller design sizes should have their lines farther
86 % apart (the overlap with notehead ellipsoid should be smaller).
87 fudge = hround (blot_diameter
90 - (20 / (design_size + 4)))),
93 draw_outside_ellipse (1.80, 0, 0.707, 0);
94 undraw_inside_ellipse (1.30, 125, 0.68, 2 stafflinethickness#);
96 pickup pencircle scaled stemthick;
98 % Longas of smaller design sizes should have their lines longer.
99 line_length := min (max (0.7, (64/60 - (design_size / 60))), 0.85);
101 % Line lengths between 0.72 and 0.77 are not nice
102 % because they are neither separate nor connected
103 % when there is an interval of fourth.
104 if line_length < 0.75:
105 quanted_line_length := min (0.72, line_length);
107 quanted_line_length := max (0.77, line_length);
111 final_line_length := quanted_line_length * staff_space;
114 define_pixels (boxtop, boxbot);
117 bot y1 = -final_line_length;
118 top y2 = final_line_length;
122 fudge + lft x3 = width;
124 top y4 = h + 3.0 staff_space;
126 boxtop# := staff_space# * (quanted_line_length + 3.0) - stemthick# ;
127 boxbot# := staff_space# * quanted_line_length;
129 bot y1 = -d - 3.0 staff_space;
130 top y2 = final_line_length;
134 fudge + lft x3 = width;
137 bot y3 = -final_line_length;
138 boxtop# := staff_space# * quanted_line_length;
139 boxbot# := staff_space# * (quanted_line_length + 3.0) - stemthick# ;
142 draw_gridline (z1, z2, stemthick);
143 draw_gridline (z3, z4, stemthick);
145 set_char_box (stemthick#,
154 fet_beginchar ("Longa notehead", "uM2");
157 draw_staff_if_debugging (-2, 2);
161 fet_beginchar ("Longa notehead", "dM2");
164 draw_staff_if_debugging (-2, 2);
168 def draw_brevis (expr linecount, line_thickness_multiplier) =
169 save stemthick, fudge, gap;
171 stemthick# = line_thickness_multiplier * 2 * stafflinethickness#;
172 define_whole_blacker_pixels (stemthick);
174 % double-lined breves of smaller design sizes should have
175 % bigger gap between the lines.
176 gap# := (0.95 - 0.008 * design_size) * stemthick#;
178 % Breves of smaller design sizes should have their lines farther
179 % apart (the overlap with notehead ellipsoid should be smaller).
180 fudge = hround (blot_diameter
183 - (20 / (design_size + 4))
187 draw_outside_ellipse (1.80, 0, 0.707, 0);
188 undraw_inside_ellipse (1.30, 125, 0.68, 2 stafflinethickness#);
191 pickup pencircle scaled stemthick;
193 % Breves of smaller design sizes should have their lines longer.
194 line_length := min (max (0.7, (64/60 - (design_size / 60))), 0.85);
196 % Line lengths between 0.72 and 0.77 are not nice
197 % because they are neither separate nor connected
198 % when there is an interval of fourth.
199 if line_length < 0.75:
200 quanted_line_length := min (0.72, line_length);
202 quanted_line_length := max (0.77, line_length);
205 set_char_box (stemthick# * linecount + gap# * (linecount - 1),
206 width# + stemthick# * linecount + gap# * (linecount - 1),
207 staff_space# * quanted_line_length,
208 staff_space# * quanted_line_length);
210 bot y1 = -quanted_line_length * staff_space;
211 top y2 = quanted_line_length * staff_space;
215 fudge + lft x3 = width;
220 for i := 0 step 1 until linecount - 1:
221 line_distance := i * (gap + stemthick);
222 draw_gridline (z1 - (line_distance, 0),
223 z2 - (line_distance, 0),
225 draw_gridline (z3 + (line_distance, 0),
226 z4 + (line_distance, 0),
232 fet_beginchar ("Brevis notehead", "sM1");
235 draw_staff_if_debugging (-2, 2);
239 fet_beginchar ("Double-lined brevis notehead", "sM1double");
240 draw_brevis (2, 0.8);
242 draw_staff_if_debugging (-2, 2);
246 fet_beginchar ("Whole notehead", "s0");
247 draw_outside_ellipse (1.80 - puff_up_factor / 3.0, 0, 0.707, 0);
248 undraw_inside_ellipse (1.30, 125 - puff_up_factor * 10,
249 0.68, 2 stafflinethickness#);
251 whole_notehead_width# := charwd;
253 draw_staff_if_debugging (-2, 2);
257 fet_beginchar ("Half notehead", "s1");
258 draw_outside_ellipse (1.53 - puff_up_factor / 3.0, 34, 0.66, 0.17);
259 undraw_inside_ellipse (3.25, 33, 0.81, 2.5 stafflinethickness#);
261 half_notehead_width# := charwd;
263 draw_staff_if_debugging (-2, 2);
267 fet_beginchar ("Quarter notehead", "s2");
269 draw_staff_if_debugging (-2, 2);
273 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
276 fet_beginchar ("Whole diamondhead", "s0diamond");
277 draw_outside_ellipse (1.80, 0, 0.495, 0);
278 undraw_inside_ellipse (1.30, 125, 0.6,
279 .4 staff_space# + stafflinethickness#);
281 draw_staff_if_debugging (-2, 2);
285 fet_beginchar ("Half diamondhead", "s1diamond");
286 draw_outside_ellipse (1.50, 34, 0.49, 0.17);
287 undraw_inside_ellipse (3.5, 33, 0.80,
288 .3 staff_space# + 1.5 stafflinethickness#);
290 draw_staff_if_debugging (-2, 2);
294 fet_beginchar ("Quarter diamondhead", "s2diamond");
295 draw_outside_ellipse (1.80, 35, 0.495, -0.25);
297 draw_staff_if_debugging (-2, 2);
301 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
304 vardef penposx@# (expr d) =
314 z@#l = pat intersectionpoint (z@# -- infinity * dir (d + 180));
315 z@#r = pat intersectionpoint (z@# -- infinity * dir (d));
321 % UGH: xs not declared as argument.
323 def define_triangle_shape (expr stemdir) =
324 save triangle_a, triangle_b, triangle_c;
325 save triangle_out_a, triangle_out_b, triangle_out_c;
326 save triangle_in, triangle_out;
327 save width, depth, height;
328 save origin, left_up_dir;
329 save exact_left_point, exact_right_point, exact_down_point;
331 path triangle_a, triangle_b, triangle_c;
332 path triangle_out_a, triangle_out_b, triangle_out_c;
333 path triangle_in, triangle_out;
334 pair origin, left_up_dir;
335 pair exact_down_point, exact_left_point, exact_right_point;
338 pen_thick# = stafflinethickness# + .1 staff_space#;
339 define_pixels (llap);
340 define_blacker_pixels (pen_thick);
342 left_up_dir = llap# * dir (90 + tilt);
344 xpart (left_up_dir) * xs - (pen_thick# * xs) / 2 + xpart origin = 0;
347 exact_left_point := origin + (left_up_dir xscaled xs);
348 exact_down_point := origin + (left_up_dir rotated 120 xscaled xs);
349 exact_right_point := origin + (left_up_dir rotated 240 xscaled xs);
351 height# = ypart (exact_left_point + origin) + pen_thick# / 2;
352 depth# = -ypart (exact_down_point + origin) + pen_thick# / 2;
353 width# = xpart (exact_right_point - exact_left_point)
356 set_char_box (0, width#, depth#, height#);
358 % Formerly, the shape has simply been drawn with an elliptical pen
359 % (`scaled pen_thick xscaled xs'), but the envelope of such a curve
360 % is of 6th degree. For the sake of mf2pt1, we approximate it.
362 pickup pencircle scaled pen_thick xscaled xs;
364 z0 = (hround_pixels (xpart origin), 0);
366 z1 = z1' = z0 + llap * dir (90 + tilt) xscaled xs;
367 z2 = z2' = z0 + llap * dir (90 + tilt + 120) xscaled xs;
368 z3 = z3' = z0 + llap * dir (90 + tilt + 240) xscaled xs;
370 z12 = caveness [.5[z1, z2], z3];
371 z23 = caveness [.5[z2, z3], z1];
372 z31 = caveness [.5[z3, z1], z2];
374 triangle_a = z1 .. z12 .. z2;
375 triangle_b = z2 .. z23 .. z3;
376 triangle_c = z3 .. z31 .. z1;
378 penposx1 (angle (direction 0 of triangle_a) - 90);
379 penposx2 (angle (direction 0 of triangle_b) - 90);
380 penposx3 (angle (direction 0 of triangle_c) - 90);
382 penposx1' (angle (direction infinity of triangle_c) + 90);
383 penposx2' (angle (direction infinity of triangle_a) + 90);
384 penposx3' (angle (direction infinity of triangle_b) + 90);
386 penposx12 (angle (z12 - z0));
387 penposx23 (angle (z23 - z0));
388 penposx31 (angle (z31 - z0));
390 z10 = (z0 -- z1) intersectionpoint (z1l .. z12l .. z2'r);
391 z20 = (z0 -- z2) intersectionpoint (z2l .. z23l .. z3'r);
392 z30 = (z0 -- z3) intersectionpoint (z3l .. z31l .. z1'r);
405 triangle_out_a = z1r .. z12r .. z2'l;
406 triangle_out_b = z2r .. z23r .. z3'l;
407 triangle_out_c = z3r .. z31r .. z1'l;
409 triangle_out = top z1
411 .. z1r{direction 0 of triangle_out_a}
413 & {direction infinity of triangle_out_a}z2'l
416 .. z2r{direction 0 of triangle_out_b}
418 & {direction infinity of triangle_out_b}z3'l
421 .. z3r{direction 0 of triangle_out_c}
423 & {direction infinity of triangle_out_c}z1'l
426 labels (0, 10, 20, 30);
427 penlabels (1, 1', 2, 2', 3, 3', 12, 23, 31);
431 charwy := ypart exact_right_point;
432 charwx := xpart exact_right_point + .5 pen_thick# * xs;
434 charwy := -ypart exact_down_point;
435 charwx := width# - (xpart exact_down_point - .5 pen_thick# * xs);
440 def draw_whole_triangle_head =
446 llap# = 3/4 noteheight#;
450 define_triangle_shape (1);
456 fet_beginchar ("Whole trianglehead", "s0triangle");
457 draw_whole_triangle_head;
459 draw_staff_if_debugging (-2, 2);
463 def draw_small_triangle_head (expr dir) =
469 llap# = 2/3 noteheight#;
472 define_triangle_shape (dir);
476 filldraw triangle_out;
477 unfilldraw triangle_in;
481 fet_beginchar ("Half trianglehead (downstem)", "d1triangle");
482 draw_small_triangle_head (-1);
484 draw_staff_if_debugging (-2, 2);
488 fet_beginchar ("Half trianglehead (upstem)", "u1triangle");
489 draw_small_triangle_head (1);
491 draw_staff_if_debugging (-2, 2);
495 def draw_closed_triangle_head (expr dir) =
501 llap# = 2/3 noteheight#;
504 define_triangle_shape (dir);
509 fet_beginchar ("Quarter trianglehead (upstem)", "u2triangle");
510 draw_closed_triangle_head (1);
512 draw_staff_if_debugging (-2, 2);
516 fet_beginchar ("Quarter trianglehead (downstem)", "d2triangle");
517 draw_closed_triangle_head (-1);
519 draw_staff_if_debugging (-2, 2);
523 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
525 % Slash heads are for indicating improvisation. They are
526 % twice as high as normal heads.
528 def draw_slash (expr hwid_hash) =
532 exact_height = staff_space# + stafflinethickness# / 2;
534 set_char_box (0, 2 exact_height / slash_slope + hwid_hash,
535 exact_height, exact_height);
544 pickup pencircle scaled blot_diameter;
549 lft x2 = 2 h / slash_slope;
556 ne = unitvector (z3 - z4);
557 nw_dist = (ne rotated 90) * 0.5 blot_diameter;
560 .. (z1 + nw_dist){ne}
561 -- (z2 + nw_dist){ne}
564 .. (z3 - nw_dist){-ne}
565 -- (z4 - nw_dist){-ne}
569 if hwid_hash > 2 slash_thick#:
572 th = slash_thick - blot_diameter;
577 z6 - z5 = whatever * ne;
578 z8 - z7 = whatever * ne;
580 z5 = z1 + whatever * ne + th * (ne rotated -90);
581 z8 = z4 + whatever * ne + th * (ne rotated 90);
589 labels (range 1 thru 10);
593 fet_beginchar ("Whole slashhead", "s0slash");
594 draw_slash (4 slash_thick# + 0.5 staff_space#);
596 draw_staff_if_debugging (-2, 2);
600 fet_beginchar ("Half slashhead", "s1slash");
601 draw_slash (3.0 slash_thick# + 0.15 staff_space#);
603 draw_staff_if_debugging (-2, 2);
607 fet_beginchar ("Quarter slashhead", "s2slash");
608 draw_slash (1.5 slash_thick#);
610 draw_staff_if_debugging (-2, 2);
614 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
616 % `thick' is the distance between the NE/SW parallel lines in the cross
617 % (distance between centres of lines) in multiples of stafflinethickness
619 def draw_cross (expr thick) =
621 save ne_dist, nw_dist, rt_dist, up_dist;
622 save crz_in, crz_out;
625 pair ne_dist, nw_dist, rt_dist, up_dist;
626 path crz_in, crz_out;
628 pen_thick# := 1.2 stafflinethickness#;
629 thickness# := thick * stafflinethickness#;
630 define_pixels (thickness);
631 define_blacker_pixels (pen_thick);
633 pickup pencircle scaled pen_thick;
638 ne = unitvector ((1, (2 h - pen_thick) / (w - pen_thick)));
641 z4 - z5 = whatever * ne;
643 z6 - z3 = whatever * ne;
644 z3 - z4 = whatever * (ne yscaled -1);
646 z4 - z3 = whatever * (ne) + (ne rotated -90) * thickness;
649 x1 = charwd / 2 - .5 pen_thick#;
651 + thick / 2 * stafflinethickness# * (ne rotated -90);
653 % labels (1, 2, 3, 4, 5, 6);
655 nw = unitvector (z3 - z4);
657 up_dist = up * 0.5 pen_thick / cosd (angle (ne));
658 rt_dist = right * 0.5 pen_thick / sind (angle (ne));
659 nw_dist = (ne rotated 90) * 0.5 pen_thick;
660 ne_dist = (nw rotated -90) * 0.5 pen_thick;
666 x4 := hround (x4' + .5 pen_thick) - .5 pen_thick;
667 x5 := hfloor (x5' + xpart rt_dist) - xpart rt_dist;
668 y6 := vfloor (y6' + ypart up_dist) - ypart up_dist;
670 crz_out = (z6 + up_dist)
671 -- (z3 + nw_dist){ne}
673 .. (z3 + ne_dist){-nw}
674 -- (z4 + ne_dist){-nw}
676 .. (z4 - nw_dist){-ne}
678 crz_out := crz_out shifted (0, feta_shift)
679 -- reverse crz_out yscaled -1 shifted (0, -feta_eps);
681 -- reverse crz_out xscaled -1 shifted (-feta_eps, 0)
685 x4 := hround (x4' - xpart rt_dist) + xpart rt_dist;
686 x5 := hceiling (x5' - .5 pen_thick) + .5 pen_thick;
687 y6 := vfloor (y6' - .5 pen_thick) + .5 pen_thick;
689 crz_in = (bot z6){right}
690 .. (z6 - nw_dist){ne}
693 -- (z5 + nw_dist){-ne}
695 crz_in := crz_in shifted (0, feta_shift)
696 -- reverse crz_in yscaled -1 shifted (0, -feta_eps);
698 -- reverse crz_in xscaled -1 shifted (-feta_eps, 0)
703 currentpicture := currentpicture shifted (hround (w / 2), 0);
706 charwy := y1 + feta_shift;
708 z12 = (charwx * hppp, y1 * vppp);
714 fet_beginchar ("Whole Crossed notehead", "s0cross");
717 wid# := black_notehead_width# + 4 stafflinethickness#;
718 hei# := noteheight# + stafflinethickness#;
720 set_char_box (0, wid#, hei# / 2, hei# / 2);
724 draw_staff_if_debugging (-2, 2);
728 fet_beginchar ("Half Crossed notehead", "s1cross");
731 wid# := black_notehead_width# + 2 stafflinethickness#;
732 hei# := noteheight# + stafflinethickness# / 2;
734 set_char_box (0, wid#, hei# / 2, hei# / 2);
738 draw_staff_if_debugging (-2, 2);
742 fet_beginchar ("Crossed notehead", "s2cross");
743 wid# := black_notehead_width#;
745 set_char_box (0, wid#, hei# / 2, hei# / 2);
749 draw_staff_if_debugging (-2, 2);
753 fet_beginchar ("X-Circled notehead", "s2xcircle");
755 save cthick, cxd, cyd, dy;
757 wid# := black_notehead_width# * sqrt (sqrt2);
758 hei# := noteheight# * sqrt (sqrt2);
760 set_char_box (0, wid#, hei# / 2, hei# / 2);
762 d := d - feta_space_shift;
764 cthick# := (1.2 + 1/4) * stafflinethickness#;
765 define_blacker_pixels (cthick);
768 cyd := h + d - cthick / 2;
772 pickup pencircle scaled cthick;
774 fill fullcircle xscaled (cxd + cthick)
775 yscaled (cyd + cthick)
777 unfill fullcircle xscaled (cxd - cthick)
778 yscaled (cyd - cthick)
781 xpos := .5 cxd / sqrt2;
782 ypos := .5 cyd / sqrt2;
784 pickup penrazor scaled cthick rotated (angle (xpos, ypos) + 90);
785 draw (-xpos + w / 2, -ypos + dy)
786 -- (xpos + w / 2, ypos + dy);
788 pickup penrazor scaled cthick rotated (angle (xpos, -ypos) + 90);
789 draw (-xpos + w / 2, ypos + dy)
790 -- (xpos + w / 2, -ypos + dy);
795 z12 = (charwx * hppp, charwy * vppp);
798 draw_staff_if_debugging (-2, 2);
807 % Note: For whole and half notes, the `fill' curve (p_out) is offset from
808 % the points that specify the outer geometry, because we need to add
809 % the rounding. In contrast, the inner curve is not offset, because
810 % there is no rounding.
812 % This means that to get a line of thick_factor * pen_thickness,
813 % we need to offset the inner curve by
815 % (thick_factor - 0.5) * pen_thickness
819 % (2 * thick_factor - 1) * half_pen_thickness
821 save solfa_pen_thick;
822 solfa_pen_thick# = 1.3 stafflinethickness#;
823 define_blacker_pixels (solfa_pen_thick);
825 save solfa_pen_radius;
826 solfa_pen_radius = 0.5 solfa_pen_thick;
828 save solfa_base_notewidth;
829 solfa_base_notewidth# := black_notehead_width#;
831 solfa_whole_width := 1.0;
832 solfa_half_width := 1.0;
833 solfa_quarter_width := 1.0;
838 % Triangle with base parallel to staff lines.
841 def draw_do_head (expr width_factor, dir, thickness_factor) =
843 save left_dist, right_dist, bottom_dist;
845 pair left_dist, right_dist, bottom_dist;
847 set_char_box (0, width_factor * solfa_base_notewidth#,
848 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
850 bottom_thick_factor := 2 * thickness_factor - 1;
851 % no different thickness for left side if we want uniform thickness
852 if thickness_factor = 1:
853 left_thick_factor := 1;
855 left_thick_factor := 0.7 * bottom_thick_factor;
859 pen_radius := min (solfa_pen_radius,
860 (h + d) / (3 * (1 + bottom_thick_factor)));
862 pickup pencircle scaled (2 * pen_radius);
871 left_dist = (unitvector (z3 - z1) rotated 90) * pen_radius;
872 right_dist = (unitvector (z2 - z3) rotated 90) * pen_radius;
873 bottom_dist = (0,1) * pen_radius;
877 save point_a, point_b, point_c;
878 pair point_a, point_b, point_c;
880 pa := (z1 - left_thick_factor * left_dist)
881 -- (z3 - left_thick_factor * left_dist);
882 pb := (z1 + bottom_thick_factor * bottom_dist)
883 -- (z2 + bottom_thick_factor * bottom_dist);
884 pc := (z2 - right_dist)
885 -- (z3 - right_dist);
887 point_a := pa intersectionpoint pb;
888 point_b := pb intersectionpoint pc;
889 point_c := pc intersectionpoint pa;
899 .. (z2 + right_dist){z3 - z2}
900 -- (z3 + right_dist){z3 - z2}
902 .. (z3 + left_dist){z1 - z3}
903 -- (z1 + left_dist){z1 - z3}
910 charwy := -chardp + 0.5 stafflinethickness#;
920 fet_beginchar ("Whole dohead", "s0do");
921 draw_do_head (solfa_whole_width, 1, do_weight);
927 fet_beginchar ("Half dohead", "d1do");
928 draw_do_head (solfa_half_width, -1, do_weight);
934 fet_beginchar ("Half dohead", "u1do");
935 draw_do_head (solfa_half_width, 1, do_weight);
941 fet_beginchar ("Quarter dohead", "d2do");
942 draw_do_head (solfa_quarter_width, -1, do_weight);
947 fet_beginchar ("Quarter dohead", "u2do");
948 draw_do_head (solfa_quarter_width, 1, do_weight);
953 fet_beginchar ("Whole thin dohead", "s0doThin");
954 draw_do_head (solfa_whole_width, 1, 1);
960 fet_beginchar ("Half thin dohead", "d1doThin");
961 draw_do_head (solfa_half_width, -1, 1);
967 fet_beginchar ("Half thin dohead", "u1doThin");
968 draw_do_head (solfa_half_width, 1, 1);
974 fet_beginchar ("Quarter thin dohead", "d2doThin");
975 draw_do_head (solfa_quarter_width, -1, 1);
980 fet_beginchar ("Quarter thin dohead", "u2doThin");
981 draw_do_head (solfa_quarter_width, 1, 1);
987 % re - flat top, curved bottom:
991 % .. {dir 90} (w,h/2)
994 % (broader along the base and with more vertical sides for half and
997 % Note: According to some shape-note singers, there should be no size
998 % differences for half and whole notes, contrary to the comment above.
999 % Consequently, we have made them all the same width.
1001 % stem attachment: h/2
1003 def draw_re_head (expr width_factor, dir, thickness_factor) =
1007 set_char_box (0, width_factor * solfa_base_notewidth#,
1008 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1011 offset = (2 * thickness_factor - 1);
1018 pen_radius := min (solfa_pen_radius,
1019 (h + d) * (1-curve_start) / (1+ offset));
1021 pickup pencircle scaled (2 * pen_radius);
1026 y2 = curve_start [y3, y1];
1034 labels (range 1 thru 5);
1036 p_in := (z1 + pen_radius * (1, -1 * offset))
1038 .. ((top z3) + (0, offset * pen_radius))
1040 -- (z5 + pen_radius * (-1, -1 * offset))
1053 charwy := curve_start [-chardp, charht];
1064 fet_beginchar ("Whole rehead", "s0re");
1065 draw_re_head (solfa_whole_width, 1, re_weight);
1071 fet_beginchar ("Half up rehead", "u1re");
1072 draw_re_head (solfa_half_width, 1, re_weight);
1078 fet_beginchar ("Half down rehead", "d1re");
1079 draw_re_head (solfa_half_width, -1, re_weight);
1085 fet_beginchar ("Quarter up rehead", "u2re");
1086 draw_re_head (solfa_quarter_width, 1, re_weight);
1091 fet_beginchar ("Quarter down rehead", "d2re");
1092 draw_re_head (solfa_quarter_width, -1, re_weight);
1097 fet_beginchar ("Whole thin rehead", "s0reThin");
1098 draw_re_head (solfa_whole_width, 1, 1);
1104 fet_beginchar ("Half up thin rehead", "u1reThin");
1105 draw_re_head (solfa_half_width, 1, 1);
1111 fet_beginchar ("Half down thin rehead", "d1reThin");
1112 draw_re_head (solfa_half_width, -1, 1);
1118 fet_beginchar ("Quarter thin rehead", "u2reThin");
1119 draw_re_head (solfa_quarter_width, 1, 1);
1124 fet_beginchar ("Quarter thin rehead", "d2reThin");
1125 draw_re_head (solfa_quarter_width, -1, 1);
1130 %%%% mi head -- diamond shape
1132 % two versions, depending on whether the `strong' lines are on the nw & se
1135 def draw_mi_head (expr width_factor, thickness_factor, mirror) =
1136 save path_out, path_in;
1137 save ne_dist, se_dist, ne, se;
1138 save path_a, path_b, path_c, path_d;
1139 path path_out, path_in;
1140 pair ne_dist, se_dist, ne, se;
1141 path path_a, path_b, path_c, path_d;
1145 set_char_box (0, width_factor * solfa_base_notewidth#,
1146 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1149 offset := 2 * thickness_factor - 1;
1153 note_diagonal := w / 2 ++ (h + d) / 2;
1157 pen_radius := min (solfa_pen_radius,
1158 .3 * note_diagonal / (1 + offset));
1160 pickup pencircle scaled (2 * pen_radius);
1171 % inner sides are parallel to outer sides
1172 z6 - z5 = whatever * (z2 - z1);
1173 z8 - z7 = whatever * (z4 - z3);
1174 z8 - z5 = whatever * (z4 - z1);
1175 z7 - z6 = whatever * (z3 - z2);
1177 ne = unitvector (z4 - z1);
1178 se = unitvector (z2 - z1);
1180 ne_dist = (ne rotated 90) * pen_radius;
1181 se_dist = (se rotated 90) * pen_radius;
1183 path_a := (z1 + se_dist)
1185 path_b := (z2 + (ne_dist * offset))
1186 -- (z3 + (ne_dist * offset));
1187 path_c := (z3 - se_dist)
1189 path_d := (z4 - (ne_dist * offset))
1190 -- (z1 - (ne_dist * offset));
1192 z5 = path_a intersectionpoint path_d;
1193 z7 = path_b intersectionpoint path_c;
1195 labels (range 1 thru 8);
1204 path_in := inner_path;
1206 path_in := inner_path reflectedabout (z2, z4);
1209 path_out := lft z1 {down}
1210 .. (z1 - se_dist){se}
1211 -- (z2 - se_dist){se}
1213 .. (z2 - ne_dist){ne}
1214 -- (z3 - ne_dist){ne}
1216 .. (z3 + se_dist){-se}
1217 -- (z4 + se_dist){-se}
1219 .. (z4 + ne_dist){-ne}
1220 -- (z1 + ne_dist){-ne}
1228 fet_beginchar ("Whole mihead", "s0mi");
1229 draw_mi_head (solfa_whole_width, mi_weight, false);
1235 fet_beginchar ("Half mihead", "s1mi");
1236 draw_mi_head (solfa_quarter_width, mi_weight, false);
1242 fet_beginchar ("Quarter mihead", "s2mi");
1243 draw_mi_head (solfa_quarter_width, mi_weight, false);
1248 fet_beginchar ("Whole mirror mihead", "s0miMirror");
1249 draw_mi_head (solfa_whole_width, mi_weight, true);
1255 fet_beginchar ("Half mirror mihead", "s1miMirror");
1256 draw_mi_head (solfa_quarter_width, mi_weight, true);
1262 fet_beginchar ("Quarter mirror mihead", "s2miMirror");
1263 draw_mi_head (solfa_quarter_width, mi_weight, true);
1268 fet_beginchar ("Whole thin mihead", "s0miThin");
1269 draw_mi_head (solfa_whole_width, 1, false);
1275 fet_beginchar ("Half thin mihead", "s1miThin");
1276 draw_mi_head (solfa_quarter_width, 1, false);
1282 fet_beginchar ("Quarter thin mihead", "s2miThin");
1283 draw_mi_head (solfa_quarter_width, 1, false);
1290 % Right triangle, hypotenuse from nw to se corner. Stem attaches on
1291 % vertical side in direction of horizontal side.
1293 def draw_fa_head (expr width_factor, thickness_factor) =
1294 set_char_box (0, width_factor * solfa_base_notewidth#,
1295 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1297 save p_down_in, p_down_out, p_up_in, p_up_out, nw_dist, nw;
1298 path p_down_in, p_down_out, p_up_in, p_up_out;
1299 save path_a, path_b, path_c;
1300 path path_a, path_b, path_c;
1304 offset := 2 * thickness_factor - 1;
1307 pen_radius := min (solfa_pen_radius,
1308 .33 * (h + d) / (1 + offset));
1310 pickup pencircle scaled (2 * pen_radius);
1323 labels (1, 2, 3, 4);
1325 nw = unitvector (z1 - z3);
1326 nw_dist = (nw rotated 90) * pen_radius;
1328 path_a := (z1 - (0,1) * offset * pen_radius)
1329 -- (z2 - (0,1) * offset * pen_radius);
1330 path_b := (z2 - (1,0) * pen_radius)
1331 -- (z3 - (1,0) * pen_radius);
1332 path_c := (z3 - nw_dist)
1335 p_up_in := (path_a intersectionpoint path_b)
1336 -- (path_b intersectionpoint path_c)
1337 -- (path_c intersectionpoint path_a)
1340 p_up_out := lft z1{down}
1341 .. (z1 + nw_dist){-nw}
1342 -- (z3 + nw_dist){-nw}
1350 p_down_in := p_up_in rotated 180 shifted (w, 0);
1351 p_down_out := p_up_out rotated 180 shifted (w, 0);
1360 fet_beginchar ("Whole fa up head", "u0fa");
1361 draw_fa_head (solfa_whole_width, fa_weight);
1367 fet_beginchar ("Whole fa down head", "d0fa");
1368 draw_fa_head (solfa_whole_width, fa_weight);
1374 fet_beginchar ("half fa up head", "u1fa");
1375 draw_fa_head (solfa_half_width, fa_weight);
1381 fet_beginchar ("Half fa down head", "d1fa");
1382 draw_fa_head (solfa_half_width, fa_weight);
1388 fet_beginchar ("Quarter fa up head", "u2fa");
1389 draw_fa_head (solfa_quarter_width, fa_weight);
1394 fet_beginchar ("Quarter fa down head", "d2fa");
1395 draw_fa_head (solfa_quarter_width, fa_weight);
1400 fet_beginchar ("Whole thin fa up head", "u0faThin");
1401 draw_fa_head (solfa_whole_width, 1);
1407 fet_beginchar ("Whole thin fa down head", "d0faThin");
1408 draw_fa_head (solfa_whole_width, 1);
1414 fet_beginchar ("half thin fa up head", "u1faThin");
1415 draw_fa_head (solfa_half_width, 1);
1421 fet_beginchar ("Half thin fa down head", "d1faThin");
1422 draw_fa_head (solfa_half_width, 1);
1428 fet_beginchar ("Quarter thin fa up head", "u2faThin");
1429 draw_fa_head (solfa_quarter_width, 1);
1434 fet_beginchar ("Quarter thin fa down head", "d2faThin");
1435 draw_fa_head (solfa_quarter_width, 1);
1443 % Note: sol head is the same shape as a standard music head, and doesn't
1444 % vary from style to style. However, width is constant with duration,
1445 % so we can't just use the standard note font.
1447 def draw_sol_head (expr filled) =
1448 draw_outside_ellipse (1.49 - puff_up_factor / 3.0, 31, 0.707, 0);
1450 undraw_inside_ellipse (2.5 - puff_up_factor / 3.0, 31, 0.707,
1451 3.5 stafflinethickness#);
1453 draw_staff_if_debugging (-2, 2);
1456 fet_beginchar ("Whole solhead", "s0sol");
1457 draw_sol_head ( false);
1461 fet_beginchar ("Half solhead", "s1sol");
1462 draw_sol_head ( false);
1466 fet_beginchar ("Quarter solhead", "s2sol");
1467 draw_sol_head ( true);
1475 def draw_la_head (expr width_factor, thickness_factor) =
1476 set_char_box (0, width_factor * solfa_base_notewidth#,
1477 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1482 offset := 2 * thickness_factor - 1;
1485 pen_radius := min (solfa_pen_radius,
1486 .35 * (h + d) / (1 + offset));
1488 pickup pencircle scaled (2 * pen_radius);
1501 labels (range 1 thru 4);
1503 p_in := (z1 + pen_radius * (1, -offset))
1504 -- (z2 + pen_radius * (-1, -offset))
1505 -- (z3 + pen_radius * (-1, offset))
1506 -- (z4 + pen_radius * (1, offset))
1524 fet_beginchar ("Whole lahead", "s0la");
1525 draw_la_head (solfa_whole_width, la_weight);
1531 fet_beginchar ("Half lahead", "s1la");
1532 draw_la_head (solfa_half_width, la_weight);
1538 fet_beginchar ("Quarter lahead", "s2la");
1539 draw_la_head (solfa_quarter_width, la_weight);
1544 fet_beginchar ("Whole thin lahead", "s0laThin");
1545 draw_la_head (solfa_whole_width, 1);
1551 fet_beginchar ("Half thin lahead", "s1laThin");
1552 draw_la_head (solfa_half_width, 1);
1558 fet_beginchar ("Quarter lahead", "s2laThin");
1559 draw_la_head (solfa_quarter_width, 1);
1566 % `Snow-cone', V with rounded top.
1568 def draw_ti_head (expr width_factor, dir, thickness_factor) =
1569 set_char_box (0, width_factor * solfa_base_notewidth#,
1570 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1571 save p_in, p_out, p_top, p_top_in;
1572 path p_in, p_out, p_top, p_top_in;
1577 offset := 2 * thickness_factor - 1;
1580 pen_radius := min (solfa_pen_radius,
1581 .4 * (h + d) / (1 + offset));
1583 pickup pencircle scaled (2 * pen_radius);
1588 y2 = cone_height [y1, y3];
1594 y5 = y1 + offset * pen_radius;
1596 labels (range 1 thru 4);
1598 save nw_dist, sw_dist, nw, sw;
1599 pair nw_dist, sw_dist, nw, sw;
1601 nw = unitvector (z2 - z1);
1602 sw = unitvector (z1 - z4);
1604 nw_dist = (nw rotated 90) * pen_radius;
1605 sw_dist = (sw rotated 90) * pen_radius;
1607 p_top := (z2 + nw * pen_radius)
1609 .. (z4 - sw * pen_radius);
1611 p_top_in := (z2 - nw * offset * pen_radius)
1612 .. (z3 - (0,1) * pen_radius) {right}
1613 .. (z4 + sw * offset * pen_radius);
1615 save path_a, path_b;
1616 path path_a, path_b;
1622 z6 = path_a intersectionpoint p_top_in;
1623 z7 = path_b intersectionpoint p_top_in;
1635 .. (z2 + nw * pen_radius){direction 0 of p_top}
1637 & {direction infinity of p_top}(z4 - sw * pen_radius)
1644 charwy := cone_height [-chardp, charht];
1654 fet_beginchar ("Whole up tihead", "s0ti");
1655 draw_ti_head (solfa_whole_width, 1, ti_weight);
1661 fet_beginchar ("Half up tihead", "u1ti");
1662 draw_ti_head (solfa_half_width, 1, ti_weight);
1668 fet_beginchar ("Half down tihead", "d1ti");
1669 draw_ti_head (solfa_half_width, -1, ti_weight);
1675 fet_beginchar ("Quarter up tihead", "u2ti");
1676 draw_ti_head (solfa_quarter_width, 1, ti_weight);
1681 fet_beginchar ("Quarter down tihead", "d2ti");
1682 draw_ti_head (solfa_quarter_width, -1, ti_weight);
1687 fet_beginchar ("Whole thin up tihead", "s0tiThin");
1688 draw_ti_head (solfa_whole_width, 1, 1);
1694 fet_beginchar ("Half thin up tihead", "u1tiThin");
1695 draw_ti_head (solfa_half_width, 1, 1);
1701 fet_beginchar ("Half thin down tihead", "d1tiThin");
1702 draw_ti_head (solfa_half_width, -1, 1);
1708 fet_beginchar ("Quarter thin up tihead", "u2tiThin");
1709 draw_ti_head (solfa_quarter_width, 1, 1);
1714 fet_beginchar ("Quarter thin down tihead", "d2tiThin");
1715 draw_ti_head (solfa_quarter_width, -1, 1);
1720 %%%%%% Funk shape note heads
1722 % Funk heads are narrower than Aiken and Sacred Harp, so we need a new
1725 funk_notehead_width := 0.75;
1729 % Parabolic on one side, vertical line on other
1730 % Has up and down shapes for *all* notes
1732 def draw_Funk_do_head (expr width_factor, thickness_factor) =
1733 set_char_box (0, width_factor * solfa_base_notewidth#,
1734 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1737 offset := 2 * thickness_factor - 1;
1740 pen_radius := min (solfa_pen_radius,
1741 .3 * (h + d) / (1 + offset));
1743 pickup pencircle scaled (2 * pen_radius);
1754 x4 = x1 - pen_radius;
1755 y4 = y1 + offset * pen_radius;
1758 x5 = x2 + pen_radius;
1761 y6 = y3 - offset * pen_radius;
1763 save p_up_in, p_up_out, p_down_in, p_down_out;
1764 path p_up_in, p_up_out, p_down_in, p_down_out;
1766 p_down_in := z4{left}
1771 p_down_out := bot z1{left}
1778 p_up_in := p_down_in rotated 180 shifted (w,0);
1779 p_up_out := p_down_out rotated 180 shifted (w,0);
1784 save funk_do_weight;
1785 funk_do_weight := 1.7;
1787 fet_beginchar ("Whole up Funk dohead", "u0doFunk");
1788 draw_Funk_do_head (funk_notehead_width, funk_do_weight);
1794 fet_beginchar ("Whole down Funk dohead", "d0doFunk");
1795 draw_Funk_do_head (funk_notehead_width, funk_do_weight);
1801 fet_beginchar ("Half up Funk dohead", "u1doFunk");
1802 draw_Funk_do_head (funk_notehead_width, funk_do_weight);
1808 fet_beginchar ("Half down Funk dohead", "d1doFunk");
1809 draw_Funk_do_head (funk_notehead_width, funk_do_weight);
1815 fet_beginchar ("Quarter up Funk dohead", "u2doFunk");
1816 draw_Funk_do_head (funk_notehead_width, funk_do_weight);
1821 fet_beginchar ("Quarter down Funk dohead", "d2doFunk");
1822 draw_Funk_do_head (funk_notehead_width, funk_do_weight);
1829 % Has up and down shapes for *all* notes
1831 def draw_Funk_re_head (expr width_factor, thickness_factor) =
1832 set_char_box (0, width_factor * solfa_base_notewidth#,
1833 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1836 offset := 2 * thickness_factor - 1;
1839 pen_radius := min (solfa_pen_radius,
1840 .3 * (h + d) / (1 + offset));
1842 pickup pencircle scaled (2 * pen_radius);
1853 x3 := curve_in [x1, x2];
1861 save ne, se, ne_perp, se_perp;
1862 pair ne, se, ne_perp, se_perp;
1864 ne := unitvector (z2 - z1);
1865 se := unitvector (z4 - z1);
1866 ne_perp := ne rotated 90;
1867 se_perp := se rotated 90;
1869 save path_a, path_b, path_c, path_d;
1870 path path_a, path_b, path_c, path_d;
1871 save arrow_a_perp, arrow_b_perp;
1872 pair arrow_a_perp, arrow_b_perp;
1875 path_d := z2 .. z3{down} .. z4;
1876 arrow_a_perp = unitvector (direction 0 of path_d rotated 90)
1878 arrow_b_perp = unitvector (direction 2 of path_d rotated 90)
1881 path_b := (z1 + se_perp * pen_radius)
1882 -- z4 + se_perp * offset * pen_radius;
1883 path_a := (z1 - ne_perp * pen_radius)
1884 -- z2 - ne_perp * offset * pen_radius;
1885 path_c := z2 - arrow_a_perp
1887 .. z4 - arrow_b_perp;
1889 z5 = path_a intersectionpoint path_b;
1890 z7 = path_a intersectionpoint path_c;
1891 z8 = path_b intersectionpoint path_c;
1893 save p_up_in, p_down_in, p_up_out, p_down_out;
1894 path p_up_in, p_down_in, p_up_out, p_down_out;
1902 p_down_out := lft z1{up}
1903 .. (z1 + ne_perp * pen_radius){ne}
1904 -- (z2 + ne_perp * pen_radius){ne}
1907 .. (z2 + arrow_a_perp)
1909 .. (z4 + arrow_b_perp)
1912 .. z4 - se_perp * pen_radius
1913 -- z1 - se_perp * pen_radius
1916 p_up_in := p_down_in rotated 180 shifted (w, 0);
1917 p_up_out := p_down_out rotated 180 shifted (w, 0);
1922 save funk_re_weight;
1923 funk_re_weight = 1.7;
1925 fet_beginchar ("Whole up Funk rehead", "u0reFunk");
1926 draw_Funk_re_head (funk_notehead_width, funk_re_weight);
1932 fet_beginchar ("Whole down Funk rehead", "d0reFunk");
1933 draw_Funk_re_head (funk_notehead_width, funk_re_weight);
1939 fet_beginchar ("Half up Funk rehead", "u1reFunk");
1940 draw_Funk_re_head (funk_notehead_width, funk_re_weight);
1946 fet_beginchar ("Half down Funk rehead", "d1reFunk");
1947 draw_Funk_re_head (funk_notehead_width, funk_re_weight);
1953 fet_beginchar ("Quarter up Funk rehead", "u2reFunk");
1954 draw_Funk_re_head (funk_notehead_width, funk_re_weight);
1959 fet_beginchar ("Quarter down Funk rehead", "d2reFunk");
1960 draw_Funk_re_head (funk_notehead_width, funk_re_weight);
1967 % Has up and down shapes for all hollow notes
1969 save funk_mi_weight;
1970 funk_mi_weight := 1.9;
1972 fet_beginchar ("Whole up Funk mihead", "u0miFunk");
1973 draw_mi_head (funk_notehead_width,
1974 funk_mi_weight, false);
1980 fet_beginchar ("Whole down Funk mihead", "d0miFunk");
1981 draw_mi_head (funk_notehead_width,
1982 funk_mi_weight, true);
1988 fet_beginchar ("Half up Funk mihead", "u1miFunk");
1989 draw_mi_head (funk_notehead_width,
1990 funk_mi_weight, false);
1996 fet_beginchar ("Half down Funk mihead", "d1miFunk");
1997 draw_mi_head (funk_notehead_width,
1998 funk_mi_weight, true);
2004 fet_beginchar ("Quarter Funk mihead", "s2miFunk");
2005 draw_mi_head (funk_notehead_width,
2006 funk_mi_weight, false);
2013 % Does it rotate for whole notes?
2014 % Same as other shape note systems
2015 % Need special notes because of special width
2017 save funk_fa_weight;
2018 funk_fa_weight := 1.9;
2020 fet_beginchar ("Whole up Funk fahead", "u0faFunk");
2021 draw_fa_head (funk_notehead_width, funk_fa_weight);
2027 fet_beginchar ("Whole down Funk fahead", "d0faFunk");
2028 draw_fa_head (funk_notehead_width, funk_fa_weight);
2034 fet_beginchar ("Half up Funk fahead", "u1faFunk");
2035 draw_fa_head (funk_notehead_width, funk_fa_weight);
2041 fet_beginchar ("Half down Funk fahead", "d1faFunk");
2042 draw_fa_head (funk_notehead_width, funk_fa_weight);
2048 fet_beginchar ("Quarter up Funk fahead", "u2faFunk");
2049 draw_fa_head (funk_notehead_width, funk_fa_weight);
2054 fet_beginchar ("Quarter down Funk fahead", "d2faFunk");
2055 draw_fa_head (funk_notehead_width, funk_fa_weight);
2060 %%%%%% Funk sol head is the same as the others
2061 % Need special character because of skinnier head
2063 def draw_Funk_sol_head (expr filled) =
2066 noteheight# := solfa_noteheight#;
2067 draw_outside_ellipse (1.2, 34, 0.71, 0.);
2069 undraw_inside_ellipse (1.9, 33, 0.74, 5.5 stafflinethickness#);
2071 draw_staff_if_debugging (-2, 2);
2076 fet_beginchar ("Whole Funk solhead", "s0solFunk");
2077 draw_Funk_sol_head ( false);
2081 fet_beginchar ("Half Funk solhead", "s1solFunk");
2082 draw_Funk_sol_head ( false);
2086 fet_beginchar ("Quarter Funk solhead", "s2solFunk");
2087 draw_Funk_sol_head ( true);
2093 % Same as for other shape notes
2094 % Smaller width requires special characters
2096 save funk_la_weight;
2097 funk_la_weight := 1.9;
2099 fet_beginchar ("Whole Funk lahead", "s0laFunk");
2100 draw_la_head (funk_notehead_width, funk_notehead_width);
2106 fet_beginchar ("Half Funk lahead", "s1laFunk");
2107 draw_la_head (funk_notehead_width, funk_notehead_width);
2113 fet_beginchar ("Quarter Funk lahead", "s2laFunk");
2114 draw_la_head (funk_notehead_width, funk_notehead_width);
2120 % `Sideways snow cone'.
2121 % Rotates for all notes.
2123 def draw_Funk_ti_head (expr width_factor, thickness_factor) =
2124 set_char_box (0, width_factor * solfa_base_notewidth#,
2125 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
2130 offset := 2 * thickness_factor - 1;
2133 pen_radius := min (solfa_pen_radius,
2134 .33 * (h + d) / (1 + offset));
2136 pickup pencircle scaled (2 * pen_radius);
2141 x2 = cone_width [x1, x3];
2150 save nw_dist, sw_dist, ne, se;
2151 pair nw_dist, sw_dist, ne, se;
2153 ne = unitvector (z2 - z1);
2154 se = unitvector (z4 - z1);
2156 nw_dist = (ne rotated 90) * pen_radius ;
2157 sw_dist = (se rotated -90) * pen_radius;
2159 save path_a, path_b;
2160 path path_a, path_b;
2161 path_a := z1 - nw_dist
2162 -- z2 - offset * nw_dist;
2163 path_b := z1 - sw_dist
2164 -- z4 - offset * sw_dist;
2166 save path_right, path_right_in;
2167 path path_right, path_right_in;
2168 path_right := (z2 + ne * pen_radius)
2170 .. (z4 + se * pen_radius);
2172 path_right_in := (z2 - ne * pen_radius)
2174 .. (z4 - se * pen_radius);
2176 z5 = path_a intersectionpoint path_b;
2177 z6 = path_a intersectionpoint path_right_in;
2178 z7 = path_b intersectionpoint path_right_in;
2180 save p_up_in, p_down_in, p_up_out, p_down_out;
2181 path p_up_in, p_down_in, p_up_out, p_down_out;
2189 p_down_out := lft z1
2193 .. (z2 + ne * pen_radius){direction 0 of path_right}
2195 & {direction infinity of path_right}(z4 + se * pen_radius)
2201 p_up_in := p_down_in rotated 180 shifted (w, 0);
2202 p_up_out := p_down_out rotated 180 shifted (w, 0);
2206 save funk_ti_weight;
2207 funk_ti_weight := 1.6;
2209 fet_beginchar ("Whole up Funk tihead", "u0tiFunk");
2210 draw_Funk_ti_head (funk_notehead_width, funk_ti_weight);
2216 fet_beginchar ("Whole down Funk tihead", "d0tiFunk");
2217 draw_Funk_ti_head (funk_notehead_width, funk_ti_weight);
2223 fet_beginchar ("Half up Funk tihead", "u1tiFunk");
2224 draw_Funk_ti_head (funk_notehead_width, funk_ti_weight);
2230 fet_beginchar ("Half down Funk tihead", "d1tiFunk");
2231 draw_Funk_ti_head (funk_notehead_width, funk_ti_weight);
2237 fet_beginchar ("Quarter up Funk tihead", "u2tiFunk");
2238 draw_Funk_ti_head (funk_notehead_width, funk_ti_weight);
2243 fet_beginchar ("Quarter down Funk tihead", "d2tiFunk");
2244 draw_Funk_ti_head (funk_notehead_width, funk_ti_weight);
2249 %%%%%% Walker shape note heads
2251 % Walker heads are narrow like Funk heads, so use funk_notehead_width.
2254 %%%%%% Walker do head
2256 % Trapezoid, with largest side on stem side
2258 def draw_Walker_do_head (expr width_factor, dir, thickness_factor) =
2259 set_char_box (0, width_factor * solfa_base_notewidth#,
2260 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
2262 pickup pencircle scaled solfa_pen_thick;
2265 offset := 2 * thickness_factor - 1;
2267 % adjust width so stem can be centered
2268 if .5w <> good.x .5w: change_width; fi
2272 scaling# = charwd / w;
2277 x1 = inset [x4, x3];
2280 x2 = inset [x3, x4];
2289 labels (range 1 thru 4);
2291 save left_dir, left_perp, right_dir, right_perp;
2292 pair left_dir, left_perp, right_dir, right_perp;
2294 left_dir = unitvector(z1 - z4);
2295 left_perp = (left_dir rotated 90) * solfa_pen_radius;
2296 right_dir = unitvector(z3 - z2);
2297 right_perp = (right_dir rotated 90) * solfa_pen_radius;
2299 save path_a, path_b, path_c, path_d;
2300 path path_a, path_b, path_c, path_d;
2302 path_a := (z4 - left_perp)
2303 -- (z1 - left_perp);
2304 path_b := (z1 - (0, offset*solfa_pen_radius))
2305 -- (z2 - (0, offset*solfa_pen_radius));
2306 path_c := (z2 - right_perp)
2307 -- (z3 - right_perp);
2308 path_d := (z3 + (0, offset*solfa_pen_radius))
2309 -- (z4 + (0, offset*solfa_pen_radius));
2314 p_in := (path_a intersectionpoint path_b)
2315 -- (path_b intersectionpoint path_c)
2316 -- (path_c intersectionpoint path_d)
2317 -- (path_d intersectionpoint path_a)
2320 p_out := top z1{right}
2322 .. z2 + right_perp {right_dir}
2323 -- z3 + right_perp {right_dir}
2326 .. z4 + left_perp {left_dir}
2327 .. z1 + left_perp {left_dir}
2330 charwx := scaling# * (w/2 + solfa_pen_radius);
2331 charwy := scaling# * y2 ;
2334 p_in := p_in rotated 180 shifted (w,0);
2335 p_out := p_out rotated 180 shifted (w,0);
2340 save walker_do_weight;
2341 walker_do_weight := 1.5;
2343 fet_beginchar ("Whole Walker dohead", "s0doWalker");
2344 draw_Walker_do_head (funk_notehead_width, 0, walker_do_weight);
2350 fet_beginchar ("Half up Walker dohead", "u1doWalker");
2351 draw_Walker_do_head (funk_notehead_width, 1, walker_do_weight);
2357 fet_beginchar ("Half down Walker dohead", "d1doWalker");
2358 draw_Walker_do_head (funk_notehead_width, 0, walker_do_weight);
2364 fet_beginchar ("Quarter up Walker dohead", "u2doWalker");
2365 draw_Walker_do_head (funk_notehead_width, 1, walker_do_weight);
2370 fet_beginchar ("Quarter down Walker dohead", "d2doWalker");
2371 draw_Walker_do_head (funk_notehead_width, 0, walker_do_weight);
2376 %%%%%% Walker re head
2377 % Parabolic on one side, shallow parabola on other
2378 % Has up and down shapes for *all* notes
2380 def draw_Walker_re_head (expr width_factor, thickness_factor) =
2381 set_char_box (0, width_factor * solfa_base_notewidth#,
2382 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
2385 offset := 2 * thickness_factor - 1;
2388 pen_radius := min (solfa_pen_radius,
2389 .3 * (h + d) / (1 + offset));
2391 pickup pencircle scaled (2 * pen_radius);
2394 dish_factor := 0.20;
2405 x4 = dish_factor [x1, x2];
2409 y5 = y1 + offset * pen_radius;
2412 x6 = x2 + pen_radius;
2415 y7 = y3 - offset * pen_radius;
2418 x8 = x4 - pen_radius;
2420 save path_a, path_d;
2421 path path_a, path_d;
2423 save p_a_start_dir, p_a_end_dir, p_a_start_perp, p_a_end_perp;
2424 pair p_a_start_dir, p_a_end_dir, p_a_start_perp, p_a_end_perp;
2426 path_a := z3 .. z4{down} .. z1;
2428 p_a_start_dir := unitvector(direction 0 of path_a);
2429 p_a_end_dir := unitvector(direction infinity of path_a);
2430 p_a_start_perp := (p_a_start_dir rotated 90) * pen_radius;
2431 p_a_end_perp := (p_a_end_dir rotated 90) * pen_radius;
2433 path_d := (z3 - p_a_start_perp){p_a_start_dir}
2435 ..(z1 - p_a_end_perp){p_a_end_dir};
2437 save path_b, path_c;
2438 path path_b, path_c;
2440 path_b := z5 {left} .. z6{up};
2441 path_c := z7 {left} .. z6{down};
2443 z9 = path_d intersectionpoint path_b;
2444 z10 = path_d intersectionpoint path_c;
2446 labels (range 1 thru 4);
2448 save p_up_in, p_up_out, p_down_in, p_down_out;
2449 path p_up_in, p_up_out, p_down_in, p_down_out;
2452 ... {right} z10 {p_a_start_dir}
2454 .. {p_a_end_dir} z9 {left}
2457 p_down_out := lft z2{up}
2460 .. (z3 + p_a_start_perp){p_a_start_dir}
2462 .. (z1 + p_a_end_perp) {p_a_end_dir}
2467 p_up_in := p_down_in rotated 180 shifted (w,0);
2468 p_up_out := p_down_out rotated 180 shifted (w,0);
2472 save walker_re_weight;
2473 walker_re_weight := 1.2;
2475 fet_beginchar ("Whole Walker rehead", "s0reWalker");
2476 draw_Walker_re_head (funk_notehead_width, walker_re_weight);
2482 fet_beginchar ("Half up Walker rehead", "u1reWalker");
2483 draw_Walker_re_head (funk_notehead_width, walker_re_weight);
2489 fet_beginchar ("Half down Walker rehead", "d1reWalker");
2490 draw_Walker_re_head (funk_notehead_width, walker_re_weight);
2496 fet_beginchar ("Quarter up Walker rehead", "u2reWalker");
2497 draw_Walker_re_head (funk_notehead_width, walker_re_weight);
2502 fet_beginchar ("Quarter down Walker rehead", "d2reWalker");
2503 draw_Walker_re_head (funk_notehead_width, walker_re_weight);
2508 %%%%%% Walker mi head
2510 % Symmetric for all hollow notes
2512 save walker_mi_width, walker_mi_weight;
2513 walker_mi_width := 1;
2514 walker_mi_weight := 1.5;
2516 fet_beginchar ("Whole Walker mihead", "s0miWalker");
2517 draw_mi_head (walker_mi_width * funk_notehead_width,
2518 walker_mi_weight, true);
2524 fet_beginchar ("Half Walker mihead", "s1miWalker");
2525 draw_mi_head (walker_mi_width * funk_notehead_width,
2526 walker_mi_weight, true);
2532 fet_beginchar ("Quarter Walker mihead", "s2miWalker");
2533 draw_mi_head (walker_mi_width * funk_notehead_width,
2534 walker_mi_weight, true);
2541 % Does not rotate for whole notes
2542 % Whole rotation is different from Funk, so special notes
2544 %%%%%% Funk sol head is the same as the others
2545 % Need special character because of skinnier head
2547 save walker_fa_weight;
2548 walker_fa_weight := 1.5;
2550 fet_beginchar ("Whole Walker fahead", "s0faWalker");
2551 draw_fa_head (funk_notehead_width, walker_fa_weight);
2557 fet_beginchar ("Half up Walker fahead", "u1faWalker");
2558 draw_fa_head (funk_notehead_width, walker_fa_weight);
2564 fet_beginchar ("Half down Walker fahead", "d1faWalker");
2565 draw_fa_head (funk_notehead_width, walker_fa_weight);
2571 fet_beginchar ("Quarter up Walker fahead", "u2faWalker");
2572 draw_fa_head (funk_notehead_width, walker_fa_weight);
2577 fet_beginchar ("Quarter down Walker fahead", "d2faWalker");
2578 draw_fa_head (funk_notehead_width, walker_fa_weight);
2584 % Same as Funk, no special notes
2587 %%%%%% Walker la head
2589 % Lighter weight requires separate notes
2591 save walker_la_weight;
2592 walker_la_weight := 1.5;
2594 fet_beginchar ("Whole Walker lahead", "s0laWalker");
2595 draw_la_head (funk_notehead_width, walker_la_weight);
2601 fet_beginchar ("Half Funk lahead", "s1laWalker");
2602 draw_la_head (funk_notehead_width, walker_la_weight);
2608 fet_beginchar ("Quarter Funk lahead", "s2laWalker");
2609 draw_la_head (funk_notehead_width, walker_la_weight);
2614 %%%%%% Walker ti head
2615 % Triangular arrowhead
2616 % Rotates for all but whole notes
2618 def draw_Walker_ti_head (expr width_factor, thickness_factor) =
2619 set_char_box (0, width_factor * solfa_base_notewidth#,
2620 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
2623 offset := 2 * thickness_factor - 1;
2626 pen_radius := min (solfa_pen_radius,
2627 .3 * (h + d) / (1 + offset));
2629 pickup pencircle scaled (2 * pen_radius);
2641 labels (range 1 thru 4);
2643 save nw_dist, sw_dist, ne, se;
2644 pair nw_dist, sw_dist, ne, se;
2646 ne = unitvector (z2 - z1);
2647 se = unitvector (z3 - z1);
2649 nw_dist = (ne rotated 90) * pen_radius ;
2650 sw_dist = (se rotated -90) * pen_radius;
2653 save path_a, path_b, path_c;
2654 path path_a, path_b, path_c;
2655 path_a := z2 - nw_dist * offset
2656 -- z1 - nw_dist * offset;
2657 path_b := z3 - sw_dist * offset
2658 -- z1 - sw_dist * offset;
2659 path_c := z2 + left * pen_radius
2660 -- z3 + left * pen_radius;
2662 z4 = path_a intersectionpoint path_b;
2663 z5 = path_a intersectionpoint path_c;
2664 z6 = path_b intersectionpoint path_c;
2666 save p_up_in, p_down_in, p_up_out, p_down_out;
2667 path p_up_in, p_down_in, p_up_out, p_down_out;
2674 p_down_out := lft z1{up}
2675 .. (z1 + nw_dist){ne}
2676 -- (z2 + nw_dist){ne}
2681 .. (z3 + sw_dist){- se}
2682 .. (z1 + sw_dist){- se}
2685 p_up_in := p_down_in rotated 180 shifted (w, 0);
2686 p_up_out := p_down_out rotated 180 shifted (w, 0);
2690 save walker_ti_weight;
2691 walker_ti_weight := 1.4;
2693 fet_beginchar ("Whole Walker tihead", "s0tiWalker");
2694 draw_Walker_ti_head (funk_notehead_width, walker_ti_weight);
2700 fet_beginchar ("Half up Walker tihead", "u1tiWalker");
2701 draw_Walker_ti_head (funk_notehead_width, walker_ti_weight);
2707 fet_beginchar ("Half down Walker tihead", "d1tiWalker");
2708 draw_Walker_ti_head (funk_notehead_width, walker_ti_weight);
2714 fet_beginchar ("Quarter up Walker tihead", "u2tiWalker");
2715 draw_Walker_ti_head (funk_notehead_width, walker_ti_weight);
2720 fet_beginchar ("Quarter down Walker tihead", "d2tiWalker");
2721 draw_Walker_ti_head (funk_notehead_width, walker_ti_weight);
2725 fet_endgroup ("noteheads");
2729 % we derive black_notehead_width# from the quarter head,
2730 % so we have to define black_notehead_width (pixel qty)
2731 % after the black_notehead_width# itself.
2733 % Let's keep it outside the group as well.
2736 define_pixels (black_notehead_width);