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--2011 Jan Nieuwenhuizen <janneke@gnu.org>
5 % & Han-Wen Nienhuys <hanwen@xs4all.nl>
6 % & Juergen Reuter <reuter@ipd.uka.de>
9 % LilyPond is free software: you can redistribute it and/or modify
10 % it under the terms of the GNU General Public License as published by
11 % the Free Software Foundation, either version 3 of the License, or
12 % (at your option) any later version.
14 % LilyPond is distributed in the hope that it will be useful,
15 % but WITHOUT ANY WARRANTY; without even the implied warranty of
16 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 % GNU General Public License for more details.
19 % You should have received a copy of the GNU General Public License
20 % along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
29 % Most beautiful noteheads are pronounced, not circular,
30 % and not even symmetric.
31 % These examples are inspired by [Wanske]; see literature list.
35 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
37 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
39 save half_notehead_width, whole_notehead_width;
40 save solfa_noteheight;
42 numeric whole_notehead_width;
43 numeric half_notehead_width;
45 fet_begingroup ("noteheads");
49 % solfa heads should not overlap on chords.
51 solfa_noteheight# := staff_space# - stafflinethickness#;
53 def undraw_inside_ellipse (expr ellipticity, tilt, superness, clearance) =
58 pat := superellipse ((ellipticity, 0), (0, 1.0),
59 (-ellipticity, 0), (0, -1.0),
61 pat := pat rotated tilt;
63 save top_point, right_point;
64 pair top_point, right_point;
66 top_point := directionpoint left of pat;
67 right_point := directionpoint up of pat;
71 height# = staff_space# + stafflinethickness# - clearance;
72 scaling# = height# / (2 ypart (top_point));
73 define_pixels (scaling);
74 pat := pat scaled scaling shifted (w / 2, .5 (h - d));
86 % dimensions aren't entirely right.
88 def draw_longa (expr up) =
89 save stemthick, fudge;
91 stemthick# = 2 stafflinethickness#;
92 define_whole_blacker_pixels (stemthick);
94 fudge = hround (blot_diameter / 2);
96 draw_outside_ellipse (1.80, 0, 0.707, 0);
97 undraw_inside_ellipse (1.30, 125, 0.68, 2 stafflinethickness#);
99 pickup pencircle scaled stemthick;
109 top y4 = h + 3.0 staff_space;
112 bot y1 = -d - 3.0 staff_space;
123 draw_gridline (z1, z2, stemthick);
124 draw_gridline (z3, z4, stemthick);
130 fet_beginchar ("Longa notehead", "uM2");
133 draw_staff (-2, 2, 0);
137 fet_beginchar ("Longa notehead", "dM2");
140 draw_staff (-2, 2, 0);
145 fet_beginchar ("Longa notehead", "uM2");
148 draw_staff (-2, 2, 0.5);
152 fet_beginchar ("Longa notehead", "dM2");
155 draw_staff (-2, 2, 0.5);
160 def draw_brevis (expr linecount, line_thickness_multiplier) =
161 save stemthick, fudge;
163 stemthick# = line_thickness_multiplier * 2 * stafflinethickness#;
164 define_whole_blacker_pixels (stemthick);
166 % Breves of smaller design sizes should have their lines
167 % farther apart (the overlap should be smaller).
168 fudge = hround (blot_diameter
171 - (20 / (design_size + 4))
175 draw_outside_ellipse (1.80, 0, 0.707, 0);
176 undraw_inside_ellipse (1.30, 125, 0.68, 2 stafflinethickness#);
178 pickup pencircle scaled stemthick;
180 % Breves of smaller design sizes should have their lines longer.
181 line_length := min (max (0.7, (64/60 - (design_size / 60))), 0.85);
183 % Line lengths between 0.72 and 0.77 are not nice
184 % because they are neither separate nor connected
185 % when there is an interval of fourth.
186 if line_length < 0.75:
187 quanted_line_length := min (0.72, line_length);
189 quanted_line_length := max (0.77, line_length);
192 bot y1 = -quanted_line_length * staff_space;
193 top y2 = quanted_line_length * staff_space;
202 % Breves of smaller design sizes should have their lines
204 line_distance := (1.95 - 0.008 * design_size) * stemthick;
205 for i := 0 step 1 until linecount - 1:
206 draw_gridline (z1 - (i * line_distance, 0),
207 z2 - (i * line_distance, 0),
209 draw_gridline (z3 + (i * line_distance, 0),
210 z4 + (i * line_distance, 0),
216 fet_beginchar ("Brevis notehead", "sM1");
219 draw_staff (-2, 2, 0);
224 fet_beginchar ("Brevis notehead", "sM1");
227 draw_staff (-2, 2, 0.5);
232 fet_beginchar ("Double-lined brevis notehead", "sM1double");
233 draw_brevis (2, 0.8);
235 draw_staff (-2, 2, 0);
240 fet_beginchar ("Double-lined brevis notehead", "sM1double");
241 draw_brevis (2, 0.8);
243 draw_staff (-2, 2, 0.5);
248 fet_beginchar ("Whole notehead", "s0");
249 draw_outside_ellipse (1.80 - puff_up_factor / 3.0, 0, 0.707, 0);
250 undraw_inside_ellipse (1.30, 125 - puff_up_factor * 10,
251 0.68, 2 stafflinethickness#);
253 whole_notehead_width# := charwd;
255 draw_staff (-2, 2, 0);
260 fet_beginchar ("Whole notehead", "s0");
261 draw_outside_ellipse (1.80 - puff_up_factor / 3.0, 0,
263 undraw_inside_ellipse (1.30, 125 - puff_up_factor * 10,
264 0.68, 2 stafflinethickness#);
266 draw_staff (-2, 2, 0.5);
271 fet_beginchar ("Half notehead", "s1");
272 draw_outside_ellipse (1.53 - puff_up_factor / 3.0, 34, 0.66, 0.17);
273 undraw_inside_ellipse (3.25, 33, 0.81, 2.5 stafflinethickness#);
275 half_notehead_width# := charwd;
277 draw_staff (-2, 2, 0);
282 fet_beginchar ("Half notehead", "s1");
283 draw_outside_ellipse (1.53 - puff_up_factor / 3.0, 34,
285 undraw_inside_ellipse (3.25, 33, 0.81,
286 2.5 stafflinethickness#);
288 draw_staff (-2, 2, 0.5);
293 fet_beginchar ("Quarter notehead", "s2");
295 draw_staff (-2, 2, 0);
300 fet_beginchar ("Quarter notehead", "s2");
301 draw_outside_ellipse (1.49 - puff_up_factor / 3.0, 31,
304 draw_staff (-2, 2, 0.5);
309 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
312 fet_beginchar ("Whole diamondhead", "s0diamond");
313 draw_outside_ellipse (1.80, 0, 0.495, 0);
314 undraw_inside_ellipse (1.30, 125, 0.6,
315 .4 staff_space# + stafflinethickness#);
317 draw_staff (-2, 2, 0);
322 fet_beginchar ("Whole diamondhead", "s0diamond");
323 draw_outside_ellipse (1.80, 0, 0.495, 0);
324 undraw_inside_ellipse (1.30, 125, 0.6,
325 .4 staff_space# + stafflinethickness#);
327 draw_staff (-2, 2, 0.5);
332 fet_beginchar ("Half diamondhead", "s1diamond");
333 draw_outside_ellipse (1.50, 34, 0.49, 0.17);
334 undraw_inside_ellipse (3.5, 33, 0.80,
335 .3 staff_space# + 1.5 stafflinethickness#);
337 draw_staff (-2, 2, 0);
342 fet_beginchar ("Half diamondhead", "s1diamond");
343 draw_outside_ellipse (1.50, 34, 0.49, 0.17);
344 undraw_inside_ellipse (3.5, 33, 0.80,
346 + 1.5 stafflinethickness#);
348 draw_staff (-2, 2, 0.5);
353 fet_beginchar ("Quarter diamondhead", "s2diamond");
354 draw_outside_ellipse (1.80, 35, 0.495, -0.25);
356 draw_staff (-2, 2, 0);
361 fet_beginchar ("Quarter diamondhead", "s2diamond");
362 draw_outside_ellipse (1.80, 35, 0.495, -0.25);
364 draw_staff (-2, 2, 0.5);
369 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
372 vardef penposx@# (expr d) =
382 z@#l = pat intersectionpoint (z@# -- infinity * dir (d + 180));
383 z@#r = pat intersectionpoint (z@# -- infinity * dir (d));
389 % UGH: xs not declared as argument.
391 def define_triangle_shape (expr stemdir) =
392 save triangle_a, triangle_b, triangle_c;
393 save triangle_out_a, triangle_out_b, triangle_out_c;
394 save triangle_in, triangle_out;
395 save width, depth, height;
396 save origin, left_up_dir;
397 save exact_left_point, exact_right_point, exact_down_point;
399 path triangle_a, triangle_b, triangle_c;
400 path triangle_out_a, triangle_out_b, triangle_out_c;
401 path triangle_in, triangle_out;
402 pair origin, left_up_dir;
403 pair exact_down_point, exact_left_point, exact_right_point;
406 pen_thick# = stafflinethickness# + .1 staff_space#;
407 define_pixels (llap);
408 define_blacker_pixels (pen_thick);
410 left_up_dir = llap# * dir (90 + tilt);
412 xpart (left_up_dir) * xs - (pen_thick# * xs) / 2 + xpart origin = 0;
415 exact_left_point := origin + (left_up_dir xscaled xs);
416 exact_down_point := origin + (left_up_dir rotated 120 xscaled xs);
417 exact_right_point := origin + (left_up_dir rotated 240 xscaled xs);
419 height# = ypart (exact_left_point + origin) + pen_thick# / 2;
420 depth# = -ypart (exact_down_point + origin) + pen_thick# / 2;
421 width# = xpart (exact_right_point - exact_left_point)
424 set_char_box (0, width#, depth#, height#);
426 % Formerly, the shape has simply been drawn with an elliptical pen
427 % (`scaled pen_thick xscaled xs'), but the envelope of such a curve
428 % is of 6th degree. For the sake of mf2pt1, we approximate it.
430 pickup pencircle scaled pen_thick xscaled xs;
432 z0 = (hround_pixels (xpart origin), 0);
434 z1 = z1' = z0 + llap * dir (90 + tilt) xscaled xs;
435 z2 = z2' = z0 + llap * dir (90 + tilt + 120) xscaled xs;
436 z3 = z3' = z0 + llap * dir (90 + tilt + 240) xscaled xs;
438 z12 = caveness [.5[z1, z2], z3];
439 z23 = caveness [.5[z2, z3], z1];
440 z31 = caveness [.5[z3, z1], z2];
442 triangle_a = z1 .. z12 .. z2;
443 triangle_b = z2 .. z23 .. z3;
444 triangle_c = z3 .. z31 .. z1;
446 penposx1 (angle (direction 0 of triangle_a) - 90);
447 penposx2 (angle (direction 0 of triangle_b) - 90);
448 penposx3 (angle (direction 0 of triangle_c) - 90);
450 penposx1' (angle (direction infinity of triangle_c) + 90);
451 penposx2' (angle (direction infinity of triangle_a) + 90);
452 penposx3' (angle (direction infinity of triangle_b) + 90);
454 penposx12 (angle (z12 - z0));
455 penposx23 (angle (z23 - z0));
456 penposx31 (angle (z31 - z0));
458 z10 = (z0 -- z1) intersectionpoint (z1l .. z12l .. z2'r);
459 z20 = (z0 -- z2) intersectionpoint (z2l .. z23l .. z3'r);
460 z30 = (z0 -- z3) intersectionpoint (z3l .. z31l .. z1'r);
473 triangle_out_a = z1r .. z12r .. z2'l;
474 triangle_out_b = z2r .. z23r .. z3'l;
475 triangle_out_c = z3r .. z31r .. z1'l;
477 triangle_out = top z1
479 .. z1r{direction 0 of triangle_out_a}
481 & {direction infinity of triangle_out_a}z2'l
484 .. z2r{direction 0 of triangle_out_b}
486 & {direction infinity of triangle_out_b}z3'l
489 .. z3r{direction 0 of triangle_out_c}
491 & {direction infinity of triangle_out_c}z1'l
494 labels (0, 10, 20, 30);
495 penlabels (1, 1', 2, 2', 3, 3', 12, 23, 31);
499 charwy := ypart exact_right_point;
500 charwx := xpart exact_right_point + .5 pen_thick# * xs;
502 charwy := -ypart exact_down_point;
503 charwx := width# - (xpart exact_down_point - .5 pen_thick# * xs);
508 def draw_whole_triangle_head =
514 llap# = 3/4 noteheight#;
518 define_triangle_shape (1);
524 fet_beginchar ("Whole trianglehead", "s0triangle");
525 draw_whole_triangle_head;
527 draw_staff (-2, 2, 0);
532 fet_beginchar ("Whole trianglehead", "s0triangle");
533 draw_whole_triangle_head;
535 draw_staff (-2, 2, 0.5);
540 def draw_small_triangle_head (expr dir) =
546 llap# = 2/3 noteheight#;
549 define_triangle_shape (dir);
553 filldraw triangle_out;
554 unfilldraw triangle_in;
558 fet_beginchar ("Half trianglehead (downstem)", "d1triangle");
559 draw_small_triangle_head (-1);
561 draw_staff (-2, 2, 0);
565 fet_beginchar ("Half trianglehead (upstem)", "u1triangle");
566 draw_small_triangle_head (1);
568 draw_staff (-2, 2, 0.5);
572 def draw_closed_triangle_head (expr dir) =
578 llap# = 2/3 noteheight#;
581 define_triangle_shape (dir);
586 fet_beginchar ("Quarter trianglehead (upstem)", "u2triangle");
587 draw_closed_triangle_head (1);
589 draw_staff (-2, 2, 0);
593 fet_beginchar ("Quarter trianglehead (downstem)", "d2triangle");
594 draw_closed_triangle_head (-1);
596 draw_staff (-2, 2, 0.5);
600 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
602 % Slash heads are for indicating improvisation. They are
603 % twice as high as normal heads.
605 def draw_slash (expr hwid_hash) =
609 exact_height = staff_space# + stafflinethickness# / 2;
611 set_char_box (0, 2 exact_height / slash_slope + hwid_hash,
612 exact_height, exact_height);
621 pickup pencircle scaled blot_diameter;
626 lft x2 = 2 h / slash_slope;
633 ne = unitvector (z3 - z4);
634 nw_dist = (ne rotated 90) * 0.5 blot_diameter;
637 .. (z1 + nw_dist){ne}
638 -- (z2 + nw_dist){ne}
641 .. (z3 - nw_dist){-ne}
642 -- (z4 - nw_dist){-ne}
646 if hwid_hash > 2 slash_thick#:
649 th = slash_thick - blot_diameter;
654 z6 - z5 = whatever * ne;
655 z8 - z7 = whatever * ne;
657 z5 = z1 + whatever * ne + th * (ne rotated -90);
658 z8 = z4 + whatever * ne + th * (ne rotated 90);
666 labels (range 1 thru 10);
670 fet_beginchar ("Whole slashhead", "s0slash");
671 draw_slash (4 slash_thick# + 0.5 staff_space#);
673 draw_staff (-2, 2, 0);
677 fet_beginchar ("Half slashhead", "s1slash");
678 draw_slash (3.0 slash_thick# + 0.15 staff_space#);
680 draw_staff (-2, 2, 0);
684 fet_beginchar ("Quarter slashhead", "s2slash");
685 draw_slash (1.5 slash_thick#);
687 draw_staff (-2, 2, 0);
691 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
693 % `thick' is the distance between the NE/SW parallel lines in the cross
694 % (distance between centres of lines) in multiples of stafflinethickness
696 def draw_cross (expr thick) =
698 save ne_dist, nw_dist, rt_dist, up_dist;
699 save crz_in, crz_out;
702 pair ne_dist, nw_dist, rt_dist, up_dist;
703 path crz_in, crz_out;
705 pen_thick# := 1.2 stafflinethickness#;
706 thickness# := thick * stafflinethickness#;
707 define_pixels (thickness);
708 define_blacker_pixels (pen_thick);
710 pickup pencircle scaled pen_thick;
715 ne = unitvector ((1, (2 h - pen_thick) / (w - pen_thick)));
718 z4 - z5 = whatever * ne;
720 z6 - z3 = whatever * ne;
721 z3 - z4 = whatever * (ne yscaled -1);
723 z4 - z3 = whatever * (ne) + (ne rotated -90) * thickness;
726 x1 = charwd / 2 - .5 pen_thick#;
728 + thick / 2 * stafflinethickness# * (ne rotated -90);
730 % labels (1, 2, 3, 4, 5, 6);
732 nw = unitvector (z3 - z4);
734 up_dist = up * 0.5 pen_thick / cosd (angle (ne));
735 rt_dist = right * 0.5 pen_thick / sind (angle (ne));
736 nw_dist = (ne rotated 90) * 0.5 pen_thick;
737 ne_dist = (nw rotated -90) * 0.5 pen_thick;
743 x4 := hround (x4' + .5 pen_thick) - .5 pen_thick;
744 x5 := hfloor (x5' + xpart rt_dist) - xpart rt_dist;
745 y6 := vfloor (y6' + ypart up_dist) - ypart up_dist;
747 crz_out = (z6 + up_dist)
748 -- (z3 + nw_dist){ne}
750 .. (z3 + ne_dist){-nw}
751 -- (z4 + ne_dist){-nw}
753 .. (z4 - nw_dist){-ne}
755 crz_out := crz_out shifted (0, feta_shift)
756 -- reverse crz_out yscaled -1 shifted (0, -feta_eps);
758 -- reverse crz_out xscaled -1 shifted (-feta_eps, 0)
762 x4 := hround (x4' - xpart rt_dist) + xpart rt_dist;
763 x5 := hceiling (x5' - .5 pen_thick) + .5 pen_thick;
764 y6 := vfloor (y6' - .5 pen_thick) + .5 pen_thick;
766 crz_in = (bot z6){right}
767 .. (z6 - nw_dist){ne}
770 -- (z5 + nw_dist){-ne}
772 crz_in := crz_in shifted (0, feta_shift)
773 -- reverse crz_in yscaled -1 shifted (0, -feta_eps);
775 -- reverse crz_in xscaled -1 shifted (-feta_eps, 0)
780 currentpicture := currentpicture shifted (hround (w / 2), 0);
783 charwy := y1 + feta_shift;
785 z12 = (charwx * hppp, y1 * vppp);
791 fet_beginchar ("Whole Crossed notehead", "s0cross");
794 wid# := black_notehead_width# + 4 stafflinethickness#;
795 hei# := noteheight# + stafflinethickness#;
797 set_char_box (0, wid#, hei# / 2, hei# / 2);
801 remember_pic := currentpicture;
803 draw_staff (-2, 2, 0);
808 fet_beginchar ("Whole Crossed notehead", "s0cross");
811 wid# := black_notehead_width# + 4 stafflinethickness#;
812 hei# := noteheight# + stafflinethickness#;
814 set_char_box (0, wid#, hei# / 2, hei# / 2);
816 currentpicture := remember_pic;
818 draw_staff (-2, 2, 0.5);
823 fet_beginchar ("Half Crossed notehead", "s1cross");
826 wid# := black_notehead_width# + 2 stafflinethickness#;
827 hei# := noteheight# + stafflinethickness# / 2;
829 set_char_box (0, wid#, hei# / 2, hei# / 2);
833 remember_pic := currentpicture;
835 draw_staff (-2, 2, 0);
840 fet_beginchar ("Half Crossed notehead", "s1cross");
843 wid# := black_notehead_width# + 2 stafflinethickness#;
844 hei# := noteheight# + stafflinethickness# / 2;
846 set_char_box (0, wid#, hei# / 2, hei# / 2);
848 currentpicture := remember_pic;
850 draw_staff (-2, 2, 0.5);
855 fet_beginchar ("Crossed notehead", "s2cross");
856 wid# := black_notehead_width#;
858 set_char_box (0, wid#, hei# / 2, hei# / 2);
862 remember_pic := currentpicture;
864 draw_staff (-2, 2, 0);
869 fet_beginchar ("Crossed notehead", "s2cross");
870 wid# := black_notehead_width#;
872 set_char_box (0, wid#, hei# / 2, hei# / 2);
874 currentpicture := remember_pic;
876 draw_staff (-2, 2, 0.5);
881 fet_beginchar ("X-Circled notehead", "s2xcircle");
883 save cthick, cxd, cyd, dy;
885 wid# := black_notehead_width# * sqrt (sqrt2);
886 hei# := noteheight# * sqrt (sqrt2);
888 set_char_box (0, wid#, hei# / 2, hei# / 2);
890 d := d - feta_space_shift;
892 cthick# := (1.2 + 1/4) * stafflinethickness#;
893 define_blacker_pixels (cthick);
896 cyd := h + d - cthick / 2;
900 pickup pencircle scaled cthick;
902 fill fullcircle xscaled (cxd + cthick)
903 yscaled (cyd + cthick)
905 unfill fullcircle xscaled (cxd - cthick)
906 yscaled (cyd - cthick)
909 xpos := .5 cxd / sqrt2;
910 ypos := .5 cyd / sqrt2;
912 pickup penrazor scaled cthick rotated (angle (xpos, ypos) + 90);
913 draw (-xpos + w / 2, -ypos + dy)
914 -- (xpos + w / 2, ypos + dy);
916 pickup penrazor scaled cthick rotated (angle (xpos, -ypos) + 90);
917 draw (-xpos + w / 2, ypos + dy)
918 -- (xpos + w / 2, -ypos + dy);
923 z12 = (charwx * hppp, charwy * vppp);
926 remember_pic := currentpicture;
928 draw_staff (-2, 2, 0);
933 fet_beginchar ("X-Circled notehead", "s2xcircle");
935 save cthick, cxr, cyr;
937 wid# := black_notehead_width# * sqrt (sqrt2);
938 hei# := noteheight# * sqrt (sqrt2);
940 set_char_box (0, wid#, hei# / 2, hei# / 2);
942 currentpicture := remember_pic;
944 draw_staff (-2, 2, 0.5);
954 % Note: For whole and half notes, the `fill' curve (p_out) is offset from
955 % the points that specify the outer geometry, because we need to add
956 % the rounding. In contrast, the inner curve is not offset, because
957 % there is no rounding.
959 % This means that to get a line of thick_factor * pen_thickness,
960 % we need to offset the inner curve by
962 % (thick_factor - 0.5) * pen_thickness
966 % (2 * thick_factor - 1) * half_pen_thickness
968 save solfa_pen_thick;
969 solfa_pen_thick# = 1.3 stafflinethickness#;
970 define_blacker_pixels (solfa_pen_thick);
972 save solfa_pen_radius;
973 solfa_pen_radius = 0.5 solfa_pen_thick;
975 save solfa_base_notewidth;
976 solfa_base_notewidth# := black_notehead_width#;
978 solfa_whole_width := 1.0;
979 solfa_half_width := 1.0;
980 solfa_quarter_width := 1.0;
985 % Triangle with base parallel to staff lines.
988 def draw_do_head (expr width_factor, dir, thickness_factor) =
990 save left_dist, right_dist, bottom_dist;
992 pair left_dist, right_dist, bottom_dist;
994 set_char_box (0, width_factor * solfa_base_notewidth#,
995 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
997 bottom_thick_factor := 2 * thickness_factor - 1;
998 % no different thickness for left side if we want uniform thickness
999 if thickness_factor = 1:
1000 left_thick_factor := 1;
1002 left_thick_factor := 0.7 * bottom_thick_factor;
1006 pen_radius := min (solfa_pen_radius,
1007 (h + d) / (3 * (1 + bottom_thick_factor)));
1009 pickup pencircle scaled (2 * pen_radius);
1018 left_dist = (unitvector (z3 - z1) rotated 90) * pen_radius;
1019 right_dist = (unitvector (z2 - z3) rotated 90) * pen_radius;
1020 bottom_dist = (0,1) * pen_radius;
1024 save point_a, point_b, point_c;
1025 pair point_a, point_b, point_c;
1027 pa := (z1 - left_thick_factor * left_dist)
1028 -- (z3 - left_thick_factor * left_dist);
1029 pb := (z1 + bottom_thick_factor * bottom_dist)
1030 -- (z2 + bottom_thick_factor * bottom_dist);
1031 pc := (z2 - right_dist)
1032 -- (z3 - right_dist);
1034 point_a := pa intersectionpoint pb;
1035 point_b := pb intersectionpoint pc;
1036 point_c := pc intersectionpoint pa;
1046 .. (z2 + right_dist){z3 - z2}
1047 -- (z3 + right_dist){z3 - z2}
1049 .. (z3 + left_dist){z1 - z3}
1050 -- (z1 + left_dist){z1 - z3}
1057 charwy := -chardp + 0.5 stafflinethickness#;
1067 fet_beginchar ("Whole dohead", "s0do");
1068 draw_do_head (solfa_whole_width, 1, do_weight);
1074 fet_beginchar ("Half dohead", "d1do");
1075 draw_do_head (solfa_half_width, -1, do_weight);
1081 fet_beginchar ("Half dohead", "u1do");
1082 draw_do_head (solfa_half_width, 1, do_weight);
1088 fet_beginchar ("Quarter dohead", "d2do");
1089 draw_do_head (solfa_quarter_width, -1, do_weight);
1094 fet_beginchar ("Quarter dohead", "u2do");
1095 draw_do_head (solfa_quarter_width, 1, do_weight);
1100 fet_beginchar ("Whole thin dohead", "s0doThin");
1101 draw_do_head (solfa_whole_width, 1, 1);
1107 fet_beginchar ("Half thin dohead", "d1doThin");
1108 draw_do_head (solfa_half_width, -1, 1);
1114 fet_beginchar ("Half thin dohead", "u1doThin");
1115 draw_do_head (solfa_half_width, 1, 1);
1121 fet_beginchar ("Quarter thin dohead", "d2doThin");
1122 draw_do_head (solfa_quarter_width, -1, 1);
1127 fet_beginchar ("Quarter thin dohead", "u2doThin");
1128 draw_do_head (solfa_quarter_width, 1, 1);
1134 % re - flat top, curved bottom:
1138 % .. {dir 90} (w,h/2)
1141 % (broader along the base and with more vertical sides for half and
1144 % Note: According to some shape-note singers, there should be no size
1145 % differences for half and whole notes, contrary to the comment above.
1146 % Consequently, we have made them all the same width.
1148 % stem attachment: h/2
1150 def draw_re_head (expr width_factor, dir, thickness_factor) =
1154 set_char_box (0, width_factor * solfa_base_notewidth#,
1155 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1158 offset = (2 * thickness_factor - 1);
1165 pen_radius := min (solfa_pen_radius,
1166 (h + d) * (1-curve_start) / (1+ offset));
1168 pickup pencircle scaled (2 * pen_radius);
1173 y2 = curve_start [y3, y1];
1181 labels (range 1 thru 5);
1183 p_in := (z1 + pen_radius * (1, -1 * offset))
1185 .. ((top z3) + (0, offset * pen_radius))
1187 -- (z5 + pen_radius * (-1, -1 * offset))
1200 charwy := curve_start [-chardp, charht];
1211 fet_beginchar ("Whole rehead", "s0re");
1212 draw_re_head (solfa_whole_width, 1, re_weight);
1218 fet_beginchar ("Half up rehead", "u1re");
1219 draw_re_head (solfa_half_width, 1, re_weight);
1225 fet_beginchar ("Half down rehead", "d1re");
1226 draw_re_head (solfa_half_width, -1, re_weight);
1232 fet_beginchar ("Quarter up rehead", "u2re");
1233 draw_re_head (solfa_quarter_width, 1, re_weight);
1238 fet_beginchar ("Quarter down rehead", "d2re");
1239 draw_re_head (solfa_quarter_width, -1, re_weight);
1244 fet_beginchar ("Whole thin rehead", "s0reThin");
1245 draw_re_head (solfa_whole_width, 1, 1);
1251 fet_beginchar ("Half up thin rehead", "u1reThin");
1252 draw_re_head (solfa_half_width, 1, 1);
1258 fet_beginchar ("Half down thin rehead", "d1reThin");
1259 draw_re_head (solfa_half_width, -1, 1);
1265 fet_beginchar ("Quarter thin rehead", "u2reThin");
1266 draw_re_head (solfa_quarter_width, 1, 1);
1271 fet_beginchar ("Quarter thin rehead", "d2reThin");
1272 draw_re_head (solfa_quarter_width, -1, 1);
1277 %%%% mi head -- diamond shape
1279 % two versions, depending on whether the `strong' lines are on the nw & se
1282 def draw_mi_head (expr width_factor, thickness_factor, mirror) =
1283 save path_out, path_in;
1284 save ne_dist, se_dist, ne, se;
1285 save path_a, path_b, path_c, path_d;
1286 path path_out, path_in;
1287 pair ne_dist, se_dist, ne, se;
1288 path path_a, path_b, path_c, path_d;
1292 set_char_box (0, width_factor * solfa_base_notewidth#,
1293 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1296 offset := 2 * thickness_factor - 1;
1300 note_diagonal := w / 2 ++ (h + d) / 2;
1304 pen_radius := min (solfa_pen_radius,
1305 .3 * note_diagonal / (1 + offset));
1307 pickup pencircle scaled (2 * pen_radius);
1318 % inner sides are parallel to outer sides
1319 z6 - z5 = whatever * (z2 - z1);
1320 z8 - z7 = whatever * (z4 - z3);
1321 z8 - z5 = whatever * (z4 - z1);
1322 z7 - z6 = whatever * (z3 - z2);
1324 ne = unitvector (z4 - z1);
1325 se = unitvector (z2 - z1);
1327 ne_dist = (ne rotated 90) * pen_radius;
1328 se_dist = (se rotated 90) * pen_radius;
1330 path_a := (z1 + se_dist)
1332 path_b := (z2 + (ne_dist * offset))
1333 -- (z3 + (ne_dist * offset));
1334 path_c := (z3 - se_dist)
1336 path_d := (z4 - (ne_dist * offset))
1337 -- (z1 - (ne_dist * offset));
1339 z5 = path_a intersectionpoint path_d;
1340 z7 = path_b intersectionpoint path_c;
1342 labels (range 1 thru 8);
1351 path_in := inner_path;
1353 path_in := inner_path reflectedabout (z2, z4);
1356 path_out := lft z1 {down}
1357 .. (z1 - se_dist){se}
1358 -- (z2 - se_dist){se}
1360 .. (z2 - ne_dist){ne}
1361 -- (z3 - ne_dist){ne}
1363 .. (z3 + se_dist){-se}
1364 -- (z4 + se_dist){-se}
1366 .. (z4 + ne_dist){-ne}
1367 -- (z1 + ne_dist){-ne}
1372 save mi_weight, mi_width;
1376 fet_beginchar ("Whole mihead", "s0mi");
1377 draw_mi_head (mi_width * solfa_whole_width, mi_weight, false);
1383 fet_beginchar ("Half mihead", "s1mi");
1384 draw_mi_head (mi_width * solfa_quarter_width, mi_weight, false);
1390 fet_beginchar ("Quarter mihead", "s2mi");
1391 draw_mi_head (mi_width * solfa_quarter_width, mi_weight, false);
1396 fet_beginchar ("Whole mirror mihead", "s0miMirror");
1397 draw_mi_head (mi_width * solfa_whole_width, mi_weight, true);
1403 fet_beginchar ("Half mirror mihead", "s1miMirror");
1404 draw_mi_head (mi_width * solfa_quarter_width, mi_weight, true);
1410 fet_beginchar ("Quarter mirror mihead", "s2miMirror");
1411 draw_mi_head (mi_width * solfa_quarter_width, mi_weight, true);
1416 fet_beginchar ("Whole thin mihead", "s0miThin");
1417 draw_mi_head (mi_width * solfa_whole_width, 1, false);
1423 fet_beginchar ("Half thin mihead", "s1miThin");
1424 draw_mi_head (mi_width * solfa_quarter_width, 1, false);
1430 fet_beginchar ("Quarter thin mihead", "s2miThin");
1431 draw_mi_head (mi_width * solfa_quarter_width, 1, false);
1438 % Right triangle, hypotenuse from nw to se corner. Stem attaches on
1439 % vertical side in direction of horizontal side.
1441 def draw_fa_head (expr width_factor, thickness_factor) =
1442 set_char_box (0, width_factor * solfa_base_notewidth#,
1443 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1445 save p_down_in, p_down_out, p_up_in, p_up_out, nw_dist, nw;
1446 path p_down_in, p_down_out, p_up_in, p_up_out;
1447 save path_a, path_b, path_c;
1448 path path_a, path_b, path_c;
1452 offset := 2 * thickness_factor - 1;
1455 pen_radius := min (solfa_pen_radius,
1456 .33 * (h + d) / (1 + offset));
1458 pickup pencircle scaled (2 * pen_radius);
1471 labels (1, 2, 3, 4);
1473 nw = unitvector (z1 - z3);
1474 nw_dist = (nw rotated 90) * pen_radius;
1476 path_a := (z1 - (0,1) * offset * pen_radius)
1477 -- (z2 - (0,1) * offset * pen_radius);
1478 path_b := (z2 - (1,0) * pen_radius)
1479 -- (z3 - (1,0) * pen_radius);
1480 path_c := (z3 - nw_dist)
1483 p_up_in := (path_a intersectionpoint path_b)
1484 -- (path_b intersectionpoint path_c)
1485 -- (path_c intersectionpoint path_a)
1488 p_up_out := lft z1{down}
1489 .. (z1 + nw_dist){-nw}
1490 -- (z3 + nw_dist){-nw}
1498 p_down_in := p_up_in rotated 180 shifted (w, 0);
1499 p_down_out := p_up_out rotated 180 shifted (w, 0);
1508 fet_beginchar ("Whole fa up head", "u0fa");
1509 draw_fa_head (solfa_whole_width, fa_weight);
1515 fet_beginchar ("Whole fa down head", "d0fa");
1516 draw_fa_head (solfa_whole_width, fa_weight);
1522 fet_beginchar ("half fa up head", "u1fa");
1523 draw_fa_head (solfa_half_width, fa_weight);
1529 fet_beginchar ("Half fa down head", "d1fa");
1530 draw_fa_head (solfa_half_width, fa_weight);
1536 fet_beginchar ("Quarter fa up head", "u2fa");
1537 draw_fa_head (solfa_quarter_width, fa_weight);
1542 fet_beginchar ("Quarter fa down head", "d2fa");
1543 draw_fa_head (solfa_quarter_width, fa_weight);
1548 fet_beginchar ("Whole thin fa up head", "u0faThin");
1549 draw_fa_head (solfa_whole_width, 1);
1555 fet_beginchar ("Whole thin fa down head", "d0faThin");
1556 draw_fa_head (solfa_whole_width, 1);
1562 fet_beginchar ("half thin fa up head", "u1faThin");
1563 draw_fa_head (solfa_half_width, 1);
1569 fet_beginchar ("Half thin fa down head", "d1faThin");
1570 draw_fa_head (solfa_half_width, 1);
1576 fet_beginchar ("Quarter thin fa up head", "u2faThin");
1577 draw_fa_head (solfa_quarter_width, 1);
1582 fet_beginchar ("Quarter thin fa down head", "d2faThin");
1583 draw_fa_head (solfa_quarter_width, 1);
1591 % Note: sol head is the same shape as a standard music head, and doesn't
1592 % vary from style to style. However, width is constant with duration,
1593 % so we can't just use the standard note font.
1595 def draw_sol_head (expr filled) =
1596 draw_outside_ellipse (1.53 - puff_up_factor / 3.0, 34, 0.66, 0.17);
1598 undraw_inside_ellipse (3.25, 33, 0.81, 2.5 stafflinethickness#);
1600 draw_staff (-2, 2, 0);
1603 fet_beginchar ("Whole solhead", "s0sol");
1604 draw_sol_head ( false);
1608 fet_beginchar ("Half solhead", "s1sol");
1609 draw_sol_head ( false);
1613 fet_beginchar ("Quarter solhead", "s2sol");
1614 draw_sol_head ( true);
1622 def draw_la_head (expr width_factor, thickness_factor) =
1623 set_char_box (0, width_factor * solfa_base_notewidth#,
1624 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1629 offset := 2 * thickness_factor - 1;
1632 pen_radius := min (solfa_pen_radius,
1633 .35 * (h + d) / (1 + offset));
1635 pickup pencircle scaled (2 * pen_radius);
1648 labels (range 1 thru 4);
1650 p_in := (z1 + pen_radius * (1, -offset))
1651 -- (z2 + pen_radius * (-1, -offset))
1652 -- (z3 + pen_radius * (-1, offset))
1653 -- (z4 + pen_radius * (1, offset))
1671 fet_beginchar ("Whole lahead", "s0la");
1672 draw_la_head (solfa_whole_width, la_weight);
1678 fet_beginchar ("Half lahead", "s1la");
1679 draw_la_head (solfa_half_width, la_weight);
1685 fet_beginchar ("Quarter lahead", "s2la");
1686 draw_la_head (solfa_quarter_width, la_weight);
1691 fet_beginchar ("Whole thin lahead", "s0laThin");
1692 draw_la_head (solfa_whole_width, 1);
1698 fet_beginchar ("Half thin lahead", "s1laThin");
1699 draw_la_head (solfa_half_width, 1);
1705 fet_beginchar ("Quarter lahead", "s2laThin");
1706 draw_la_head (solfa_quarter_width, 1);
1713 % `Snow-cone', V with rounded top.
1715 def draw_ti_head (expr width_factor, dir, thickness_factor) =
1716 set_char_box (0, width_factor * solfa_base_notewidth#,
1717 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1718 save p_in, p_out, p_top, p_top_in;
1719 path p_in, p_out, p_top, p_top_in;
1724 offset := 2 * thickness_factor - 1;
1727 pen_radius := min (solfa_pen_radius,
1728 .4 * (h + d) / (1 + offset));
1730 pickup pencircle scaled (2 * pen_radius);
1735 y2 = cone_height [y1, y3];
1741 y5 = y1 + offset * pen_radius;
1743 labels (range 1 thru 4);
1745 save nw_dist, sw_dist, nw, sw;
1746 pair nw_dist, sw_dist, nw, sw;
1748 nw = unitvector (z2 - z1);
1749 sw = unitvector (z1 - z4);
1751 nw_dist = (nw rotated 90) * pen_radius;
1752 sw_dist = (sw rotated 90) * pen_radius;
1754 p_top := (z2 + nw * pen_radius)
1756 .. (z4 - sw * pen_radius);
1758 p_top_in := (z2 - nw * offset * pen_radius)
1759 .. (z3 - (0,1) * pen_radius) {right}
1760 .. (z4 + sw * offset * pen_radius);
1762 save path_a, path_b;
1763 path path_a, path_b;
1769 z6 = path_a intersectionpoint p_top_in;
1770 z7 = path_b intersectionpoint p_top_in;
1782 .. (z2 + nw * pen_radius){direction 0 of p_top}
1784 & {direction infinity of p_top}(z4 - sw * pen_radius)
1791 charwy := cone_height [-chardp, charht];
1801 fet_beginchar ("Whole up tihead", "s0ti");
1802 draw_ti_head (solfa_whole_width, 1, ti_weight);
1808 fet_beginchar ("Half up tihead", "u1ti");
1809 draw_ti_head (solfa_half_width, 1, ti_weight);
1815 fet_beginchar ("Half down tihead", "d1ti");
1816 draw_ti_head (solfa_half_width, -1, ti_weight);
1822 fet_beginchar ("Quarter up tihead", "u2ti");
1823 draw_ti_head (solfa_quarter_width, 1, ti_weight);
1828 fet_beginchar ("Quarter down tihead", "d2ti");
1829 draw_ti_head (solfa_quarter_width, -1, ti_weight);
1834 fet_beginchar ("Whole thin up tihead", "s0tiThin");
1835 draw_ti_head (solfa_whole_width, 1, 1);
1841 fet_beginchar ("Half thin up tihead", "u1tiThin");
1842 draw_ti_head (solfa_half_width, 1, 1);
1848 fet_beginchar ("Half thin down tihead", "d1tiThin");
1849 draw_ti_head (solfa_half_width, -1, 1);
1855 fet_beginchar ("Quarter thin up tihead", "u2tiThin");
1856 draw_ti_head (solfa_quarter_width, 1, 1);
1861 fet_beginchar ("Quarter thin down tihead", "d2tiThin");
1862 draw_ti_head (solfa_quarter_width, -1, 1);
1867 %%%%%% Funk shape note heads
1869 % Funk heads are narrower than Aiken and Sacred Harp, so we need a new
1872 funk_notehead_width := 0.75;
1876 % Parabolic on one side, vertical line on other
1877 % Has up and down shapes for *all* notes
1879 def draw_Funk_do_head (expr width_factor, thickness_factor) =
1880 set_char_box (0, width_factor * solfa_base_notewidth#,
1881 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1884 offset := 2 * thickness_factor - 1;
1887 pen_radius := min (solfa_pen_radius,
1888 .3 * (h + d) / (1 + offset));
1890 pickup pencircle scaled (2 * pen_radius);
1901 x4 = x1 - pen_radius;
1902 y4 = y1 + offset * pen_radius;
1905 x5 = x2 + pen_radius;
1908 y6 = y3 - offset * pen_radius;
1910 save p_up_in, p_up_out, p_down_in, p_down_out;
1911 path p_up_in, p_up_out, p_down_in, p_down_out;
1913 p_down_in := z4{left}
1918 p_down_out := bot z1{left}
1925 p_up_in := p_down_in rotated 180 shifted (w,0);
1926 p_up_out := p_down_out rotated 180 shifted (w,0);
1931 save funk_do_weight;
1932 funk_do_weight := 1.7;
1934 fet_beginchar ("Whole up Funk dohead", "u0doFunk");
1935 draw_Funk_do_head (funk_notehead_width, funk_do_weight);
1941 fet_beginchar ("Whole down Funk dohead", "d0doFunk");
1942 draw_Funk_do_head (funk_notehead_width, funk_do_weight);
1948 fet_beginchar ("Half up Funk dohead", "u1doFunk");
1949 draw_Funk_do_head (funk_notehead_width, funk_do_weight);
1955 fet_beginchar ("Half down Funk dohead", "d1doFunk");
1956 draw_Funk_do_head (funk_notehead_width, funk_do_weight);
1962 fet_beginchar ("Quarter up Funk dohead", "u2doFunk");
1963 draw_Funk_do_head (funk_notehead_width, funk_do_weight);
1968 fet_beginchar ("Quarter down Funk dohead", "d2doFunk");
1969 draw_Funk_do_head (funk_notehead_width, funk_do_weight);
1976 % Has up and down shapes for *all* notes
1978 def draw_Funk_re_head (expr width_factor, thickness_factor) =
1979 set_char_box (0, width_factor * solfa_base_notewidth#,
1980 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1983 offset := 2 * thickness_factor - 1;
1986 pen_radius := min (solfa_pen_radius,
1987 .3 * (h + d) / (1 + offset));
1989 pickup pencircle scaled (2 * pen_radius);
2000 x3 := curve_in [x1, x2];
2008 save ne, se, ne_perp, se_perp;
2009 pair ne, se, ne_perp, se_perp;
2011 ne := unitvector (z2 - z1);
2012 se := unitvector (z4 - z1);
2013 ne_perp := ne rotated 90;
2014 se_perp := se rotated 90;
2016 save path_a, path_b, path_c, path_d;
2017 path path_a, path_b, path_c, path_d;
2018 save arrow_a_perp, arrow_b_perp;
2019 pair arrow_a_perp, arrow_b_perp;
2022 path_d := z2 .. z3{down} .. z4;
2023 arrow_a_perp = unitvector (direction 0 of path_d rotated 90)
2025 arrow_b_perp = unitvector (direction 2 of path_d rotated 90)
2028 path_b := (z1 + se_perp * pen_radius)
2029 -- z4 + se_perp * offset * pen_radius;
2030 path_a := (z1 - ne_perp * pen_radius)
2031 -- z2 - ne_perp * offset * pen_radius;
2032 path_c := z2 - arrow_a_perp
2034 .. z4 - arrow_b_perp;
2036 z5 = path_a intersectionpoint path_b;
2037 z7 = path_a intersectionpoint path_c;
2038 z8 = path_b intersectionpoint path_c;
2040 save p_up_in, p_down_in, p_up_out, p_down_out;
2041 path p_up_in, p_down_in, p_up_out, p_down_out;
2049 p_down_out := lft z1{up}
2050 .. (z1 + ne_perp * pen_radius){ne}
2051 -- (z2 + ne_perp * pen_radius){ne}
2054 .. (z2 + arrow_a_perp)
2056 .. (z4 + arrow_b_perp)
2059 .. z4 - se_perp * pen_radius
2060 -- z1 - se_perp * pen_radius
2063 p_up_in := p_down_in rotated 180 shifted (w, 0);
2064 p_up_out := p_down_out rotated 180 shifted (w, 0);
2069 save funk_re_weight;
2070 funk_re_weight = 1.7;
2072 fet_beginchar ("Whole up Funk rehead", "u0reFunk");
2073 draw_Funk_re_head (funk_notehead_width, funk_re_weight);
2079 fet_beginchar ("Whole down Funk rehead", "d0reFunk");
2080 draw_Funk_re_head (funk_notehead_width, funk_re_weight);
2086 fet_beginchar ("Half up Funk rehead", "u1reFunk");
2087 draw_Funk_re_head (funk_notehead_width, funk_re_weight);
2093 fet_beginchar ("Half down Funk rehead", "d1reFunk");
2094 draw_Funk_re_head (funk_notehead_width, funk_re_weight);
2100 fet_beginchar ("Quarter up Funk rehead", "u2reFunk");
2101 draw_Funk_re_head (funk_notehead_width, funk_re_weight);
2106 fet_beginchar ("Quarter down Funk rehead", "d2reFunk");
2107 draw_Funk_re_head (funk_notehead_width, funk_re_weight);
2114 % Has up and down shapes for all hollow notes
2116 save funk_mi_width, funk_mi_weight;
2117 funk_mi_width := 1.2;
2118 funk_mi_weight := 1.9;
2120 fet_beginchar ("Whole up Funk mihead", "u0miFunk");
2121 draw_mi_head (funk_mi_width * funk_notehead_width,
2122 funk_mi_weight, false);
2128 fet_beginchar ("Whole down Funk mihead", "d0miFunk");
2129 draw_mi_head (funk_mi_width * funk_notehead_width,
2130 funk_mi_weight, true);
2136 fet_beginchar ("Half up Funk mihead", "u1miFunk");
2137 draw_mi_head (funk_mi_width * funk_notehead_width,
2138 funk_mi_weight, false);
2144 fet_beginchar ("Half down Funk mihead", "d1miFunk");
2145 draw_mi_head (funk_mi_width * funk_notehead_width,
2146 funk_mi_weight, true);
2152 fet_beginchar ("Quarter Funk mihead", "s2miFunk");
2153 draw_mi_head (funk_mi_width * funk_notehead_width,
2154 funk_mi_weight, false);
2161 % Does it rotate for whole notes?
2162 % Same as other shape note systems
2163 % Need special notes because of special width
2165 save funk_fa_weight;
2166 funk_fa_weight := 1.9;
2168 fet_beginchar ("Whole up Funk fahead", "u0faFunk");
2169 draw_fa_head (funk_notehead_width, funk_fa_weight);
2175 fet_beginchar ("Whole down Funk fahead", "d0faFunk");
2176 draw_fa_head (funk_notehead_width, funk_fa_weight);
2182 fet_beginchar ("Half up Funk fahead", "u1faFunk");
2183 draw_fa_head (funk_notehead_width, funk_fa_weight);
2189 fet_beginchar ("Half down Funk fahead", "d1faFunk");
2190 draw_fa_head (funk_notehead_width, funk_fa_weight);
2196 fet_beginchar ("Quarter up Funk fahead", "u2faFunk");
2197 draw_fa_head (funk_notehead_width, funk_fa_weight);
2202 fet_beginchar ("Quarter down Funk fahead", "d2faFunk");
2203 draw_fa_head (funk_notehead_width, funk_fa_weight);
2208 %%%%%% Funk sol head is the same as the others
2209 % Need special character because of skinnier head
2211 def draw_Funk_sol_head (expr filled) =
2214 noteheight# := solfa_noteheight#;
2215 draw_outside_ellipse (1.2, 34, 0.71, 0.);
2217 undraw_inside_ellipse (1.9, 33, 0.74, 5.5 stafflinethickness#);
2219 draw_staff (-2, 2, 0);
2224 fet_beginchar ("Whole Funk solhead", "s0solFunk");
2225 draw_Funk_sol_head ( false);
2229 fet_beginchar ("Half Funk solhead", "s1solFunk");
2230 draw_Funk_sol_head ( false);
2234 fet_beginchar ("Quarter Funk solhead", "s2solFunk");
2235 draw_Funk_sol_head ( true);
2241 % Same as for other shape notes
2242 % Smaller width requires special characters
2244 save funk_la_weight;
2245 funk_la_weight := 1.9;
2247 fet_beginchar ("Whole Funk lahead", "s0laFunk");
2248 draw_la_head (funk_notehead_width, funk_notehead_width);
2254 fet_beginchar ("Half Funk lahead", "s1laFunk");
2255 draw_la_head (funk_notehead_width, funk_notehead_width);
2261 fet_beginchar ("Quarter Funk lahead", "s2laFunk");
2262 draw_la_head (funk_notehead_width, funk_notehead_width);
2268 % `Sideways snow cone'.
2269 % Rotates for all notes.
2271 def draw_Funk_ti_head (expr width_factor, thickness_factor) =
2272 set_char_box (0, width_factor * solfa_base_notewidth#,
2273 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
2278 offset := 2 * thickness_factor - 1;
2281 pen_radius := min (solfa_pen_radius,
2282 .33 * (h + d) / (1 + offset));
2284 pickup pencircle scaled (2 * pen_radius);
2289 x2 = cone_width [x1, x3];
2298 save nw_dist, sw_dist, ne, se;
2299 pair nw_dist, sw_dist, ne, se;
2301 ne = unitvector (z2 - z1);
2302 se = unitvector (z4 - z1);
2304 nw_dist = (ne rotated 90) * pen_radius ;
2305 sw_dist = (se rotated -90) * pen_radius;
2307 save path_a, path_b;
2308 path path_a, path_b;
2309 path_a := z1 - nw_dist
2310 -- z2 - offset * nw_dist;
2311 path_b := z1 - sw_dist
2312 -- z4 - offset * sw_dist;
2314 save path_right, path_right_in;
2315 path path_right, path_right_in;
2316 path_right := (z2 + ne * pen_radius)
2318 .. (z4 + se * pen_radius);
2320 path_right_in := (z2 - ne * pen_radius)
2322 .. (z4 - se * pen_radius);
2324 z5 = path_a intersectionpoint path_b;
2325 z6 = path_a intersectionpoint path_right_in;
2326 z7 = path_b intersectionpoint path_right_in;
2328 save p_up_in, p_down_in, p_up_out, p_down_out;
2329 path p_up_in, p_down_in, p_up_out, p_down_out;
2337 p_down_out := lft z1
2341 .. (z2 + ne * pen_radius){direction 0 of path_right}
2343 & {direction infinity of path_right}(z4 + se * pen_radius)
2349 p_up_in := p_down_in rotated 180 shifted (w, 0);
2350 p_up_out := p_down_out rotated 180 shifted (w, 0);
2354 save funk_ti_weight;
2355 funk_ti_weight := 1.6;
2357 fet_beginchar ("Whole up Funk tihead", "u0tiFunk");
2358 draw_Funk_ti_head (funk_notehead_width, funk_ti_weight);
2364 fet_beginchar ("Whole down Funk tihead", "d0tiFunk");
2365 draw_Funk_ti_head (funk_notehead_width, funk_ti_weight);
2371 fet_beginchar ("Half up Funk tihead", "u1tiFunk");
2372 draw_Funk_ti_head (funk_notehead_width, funk_ti_weight);
2378 fet_beginchar ("Half down Funk tihead", "d1tiFunk");
2379 draw_Funk_ti_head (funk_notehead_width, funk_ti_weight);
2385 fet_beginchar ("Quarter up Funk tihead", "u2tiFunk");
2386 draw_Funk_ti_head (funk_notehead_width, funk_ti_weight);
2391 fet_beginchar ("Quarter down Funk tihead", "d2tiFunk");
2392 draw_Funk_ti_head (funk_notehead_width, funk_ti_weight);
2397 %%%%%% Walker shape note heads
2399 % Walker heads are narrow like Funk heads, so use funk_notehead_width.
2402 %%%%%% Walker do head
2404 % Trapezoid, with largest side on stem side
2406 def draw_Walker_do_head (expr width_factor, dir, thickness_factor) =
2407 set_char_box (0, width_factor * solfa_base_notewidth#,
2408 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
2410 pickup pencircle scaled solfa_pen_thick;
2413 offset := 2 * thickness_factor - 1;
2415 % adjust width so stem can be centered
2416 if .5w <> good.x .5w: change_width; fi
2420 scaling# = charwd / w;
2425 x1 = inset [x4, x3];
2428 x2 = inset [x3, x4];
2437 labels (range 1 thru 4);
2439 save left_dir, left_perp, right_dir, right_perp;
2440 pair left_dir, left_perp, right_dir, right_perp;
2442 left_dir = unitvector(z1 - z4);
2443 left_perp = (left_dir rotated 90) * solfa_pen_radius;
2444 right_dir = unitvector(z3 - z2);
2445 right_perp = (right_dir rotated 90) * solfa_pen_radius;
2447 save path_a, path_b, path_c, path_d;
2448 path path_a, path_b, path_c, path_d;
2450 path_a := (z4 - left_perp)
2451 -- (z1 - left_perp);
2452 path_b := (z1 - (0, offset*solfa_pen_radius))
2453 -- (z2 - (0, offset*solfa_pen_radius));
2454 path_c := (z2 - right_perp)
2455 -- (z3 - right_perp);
2456 path_d := (z3 + (0, offset*solfa_pen_radius))
2457 -- (z4 + (0, offset*solfa_pen_radius));
2462 p_in := (path_a intersectionpoint path_b)
2463 -- (path_b intersectionpoint path_c)
2464 -- (path_c intersectionpoint path_d)
2465 -- (path_d intersectionpoint path_a)
2468 p_out := top z1{right}
2470 .. z2 + right_perp {right_dir}
2471 -- z3 + right_perp {right_dir}
2474 .. z4 + left_perp {left_dir}
2475 .. z1 + left_perp {left_dir}
2478 charwx := scaling# * (w/2 + solfa_pen_radius);
2479 charwy := scaling# * y2 ;
2482 p_in := p_in rotated 180 shifted (w,0);
2483 p_out := p_out rotated 180 shifted (w,0);
2488 save walker_do_weight;
2489 walker_do_weight := 1.5;
2491 fet_beginchar ("Whole Walker dohead", "s0doWalker");
2492 draw_Walker_do_head (funk_notehead_width, 0, walker_do_weight);
2498 fet_beginchar ("Half up Walker dohead", "u1doWalker");
2499 draw_Walker_do_head (funk_notehead_width, 1, walker_do_weight);
2505 fet_beginchar ("Half down Walker dohead", "d1doWalker");
2506 draw_Walker_do_head (funk_notehead_width, 0, walker_do_weight);
2512 fet_beginchar ("Quarter up Walker dohead", "u2doWalker");
2513 draw_Walker_do_head (funk_notehead_width, 1, walker_do_weight);
2518 fet_beginchar ("Quarter down Walker dohead", "d2doWalker");
2519 draw_Walker_do_head (funk_notehead_width, 0, walker_do_weight);
2524 %%%%%% Walker re head
2525 % Parabolic on one side, shallow parabola on other
2526 % Has up and down shapes for *all* notes
2528 def draw_Walker_re_head (expr width_factor, thickness_factor) =
2529 set_char_box (0, width_factor * solfa_base_notewidth#,
2530 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
2533 offset := 2 * thickness_factor - 1;
2536 pen_radius := min (solfa_pen_radius,
2537 .3 * (h + d) / (1 + offset));
2539 pickup pencircle scaled (2 * pen_radius);
2542 dish_factor := 0.20;
2553 x4 = dish_factor [x1, x2];
2557 y5 = y1 + offset * pen_radius;
2560 x6 = x2 + pen_radius;
2563 y7 = y3 - offset * pen_radius;
2566 x8 = x4 - pen_radius;
2568 save path_a, path_d;
2569 path path_a, path_d;
2571 save p_a_start_dir, p_a_end_dir, p_a_start_perp, p_a_end_perp;
2572 pair p_a_start_dir, p_a_end_dir, p_a_start_perp, p_a_end_perp;
2574 path_a := z3 .. z4{down} .. z1;
2576 p_a_start_dir := unitvector(direction 0 of path_a);
2577 p_a_end_dir := unitvector(direction infinity of path_a);
2578 p_a_start_perp := (p_a_start_dir rotated 90) * pen_radius;
2579 p_a_end_perp := (p_a_end_dir rotated 90) * pen_radius;
2581 path_d := (z3 - p_a_start_perp){p_a_start_dir}
2583 ..(z1 - p_a_end_perp){p_a_end_dir};
2585 save path_b, path_c;
2586 path path_b, path_c;
2588 path_b := z5 {left} .. z6{up};
2589 path_c := z7 {left} .. z6{down};
2591 z9 = path_d intersectionpoint path_b;
2592 z10 = path_d intersectionpoint path_c;
2594 labels (range 1 thru 4);
2596 save p_up_in, p_up_out, p_down_in, p_down_out;
2597 path p_up_in, p_up_out, p_down_in, p_down_out;
2600 ... {right} z10 {p_a_start_dir}
2602 .. {p_a_end_dir} z9 {left}
2605 p_down_out := lft z2{up}
2608 .. (z3 + p_a_start_perp){p_a_start_dir}
2610 .. (z1 + p_a_end_perp) {p_a_end_dir}
2615 p_up_in := p_down_in rotated 180 shifted (w,0);
2616 p_up_out := p_down_out rotated 180 shifted (w,0);
2620 save walker_re_weight;
2621 walker_re_weight := 1.2;
2623 fet_beginchar ("Whole Walker rehead", "s0reWalker");
2624 draw_Walker_re_head (funk_notehead_width, walker_re_weight);
2630 fet_beginchar ("Half up Walker rehead", "u1reWalker");
2631 draw_Walker_re_head (funk_notehead_width, walker_re_weight);
2637 fet_beginchar ("Half down Walker rehead", "d1reWalker");
2638 draw_Walker_re_head (funk_notehead_width, walker_re_weight);
2644 fet_beginchar ("Quarter up Walker rehead", "u2reWalker");
2645 draw_Walker_re_head (funk_notehead_width, walker_re_weight);
2650 fet_beginchar ("Quarter down Walker rehead", "d2reWalker");
2651 draw_Walker_re_head (funk_notehead_width, walker_re_weight);
2656 %%%%%% Walker mi head
2658 % Symmetric for all hollow notes
2660 save walker_mi_width, walker_mi_weight;
2661 walker_mi_width := 1.2;
2662 walker_mi_weight := 1.5;
2664 fet_beginchar ("Whole Walker mihead", "s0miWalker");
2665 draw_mi_head (walker_mi_width * funk_notehead_width,
2666 walker_mi_weight, true);
2672 fet_beginchar ("Half Walker mihead", "s1miWalker");
2673 draw_mi_head (walker_mi_width * funk_notehead_width,
2674 walker_mi_weight, true);
2680 fet_beginchar ("Quarter Walker mihead", "s2miWalker");
2681 draw_mi_head (walker_mi_width * funk_notehead_width,
2682 walker_mi_weight, true);
2689 % Does not rotate for whole notes
2690 % Whole rotation is different from Funk, so special notes
2692 %%%%%% Funk sol head is the same as the others
2693 % Need special character because of skinnier head
2695 save walker_fa_weight;
2696 walker_fa_weight := 1.5;
2698 fet_beginchar ("Whole Walker fahead", "s0faWalker");
2699 draw_fa_head (funk_notehead_width, walker_fa_weight);
2705 fet_beginchar ("Half up Walker fahead", "u1faWalker");
2706 draw_fa_head (funk_notehead_width, walker_fa_weight);
2712 fet_beginchar ("Half down Walker fahead", "d1faWalker");
2713 draw_fa_head (funk_notehead_width, walker_fa_weight);
2719 fet_beginchar ("Quarter up Walker fahead", "u2faWalker");
2720 draw_fa_head (funk_notehead_width, walker_fa_weight);
2725 fet_beginchar ("Quarter down Walker fahead", "d2faWalker");
2726 draw_fa_head (funk_notehead_width, walker_fa_weight);
2732 % Same as Funk, no special notes
2735 %%%%%% Walker la head
2737 % Lighter weight requires separate notes
2739 save walker_la_weight;
2740 walker_la_weight := 1.5;
2742 fet_beginchar ("Whole Walker lahead", "s0laWalker");
2743 draw_la_head (funk_notehead_width, walker_la_weight);
2749 fet_beginchar ("Half Funk lahead", "s1laWalker");
2750 draw_la_head (funk_notehead_width, walker_la_weight);
2756 fet_beginchar ("Quarter Funk lahead", "s2laWalker");
2757 draw_la_head (funk_notehead_width, walker_la_weight);
2762 %%%%%% Walker ti head
2763 % Triangular arrowhead
2764 % Rotates for all but whole notes
2766 def draw_Walker_ti_head (expr width_factor, thickness_factor) =
2767 set_char_box (0, width_factor * solfa_base_notewidth#,
2768 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
2771 offset := 2 * thickness_factor - 1;
2774 pen_radius := min (solfa_pen_radius,
2775 .3 * (h + d) / (1 + offset));
2777 pickup pencircle scaled (2 * pen_radius);
2789 labels (range 1 thru 4);
2791 save nw_dist, sw_dist, ne, se;
2792 pair nw_dist, sw_dist, ne, se;
2794 ne = unitvector (z2 - z1);
2795 se = unitvector (z3 - z1);
2797 nw_dist = (ne rotated 90) * pen_radius ;
2798 sw_dist = (se rotated -90) * pen_radius;
2801 save path_a, path_b, path_c;
2802 path path_a, path_b, path_c;
2803 path_a := z2 - nw_dist * offset
2804 -- z1 - nw_dist * offset;
2805 path_b := z3 - sw_dist * offset
2806 -- z1 - sw_dist * offset;
2807 path_c := z2 + left * pen_radius
2808 -- z3 + left * pen_radius;
2810 z4 = path_a intersectionpoint path_b;
2811 z5 = path_a intersectionpoint path_c;
2812 z6 = path_b intersectionpoint path_c;
2814 save p_up_in, p_down_in, p_up_out, p_down_out;
2815 path p_up_in, p_down_in, p_up_out, p_down_out;
2822 p_down_out := lft z1{up}
2823 .. (z1 + nw_dist){ne}
2824 -- (z2 + nw_dist){ne}
2829 .. (z3 + sw_dist){- se}
2830 .. (z1 + sw_dist){- se}
2833 p_up_in := p_down_in rotated 180 shifted (w, 0);
2834 p_up_out := p_down_out rotated 180 shifted (w, 0);
2838 save walker_ti_weight;
2839 walker_ti_weight := 1.4;
2841 fet_beginchar ("Whole Walker tihead", "s0tiWalker");
2842 draw_Walker_ti_head (funk_notehead_width, walker_ti_weight);
2848 fet_beginchar ("Half up Walker tihead", "u1tiWalker");
2849 draw_Walker_ti_head (funk_notehead_width, walker_ti_weight);
2855 fet_beginchar ("Half down Walker tihead", "d1tiWalker");
2856 draw_Walker_ti_head (funk_notehead_width, walker_ti_weight);
2862 fet_beginchar ("Quarter up Walker tihead", "u2tiWalker");
2863 draw_Walker_ti_head (funk_notehead_width, walker_ti_weight);
2868 fet_beginchar ("Quarter down Walker tihead", "d2tiWalker");
2869 draw_Walker_ti_head (funk_notehead_width, walker_ti_weight);
2873 fet_endgroup ("noteheads");
2877 % we derive black_notehead_width# from the quarter head,
2878 % so we have to define black_notehead_width (pixel qty)
2879 % after the black_notehead_width# itself.
2881 % Let's keep it outside the group as well.
2884 define_pixels (black_notehead_width);