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));
85 def draw_longa (expr up) =
86 save stemthick, fudge;
88 stemthick# = 2 stafflinethickness#;
89 define_whole_blacker_pixels (stemthick);
91 % Longas of smaller design sizes should have their lines farther
92 % apart (the overlap with notehead ellipsoid should be smaller).
93 fudge = hround (blot_diameter
96 - (20 / (design_size + 4)))),
99 draw_outside_ellipse (1.80, 0, 0.707, 0);
100 undraw_inside_ellipse (1.30, 125, 0.68, 2 stafflinethickness#);
102 set_char_box (stemthick#,
107 pickup pencircle scaled stemthick;
109 % Longas of smaller design sizes should have their lines longer.
110 line_length := min (max (0.7, (64/60 - (design_size / 60))), 0.85);
112 % Line lengths between 0.72 and 0.77 are not nice
113 % because they are neither separate nor connected
114 % when there is an interval of fourth.
115 if line_length < 0.75:
116 quanted_line_length := min (0.72, line_length);
118 quanted_line_length := max (0.77, line_length);
121 final_line_length := quanted_line_length * staff_space;
124 bot y1 = -final_line_length;
125 top y2 = final_line_length;
129 fudge + lft x3 = width;
131 top y4 = h + 3.0 staff_space;
134 bot y1 = -d - 3.0 staff_space;
135 top y2 = final_line_length;
139 fudge + lft x3 = width;
142 bot y3 = -final_line_length;
145 draw_gridline (z1, z2, stemthick);
146 draw_gridline (z3, z4, stemthick);
152 fet_beginchar ("Longa notehead", "uM2");
155 draw_staff (-2, 2, 0);
159 fet_beginchar ("Longa notehead", "dM2");
162 draw_staff (-2, 2, 0);
167 fet_beginchar ("Longa notehead", "uM2");
170 draw_staff (-2, 2, 0.5);
174 fet_beginchar ("Longa notehead", "dM2");
177 draw_staff (-2, 2, 0.5);
182 def draw_brevis (expr linecount, line_thickness_multiplier) =
183 save stemthick, fudge, gap;
185 stemthick# = line_thickness_multiplier * 2 * stafflinethickness#;
186 define_whole_blacker_pixels (stemthick);
188 % double-lined breves of smaller design sizes should have
189 % bigger gap between the lines.
190 gap# := (0.95 - 0.008 * design_size) * stemthick#;
192 % Breves of smaller design sizes should have their lines farther
193 % apart (the overlap with notehead ellipsoid should be smaller).
194 fudge = hround (blot_diameter
197 - (20 / (design_size + 4))
201 draw_outside_ellipse (1.80, 0, 0.707, 0);
202 undraw_inside_ellipse (1.30, 125, 0.68, 2 stafflinethickness#);
204 set_char_box (stemthick# * linecount + gap# * (linecount - 1),
205 width# + stemthick# * linecount + gap# * (linecount - 1),
210 pickup pencircle scaled stemthick;
212 % Breves of smaller design sizes should have their lines longer.
213 line_length := min (max (0.7, (64/60 - (design_size / 60))), 0.85);
215 % Line lengths between 0.72 and 0.77 are not nice
216 % because they are neither separate nor connected
217 % when there is an interval of fourth.
218 if line_length < 0.75:
219 quanted_line_length := min (0.72, line_length);
221 quanted_line_length := max (0.77, line_length);
224 bot y1 = -quanted_line_length * staff_space;
225 top y2 = quanted_line_length * staff_space;
229 fudge + lft x3 = width;
234 for i := 0 step 1 until linecount - 1:
235 line_distance := i * (gap + stemthick);
236 draw_gridline (z1 - (line_distance, 0),
237 z2 - (line_distance, 0),
239 draw_gridline (z3 + (line_distance, 0),
240 z4 + (line_distance, 0),
246 fet_beginchar ("Brevis notehead", "sM1");
249 draw_staff (-2, 2, 0);
254 fet_beginchar ("Brevis notehead", "sM1");
257 draw_staff (-2, 2, 0.5);
262 fet_beginchar ("Double-lined brevis notehead", "sM1double");
263 draw_brevis (2, 0.8);
265 draw_staff (-2, 2, 0);
270 fet_beginchar ("Double-lined brevis notehead", "sM1double");
271 draw_brevis (2, 0.8);
273 draw_staff (-2, 2, 0.5);
278 fet_beginchar ("Whole notehead", "s0");
279 draw_outside_ellipse (1.80 - puff_up_factor / 3.0, 0, 0.707, 0);
280 undraw_inside_ellipse (1.30, 125 - puff_up_factor * 10,
281 0.68, 2 stafflinethickness#);
283 whole_notehead_width# := charwd;
285 draw_staff (-2, 2, 0);
290 fet_beginchar ("Whole notehead", "s0");
291 draw_outside_ellipse (1.80 - puff_up_factor / 3.0, 0,
293 undraw_inside_ellipse (1.30, 125 - puff_up_factor * 10,
294 0.68, 2 stafflinethickness#);
296 draw_staff (-2, 2, 0.5);
301 fet_beginchar ("Half notehead", "s1");
302 draw_outside_ellipse (1.53 - puff_up_factor / 3.0, 34, 0.66, 0.17);
303 undraw_inside_ellipse (3.25, 33, 0.81, 2.5 stafflinethickness#);
305 half_notehead_width# := charwd;
307 draw_staff (-2, 2, 0);
312 fet_beginchar ("Half notehead", "s1");
313 draw_outside_ellipse (1.53 - puff_up_factor / 3.0, 34,
315 undraw_inside_ellipse (3.25, 33, 0.81,
316 2.5 stafflinethickness#);
318 draw_staff (-2, 2, 0.5);
323 fet_beginchar ("Quarter notehead", "s2");
325 draw_staff (-2, 2, 0);
330 fet_beginchar ("Quarter notehead", "s2");
331 draw_outside_ellipse (1.49 - puff_up_factor / 3.0, 31,
334 draw_staff (-2, 2, 0.5);
339 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
342 fet_beginchar ("Whole diamondhead", "s0diamond");
343 draw_outside_ellipse (1.80, 0, 0.495, 0);
344 undraw_inside_ellipse (1.30, 125, 0.6,
345 .4 staff_space# + stafflinethickness#);
347 draw_staff (-2, 2, 0);
352 fet_beginchar ("Whole diamondhead", "s0diamond");
353 draw_outside_ellipse (1.80, 0, 0.495, 0);
354 undraw_inside_ellipse (1.30, 125, 0.6,
355 .4 staff_space# + stafflinethickness#);
357 draw_staff (-2, 2, 0.5);
362 fet_beginchar ("Half diamondhead", "s1diamond");
363 draw_outside_ellipse (1.50, 34, 0.49, 0.17);
364 undraw_inside_ellipse (3.5, 33, 0.80,
365 .3 staff_space# + 1.5 stafflinethickness#);
367 draw_staff (-2, 2, 0);
372 fet_beginchar ("Half diamondhead", "s1diamond");
373 draw_outside_ellipse (1.50, 34, 0.49, 0.17);
374 undraw_inside_ellipse (3.5, 33, 0.80,
376 + 1.5 stafflinethickness#);
378 draw_staff (-2, 2, 0.5);
383 fet_beginchar ("Quarter diamondhead", "s2diamond");
384 draw_outside_ellipse (1.80, 35, 0.495, -0.25);
386 draw_staff (-2, 2, 0);
391 fet_beginchar ("Quarter diamondhead", "s2diamond");
392 draw_outside_ellipse (1.80, 35, 0.495, -0.25);
394 draw_staff (-2, 2, 0.5);
399 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
402 vardef penposx@# (expr d) =
412 z@#l = pat intersectionpoint (z@# -- infinity * dir (d + 180));
413 z@#r = pat intersectionpoint (z@# -- infinity * dir (d));
419 % UGH: xs not declared as argument.
421 def define_triangle_shape (expr stemdir) =
422 save triangle_a, triangle_b, triangle_c;
423 save triangle_out_a, triangle_out_b, triangle_out_c;
424 save triangle_in, triangle_out;
425 save width, depth, height;
426 save origin, left_up_dir;
427 save exact_left_point, exact_right_point, exact_down_point;
429 path triangle_a, triangle_b, triangle_c;
430 path triangle_out_a, triangle_out_b, triangle_out_c;
431 path triangle_in, triangle_out;
432 pair origin, left_up_dir;
433 pair exact_down_point, exact_left_point, exact_right_point;
436 pen_thick# = stafflinethickness# + .1 staff_space#;
437 define_pixels (llap);
438 define_blacker_pixels (pen_thick);
440 left_up_dir = llap# * dir (90 + tilt);
442 xpart (left_up_dir) * xs - (pen_thick# * xs) / 2 + xpart origin = 0;
445 exact_left_point := origin + (left_up_dir xscaled xs);
446 exact_down_point := origin + (left_up_dir rotated 120 xscaled xs);
447 exact_right_point := origin + (left_up_dir rotated 240 xscaled xs);
449 height# = ypart (exact_left_point + origin) + pen_thick# / 2;
450 depth# = -ypart (exact_down_point + origin) + pen_thick# / 2;
451 width# = xpart (exact_right_point - exact_left_point)
454 set_char_box (0, width#, depth#, height#);
456 % Formerly, the shape has simply been drawn with an elliptical pen
457 % (`scaled pen_thick xscaled xs'), but the envelope of such a curve
458 % is of 6th degree. For the sake of mf2pt1, we approximate it.
460 pickup pencircle scaled pen_thick xscaled xs;
462 z0 = (hround_pixels (xpart origin), 0);
464 z1 = z1' = z0 + llap * dir (90 + tilt) xscaled xs;
465 z2 = z2' = z0 + llap * dir (90 + tilt + 120) xscaled xs;
466 z3 = z3' = z0 + llap * dir (90 + tilt + 240) xscaled xs;
468 z12 = caveness [.5[z1, z2], z3];
469 z23 = caveness [.5[z2, z3], z1];
470 z31 = caveness [.5[z3, z1], z2];
472 triangle_a = z1 .. z12 .. z2;
473 triangle_b = z2 .. z23 .. z3;
474 triangle_c = z3 .. z31 .. z1;
476 penposx1 (angle (direction 0 of triangle_a) - 90);
477 penposx2 (angle (direction 0 of triangle_b) - 90);
478 penposx3 (angle (direction 0 of triangle_c) - 90);
480 penposx1' (angle (direction infinity of triangle_c) + 90);
481 penposx2' (angle (direction infinity of triangle_a) + 90);
482 penposx3' (angle (direction infinity of triangle_b) + 90);
484 penposx12 (angle (z12 - z0));
485 penposx23 (angle (z23 - z0));
486 penposx31 (angle (z31 - z0));
488 z10 = (z0 -- z1) intersectionpoint (z1l .. z12l .. z2'r);
489 z20 = (z0 -- z2) intersectionpoint (z2l .. z23l .. z3'r);
490 z30 = (z0 -- z3) intersectionpoint (z3l .. z31l .. z1'r);
503 triangle_out_a = z1r .. z12r .. z2'l;
504 triangle_out_b = z2r .. z23r .. z3'l;
505 triangle_out_c = z3r .. z31r .. z1'l;
507 triangle_out = top z1
509 .. z1r{direction 0 of triangle_out_a}
511 & {direction infinity of triangle_out_a}z2'l
514 .. z2r{direction 0 of triangle_out_b}
516 & {direction infinity of triangle_out_b}z3'l
519 .. z3r{direction 0 of triangle_out_c}
521 & {direction infinity of triangle_out_c}z1'l
524 labels (0, 10, 20, 30);
525 penlabels (1, 1', 2, 2', 3, 3', 12, 23, 31);
529 charwy := ypart exact_right_point;
530 charwx := xpart exact_right_point + .5 pen_thick# * xs;
532 charwy := -ypart exact_down_point;
533 charwx := width# - (xpart exact_down_point - .5 pen_thick# * xs);
538 def draw_whole_triangle_head =
544 llap# = 3/4 noteheight#;
548 define_triangle_shape (1);
554 fet_beginchar ("Whole trianglehead", "s0triangle");
555 draw_whole_triangle_head;
557 draw_staff (-2, 2, 0);
562 fet_beginchar ("Whole trianglehead", "s0triangle");
563 draw_whole_triangle_head;
565 draw_staff (-2, 2, 0.5);
570 def draw_small_triangle_head (expr dir) =
576 llap# = 2/3 noteheight#;
579 define_triangle_shape (dir);
583 filldraw triangle_out;
584 unfilldraw triangle_in;
588 fet_beginchar ("Half trianglehead (downstem)", "d1triangle");
589 draw_small_triangle_head (-1);
591 draw_staff (-2, 2, 0);
595 fet_beginchar ("Half trianglehead (upstem)", "u1triangle");
596 draw_small_triangle_head (1);
598 draw_staff (-2, 2, 0.5);
602 def draw_closed_triangle_head (expr dir) =
608 llap# = 2/3 noteheight#;
611 define_triangle_shape (dir);
616 fet_beginchar ("Quarter trianglehead (upstem)", "u2triangle");
617 draw_closed_triangle_head (1);
619 draw_staff (-2, 2, 0);
623 fet_beginchar ("Quarter trianglehead (downstem)", "d2triangle");
624 draw_closed_triangle_head (-1);
626 draw_staff (-2, 2, 0.5);
630 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
632 % Slash heads are for indicating improvisation. They are
633 % twice as high as normal heads.
635 def draw_slash (expr hwid_hash) =
639 exact_height = staff_space# + stafflinethickness# / 2;
641 set_char_box (0, 2 exact_height / slash_slope + hwid_hash,
642 exact_height, exact_height);
651 pickup pencircle scaled blot_diameter;
656 lft x2 = 2 h / slash_slope;
663 ne = unitvector (z3 - z4);
664 nw_dist = (ne rotated 90) * 0.5 blot_diameter;
667 .. (z1 + nw_dist){ne}
668 -- (z2 + nw_dist){ne}
671 .. (z3 - nw_dist){-ne}
672 -- (z4 - nw_dist){-ne}
676 if hwid_hash > 2 slash_thick#:
679 th = slash_thick - blot_diameter;
684 z6 - z5 = whatever * ne;
685 z8 - z7 = whatever * ne;
687 z5 = z1 + whatever * ne + th * (ne rotated -90);
688 z8 = z4 + whatever * ne + th * (ne rotated 90);
696 labels (range 1 thru 10);
700 fet_beginchar ("Whole slashhead", "s0slash");
701 draw_slash (4 slash_thick# + 0.5 staff_space#);
703 draw_staff (-2, 2, 0);
707 fet_beginchar ("Half slashhead", "s1slash");
708 draw_slash (3.0 slash_thick# + 0.15 staff_space#);
710 draw_staff (-2, 2, 0);
714 fet_beginchar ("Quarter slashhead", "s2slash");
715 draw_slash (1.5 slash_thick#);
717 draw_staff (-2, 2, 0);
721 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
723 % `thick' is the distance between the NE/SW parallel lines in the cross
724 % (distance between centres of lines) in multiples of stafflinethickness
726 def draw_cross (expr thick) =
728 save ne_dist, nw_dist, rt_dist, up_dist;
729 save crz_in, crz_out;
732 pair ne_dist, nw_dist, rt_dist, up_dist;
733 path crz_in, crz_out;
735 pen_thick# := 1.2 stafflinethickness#;
736 thickness# := thick * stafflinethickness#;
737 define_pixels (thickness);
738 define_blacker_pixels (pen_thick);
740 pickup pencircle scaled pen_thick;
745 ne = unitvector ((1, (2 h - pen_thick) / (w - pen_thick)));
748 z4 - z5 = whatever * ne;
750 z6 - z3 = whatever * ne;
751 z3 - z4 = whatever * (ne yscaled -1);
753 z4 - z3 = whatever * (ne) + (ne rotated -90) * thickness;
756 x1 = charwd / 2 - .5 pen_thick#;
758 + thick / 2 * stafflinethickness# * (ne rotated -90);
760 % labels (1, 2, 3, 4, 5, 6);
762 nw = unitvector (z3 - z4);
764 up_dist = up * 0.5 pen_thick / cosd (angle (ne));
765 rt_dist = right * 0.5 pen_thick / sind (angle (ne));
766 nw_dist = (ne rotated 90) * 0.5 pen_thick;
767 ne_dist = (nw rotated -90) * 0.5 pen_thick;
773 x4 := hround (x4' + .5 pen_thick) - .5 pen_thick;
774 x5 := hfloor (x5' + xpart rt_dist) - xpart rt_dist;
775 y6 := vfloor (y6' + ypart up_dist) - ypart up_dist;
777 crz_out = (z6 + up_dist)
778 -- (z3 + nw_dist){ne}
780 .. (z3 + ne_dist){-nw}
781 -- (z4 + ne_dist){-nw}
783 .. (z4 - nw_dist){-ne}
785 crz_out := crz_out shifted (0, feta_shift)
786 -- reverse crz_out yscaled -1 shifted (0, -feta_eps);
788 -- reverse crz_out xscaled -1 shifted (-feta_eps, 0)
792 x4 := hround (x4' - xpart rt_dist) + xpart rt_dist;
793 x5 := hceiling (x5' - .5 pen_thick) + .5 pen_thick;
794 y6 := vfloor (y6' - .5 pen_thick) + .5 pen_thick;
796 crz_in = (bot z6){right}
797 .. (z6 - nw_dist){ne}
800 -- (z5 + nw_dist){-ne}
802 crz_in := crz_in shifted (0, feta_shift)
803 -- reverse crz_in yscaled -1 shifted (0, -feta_eps);
805 -- reverse crz_in xscaled -1 shifted (-feta_eps, 0)
810 currentpicture := currentpicture shifted (hround (w / 2), 0);
813 charwy := y1 + feta_shift;
815 z12 = (charwx * hppp, y1 * vppp);
821 fet_beginchar ("Whole Crossed notehead", "s0cross");
824 wid# := black_notehead_width# + 4 stafflinethickness#;
825 hei# := noteheight# + stafflinethickness#;
827 set_char_box (0, wid#, hei# / 2, hei# / 2);
831 remember_pic := currentpicture;
833 draw_staff (-2, 2, 0);
838 fet_beginchar ("Whole Crossed notehead", "s0cross");
841 wid# := black_notehead_width# + 4 stafflinethickness#;
842 hei# := noteheight# + stafflinethickness#;
844 set_char_box (0, wid#, hei# / 2, hei# / 2);
846 currentpicture := remember_pic;
848 draw_staff (-2, 2, 0.5);
853 fet_beginchar ("Half Crossed notehead", "s1cross");
856 wid# := black_notehead_width# + 2 stafflinethickness#;
857 hei# := noteheight# + stafflinethickness# / 2;
859 set_char_box (0, wid#, hei# / 2, hei# / 2);
863 remember_pic := currentpicture;
865 draw_staff (-2, 2, 0);
870 fet_beginchar ("Half Crossed notehead", "s1cross");
873 wid# := black_notehead_width# + 2 stafflinethickness#;
874 hei# := noteheight# + stafflinethickness# / 2;
876 set_char_box (0, wid#, hei# / 2, hei# / 2);
878 currentpicture := remember_pic;
880 draw_staff (-2, 2, 0.5);
885 fet_beginchar ("Crossed notehead", "s2cross");
886 wid# := black_notehead_width#;
888 set_char_box (0, wid#, hei# / 2, hei# / 2);
892 remember_pic := currentpicture;
894 draw_staff (-2, 2, 0);
899 fet_beginchar ("Crossed notehead", "s2cross");
900 wid# := black_notehead_width#;
902 set_char_box (0, wid#, hei# / 2, hei# / 2);
904 currentpicture := remember_pic;
906 draw_staff (-2, 2, 0.5);
911 fet_beginchar ("X-Circled notehead", "s2xcircle");
913 save cthick, cxd, cyd, dy;
915 wid# := black_notehead_width# * sqrt (sqrt2);
916 hei# := noteheight# * sqrt (sqrt2);
918 set_char_box (0, wid#, hei# / 2, hei# / 2);
920 d := d - feta_space_shift;
922 cthick# := (1.2 + 1/4) * stafflinethickness#;
923 define_blacker_pixels (cthick);
926 cyd := h + d - cthick / 2;
930 pickup pencircle scaled cthick;
932 fill fullcircle xscaled (cxd + cthick)
933 yscaled (cyd + cthick)
935 unfill fullcircle xscaled (cxd - cthick)
936 yscaled (cyd - cthick)
939 xpos := .5 cxd / sqrt2;
940 ypos := .5 cyd / sqrt2;
942 pickup penrazor scaled cthick rotated (angle (xpos, ypos) + 90);
943 draw (-xpos + w / 2, -ypos + dy)
944 -- (xpos + w / 2, ypos + dy);
946 pickup penrazor scaled cthick rotated (angle (xpos, -ypos) + 90);
947 draw (-xpos + w / 2, ypos + dy)
948 -- (xpos + w / 2, -ypos + dy);
953 z12 = (charwx * hppp, charwy * vppp);
956 remember_pic := currentpicture;
958 draw_staff (-2, 2, 0);
963 fet_beginchar ("X-Circled notehead", "s2xcircle");
965 save cthick, cxr, cyr;
967 wid# := black_notehead_width# * sqrt (sqrt2);
968 hei# := noteheight# * sqrt (sqrt2);
970 set_char_box (0, wid#, hei# / 2, hei# / 2);
972 currentpicture := remember_pic;
974 draw_staff (-2, 2, 0.5);
984 % Note: For whole and half notes, the `fill' curve (p_out) is offset from
985 % the points that specify the outer geometry, because we need to add
986 % the rounding. In contrast, the inner curve is not offset, because
987 % there is no rounding.
989 % This means that to get a line of thick_factor * pen_thickness,
990 % we need to offset the inner curve by
992 % (thick_factor - 0.5) * pen_thickness
996 % (2 * thick_factor - 1) * half_pen_thickness
998 save solfa_pen_thick;
999 solfa_pen_thick# = 1.3 stafflinethickness#;
1000 define_blacker_pixels (solfa_pen_thick);
1002 save solfa_pen_radius;
1003 solfa_pen_radius = 0.5 solfa_pen_thick;
1005 save solfa_base_notewidth;
1006 solfa_base_notewidth# := black_notehead_width#;
1008 solfa_whole_width := 1.0;
1009 solfa_half_width := 1.0;
1010 solfa_quarter_width := 1.0;
1015 % Triangle with base parallel to staff lines.
1018 def draw_do_head (expr width_factor, dir, thickness_factor) =
1020 save left_dist, right_dist, bottom_dist;
1022 pair left_dist, right_dist, bottom_dist;
1024 set_char_box (0, width_factor * solfa_base_notewidth#,
1025 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1027 bottom_thick_factor := 2 * thickness_factor - 1;
1028 % no different thickness for left side if we want uniform thickness
1029 if thickness_factor = 1:
1030 left_thick_factor := 1;
1032 left_thick_factor := 0.7 * bottom_thick_factor;
1036 pen_radius := min (solfa_pen_radius,
1037 (h + d) / (3 * (1 + bottom_thick_factor)));
1039 pickup pencircle scaled (2 * pen_radius);
1048 left_dist = (unitvector (z3 - z1) rotated 90) * pen_radius;
1049 right_dist = (unitvector (z2 - z3) rotated 90) * pen_radius;
1050 bottom_dist = (0,1) * pen_radius;
1054 save point_a, point_b, point_c;
1055 pair point_a, point_b, point_c;
1057 pa := (z1 - left_thick_factor * left_dist)
1058 -- (z3 - left_thick_factor * left_dist);
1059 pb := (z1 + bottom_thick_factor * bottom_dist)
1060 -- (z2 + bottom_thick_factor * bottom_dist);
1061 pc := (z2 - right_dist)
1062 -- (z3 - right_dist);
1064 point_a := pa intersectionpoint pb;
1065 point_b := pb intersectionpoint pc;
1066 point_c := pc intersectionpoint pa;
1076 .. (z2 + right_dist){z3 - z2}
1077 -- (z3 + right_dist){z3 - z2}
1079 .. (z3 + left_dist){z1 - z3}
1080 -- (z1 + left_dist){z1 - z3}
1087 charwy := -chardp + 0.5 stafflinethickness#;
1097 fet_beginchar ("Whole dohead", "s0do");
1098 draw_do_head (solfa_whole_width, 1, do_weight);
1104 fet_beginchar ("Half dohead", "d1do");
1105 draw_do_head (solfa_half_width, -1, do_weight);
1111 fet_beginchar ("Half dohead", "u1do");
1112 draw_do_head (solfa_half_width, 1, do_weight);
1118 fet_beginchar ("Quarter dohead", "d2do");
1119 draw_do_head (solfa_quarter_width, -1, do_weight);
1124 fet_beginchar ("Quarter dohead", "u2do");
1125 draw_do_head (solfa_quarter_width, 1, do_weight);
1130 fet_beginchar ("Whole thin dohead", "s0doThin");
1131 draw_do_head (solfa_whole_width, 1, 1);
1137 fet_beginchar ("Half thin dohead", "d1doThin");
1138 draw_do_head (solfa_half_width, -1, 1);
1144 fet_beginchar ("Half thin dohead", "u1doThin");
1145 draw_do_head (solfa_half_width, 1, 1);
1151 fet_beginchar ("Quarter thin dohead", "d2doThin");
1152 draw_do_head (solfa_quarter_width, -1, 1);
1157 fet_beginchar ("Quarter thin dohead", "u2doThin");
1158 draw_do_head (solfa_quarter_width, 1, 1);
1164 % re - flat top, curved bottom:
1168 % .. {dir 90} (w,h/2)
1171 % (broader along the base and with more vertical sides for half and
1174 % Note: According to some shape-note singers, there should be no size
1175 % differences for half and whole notes, contrary to the comment above.
1176 % Consequently, we have made them all the same width.
1178 % stem attachment: h/2
1180 def draw_re_head (expr width_factor, dir, thickness_factor) =
1184 set_char_box (0, width_factor * solfa_base_notewidth#,
1185 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1188 offset = (2 * thickness_factor - 1);
1195 pen_radius := min (solfa_pen_radius,
1196 (h + d) * (1-curve_start) / (1+ offset));
1198 pickup pencircle scaled (2 * pen_radius);
1203 y2 = curve_start [y3, y1];
1211 labels (range 1 thru 5);
1213 p_in := (z1 + pen_radius * (1, -1 * offset))
1215 .. ((top z3) + (0, offset * pen_radius))
1217 -- (z5 + pen_radius * (-1, -1 * offset))
1230 charwy := curve_start [-chardp, charht];
1241 fet_beginchar ("Whole rehead", "s0re");
1242 draw_re_head (solfa_whole_width, 1, re_weight);
1248 fet_beginchar ("Half up rehead", "u1re");
1249 draw_re_head (solfa_half_width, 1, re_weight);
1255 fet_beginchar ("Half down rehead", "d1re");
1256 draw_re_head (solfa_half_width, -1, re_weight);
1262 fet_beginchar ("Quarter up rehead", "u2re");
1263 draw_re_head (solfa_quarter_width, 1, re_weight);
1268 fet_beginchar ("Quarter down rehead", "d2re");
1269 draw_re_head (solfa_quarter_width, -1, re_weight);
1274 fet_beginchar ("Whole thin rehead", "s0reThin");
1275 draw_re_head (solfa_whole_width, 1, 1);
1281 fet_beginchar ("Half up thin rehead", "u1reThin");
1282 draw_re_head (solfa_half_width, 1, 1);
1288 fet_beginchar ("Half down thin rehead", "d1reThin");
1289 draw_re_head (solfa_half_width, -1, 1);
1295 fet_beginchar ("Quarter thin rehead", "u2reThin");
1296 draw_re_head (solfa_quarter_width, 1, 1);
1301 fet_beginchar ("Quarter thin rehead", "d2reThin");
1302 draw_re_head (solfa_quarter_width, -1, 1);
1307 %%%% mi head -- diamond shape
1309 % two versions, depending on whether the `strong' lines are on the nw & se
1312 def draw_mi_head (expr width_factor, thickness_factor, mirror) =
1313 save path_out, path_in;
1314 save ne_dist, se_dist, ne, se;
1315 save path_a, path_b, path_c, path_d;
1316 path path_out, path_in;
1317 pair ne_dist, se_dist, ne, se;
1318 path path_a, path_b, path_c, path_d;
1322 set_char_box (0, width_factor * solfa_base_notewidth#,
1323 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1326 offset := 2 * thickness_factor - 1;
1330 note_diagonal := w / 2 ++ (h + d) / 2;
1334 pen_radius := min (solfa_pen_radius,
1335 .3 * note_diagonal / (1 + offset));
1337 pickup pencircle scaled (2 * pen_radius);
1348 % inner sides are parallel to outer sides
1349 z6 - z5 = whatever * (z2 - z1);
1350 z8 - z7 = whatever * (z4 - z3);
1351 z8 - z5 = whatever * (z4 - z1);
1352 z7 - z6 = whatever * (z3 - z2);
1354 ne = unitvector (z4 - z1);
1355 se = unitvector (z2 - z1);
1357 ne_dist = (ne rotated 90) * pen_radius;
1358 se_dist = (se rotated 90) * pen_radius;
1360 path_a := (z1 + se_dist)
1362 path_b := (z2 + (ne_dist * offset))
1363 -- (z3 + (ne_dist * offset));
1364 path_c := (z3 - se_dist)
1366 path_d := (z4 - (ne_dist * offset))
1367 -- (z1 - (ne_dist * offset));
1369 z5 = path_a intersectionpoint path_d;
1370 z7 = path_b intersectionpoint path_c;
1372 labels (range 1 thru 8);
1381 path_in := inner_path;
1383 path_in := inner_path reflectedabout (z2, z4);
1386 path_out := lft z1 {down}
1387 .. (z1 - se_dist){se}
1388 -- (z2 - se_dist){se}
1390 .. (z2 - ne_dist){ne}
1391 -- (z3 - ne_dist){ne}
1393 .. (z3 + se_dist){-se}
1394 -- (z4 + se_dist){-se}
1396 .. (z4 + ne_dist){-ne}
1397 -- (z1 + ne_dist){-ne}
1402 save mi_weight, mi_width;
1406 fet_beginchar ("Whole mihead", "s0mi");
1407 draw_mi_head (mi_width * solfa_whole_width, mi_weight, false);
1413 fet_beginchar ("Half mihead", "s1mi");
1414 draw_mi_head (mi_width * solfa_quarter_width, mi_weight, false);
1420 fet_beginchar ("Quarter mihead", "s2mi");
1421 draw_mi_head (mi_width * solfa_quarter_width, mi_weight, false);
1426 fet_beginchar ("Whole mirror mihead", "s0miMirror");
1427 draw_mi_head (mi_width * solfa_whole_width, mi_weight, true);
1433 fet_beginchar ("Half mirror mihead", "s1miMirror");
1434 draw_mi_head (mi_width * solfa_quarter_width, mi_weight, true);
1440 fet_beginchar ("Quarter mirror mihead", "s2miMirror");
1441 draw_mi_head (mi_width * solfa_quarter_width, mi_weight, true);
1446 fet_beginchar ("Whole thin mihead", "s0miThin");
1447 draw_mi_head (mi_width * solfa_whole_width, 1, false);
1453 fet_beginchar ("Half thin mihead", "s1miThin");
1454 draw_mi_head (mi_width * solfa_quarter_width, 1, false);
1460 fet_beginchar ("Quarter thin mihead", "s2miThin");
1461 draw_mi_head (mi_width * solfa_quarter_width, 1, false);
1468 % Right triangle, hypotenuse from nw to se corner. Stem attaches on
1469 % vertical side in direction of horizontal side.
1471 def draw_fa_head (expr width_factor, thickness_factor) =
1472 set_char_box (0, width_factor * solfa_base_notewidth#,
1473 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1475 save p_down_in, p_down_out, p_up_in, p_up_out, nw_dist, nw;
1476 path p_down_in, p_down_out, p_up_in, p_up_out;
1477 save path_a, path_b, path_c;
1478 path path_a, path_b, path_c;
1482 offset := 2 * thickness_factor - 1;
1485 pen_radius := min (solfa_pen_radius,
1486 .33 * (h + d) / (1 + offset));
1488 pickup pencircle scaled (2 * pen_radius);
1501 labels (1, 2, 3, 4);
1503 nw = unitvector (z1 - z3);
1504 nw_dist = (nw rotated 90) * pen_radius;
1506 path_a := (z1 - (0,1) * offset * pen_radius)
1507 -- (z2 - (0,1) * offset * pen_radius);
1508 path_b := (z2 - (1,0) * pen_radius)
1509 -- (z3 - (1,0) * pen_radius);
1510 path_c := (z3 - nw_dist)
1513 p_up_in := (path_a intersectionpoint path_b)
1514 -- (path_b intersectionpoint path_c)
1515 -- (path_c intersectionpoint path_a)
1518 p_up_out := lft z1{down}
1519 .. (z1 + nw_dist){-nw}
1520 -- (z3 + nw_dist){-nw}
1528 p_down_in := p_up_in rotated 180 shifted (w, 0);
1529 p_down_out := p_up_out rotated 180 shifted (w, 0);
1538 fet_beginchar ("Whole fa up head", "u0fa");
1539 draw_fa_head (solfa_whole_width, fa_weight);
1545 fet_beginchar ("Whole fa down head", "d0fa");
1546 draw_fa_head (solfa_whole_width, fa_weight);
1552 fet_beginchar ("half fa up head", "u1fa");
1553 draw_fa_head (solfa_half_width, fa_weight);
1559 fet_beginchar ("Half fa down head", "d1fa");
1560 draw_fa_head (solfa_half_width, fa_weight);
1566 fet_beginchar ("Quarter fa up head", "u2fa");
1567 draw_fa_head (solfa_quarter_width, fa_weight);
1572 fet_beginchar ("Quarter fa down head", "d2fa");
1573 draw_fa_head (solfa_quarter_width, fa_weight);
1578 fet_beginchar ("Whole thin fa up head", "u0faThin");
1579 draw_fa_head (solfa_whole_width, 1);
1585 fet_beginchar ("Whole thin fa down head", "d0faThin");
1586 draw_fa_head (solfa_whole_width, 1);
1592 fet_beginchar ("half thin fa up head", "u1faThin");
1593 draw_fa_head (solfa_half_width, 1);
1599 fet_beginchar ("Half thin fa down head", "d1faThin");
1600 draw_fa_head (solfa_half_width, 1);
1606 fet_beginchar ("Quarter thin fa up head", "u2faThin");
1607 draw_fa_head (solfa_quarter_width, 1);
1612 fet_beginchar ("Quarter thin fa down head", "d2faThin");
1613 draw_fa_head (solfa_quarter_width, 1);
1621 % Note: sol head is the same shape as a standard music head, and doesn't
1622 % vary from style to style. However, width is constant with duration,
1623 % so we can't just use the standard note font.
1625 def draw_sol_head (expr filled) =
1626 draw_outside_ellipse (1.53 - puff_up_factor / 3.0, 34, 0.66, 0.17);
1628 undraw_inside_ellipse (3.25, 33, 0.81, 2.5 stafflinethickness#);
1630 draw_staff (-2, 2, 0);
1633 fet_beginchar ("Whole solhead", "s0sol");
1634 draw_sol_head ( false);
1638 fet_beginchar ("Half solhead", "s1sol");
1639 draw_sol_head ( false);
1643 fet_beginchar ("Quarter solhead", "s2sol");
1644 draw_sol_head ( true);
1652 def draw_la_head (expr width_factor, thickness_factor) =
1653 set_char_box (0, width_factor * solfa_base_notewidth#,
1654 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1659 offset := 2 * thickness_factor - 1;
1662 pen_radius := min (solfa_pen_radius,
1663 .35 * (h + d) / (1 + offset));
1665 pickup pencircle scaled (2 * pen_radius);
1678 labels (range 1 thru 4);
1680 p_in := (z1 + pen_radius * (1, -offset))
1681 -- (z2 + pen_radius * (-1, -offset))
1682 -- (z3 + pen_radius * (-1, offset))
1683 -- (z4 + pen_radius * (1, offset))
1701 fet_beginchar ("Whole lahead", "s0la");
1702 draw_la_head (solfa_whole_width, la_weight);
1708 fet_beginchar ("Half lahead", "s1la");
1709 draw_la_head (solfa_half_width, la_weight);
1715 fet_beginchar ("Quarter lahead", "s2la");
1716 draw_la_head (solfa_quarter_width, la_weight);
1721 fet_beginchar ("Whole thin lahead", "s0laThin");
1722 draw_la_head (solfa_whole_width, 1);
1728 fet_beginchar ("Half thin lahead", "s1laThin");
1729 draw_la_head (solfa_half_width, 1);
1735 fet_beginchar ("Quarter lahead", "s2laThin");
1736 draw_la_head (solfa_quarter_width, 1);
1743 % `Snow-cone', V with rounded top.
1745 def draw_ti_head (expr width_factor, dir, thickness_factor) =
1746 set_char_box (0, width_factor * solfa_base_notewidth#,
1747 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1748 save p_in, p_out, p_top, p_top_in;
1749 path p_in, p_out, p_top, p_top_in;
1754 offset := 2 * thickness_factor - 1;
1757 pen_radius := min (solfa_pen_radius,
1758 .4 * (h + d) / (1 + offset));
1760 pickup pencircle scaled (2 * pen_radius);
1765 y2 = cone_height [y1, y3];
1771 y5 = y1 + offset * pen_radius;
1773 labels (range 1 thru 4);
1775 save nw_dist, sw_dist, nw, sw;
1776 pair nw_dist, sw_dist, nw, sw;
1778 nw = unitvector (z2 - z1);
1779 sw = unitvector (z1 - z4);
1781 nw_dist = (nw rotated 90) * pen_radius;
1782 sw_dist = (sw rotated 90) * pen_radius;
1784 p_top := (z2 + nw * pen_radius)
1786 .. (z4 - sw * pen_radius);
1788 p_top_in := (z2 - nw * offset * pen_radius)
1789 .. (z3 - (0,1) * pen_radius) {right}
1790 .. (z4 + sw * offset * pen_radius);
1792 save path_a, path_b;
1793 path path_a, path_b;
1799 z6 = path_a intersectionpoint p_top_in;
1800 z7 = path_b intersectionpoint p_top_in;
1812 .. (z2 + nw * pen_radius){direction 0 of p_top}
1814 & {direction infinity of p_top}(z4 - sw * pen_radius)
1821 charwy := cone_height [-chardp, charht];
1831 fet_beginchar ("Whole up tihead", "s0ti");
1832 draw_ti_head (solfa_whole_width, 1, ti_weight);
1838 fet_beginchar ("Half up tihead", "u1ti");
1839 draw_ti_head (solfa_half_width, 1, ti_weight);
1845 fet_beginchar ("Half down tihead", "d1ti");
1846 draw_ti_head (solfa_half_width, -1, ti_weight);
1852 fet_beginchar ("Quarter up tihead", "u2ti");
1853 draw_ti_head (solfa_quarter_width, 1, ti_weight);
1858 fet_beginchar ("Quarter down tihead", "d2ti");
1859 draw_ti_head (solfa_quarter_width, -1, ti_weight);
1864 fet_beginchar ("Whole thin up tihead", "s0tiThin");
1865 draw_ti_head (solfa_whole_width, 1, 1);
1871 fet_beginchar ("Half thin up tihead", "u1tiThin");
1872 draw_ti_head (solfa_half_width, 1, 1);
1878 fet_beginchar ("Half thin down tihead", "d1tiThin");
1879 draw_ti_head (solfa_half_width, -1, 1);
1885 fet_beginchar ("Quarter thin up tihead", "u2tiThin");
1886 draw_ti_head (solfa_quarter_width, 1, 1);
1891 fet_beginchar ("Quarter thin down tihead", "d2tiThin");
1892 draw_ti_head (solfa_quarter_width, -1, 1);
1897 %%%%%% Funk shape note heads
1899 % Funk heads are narrower than Aiken and Sacred Harp, so we need a new
1902 funk_notehead_width := 0.75;
1906 % Parabolic on one side, vertical line on other
1907 % Has up and down shapes for *all* notes
1909 def draw_Funk_do_head (expr width_factor, thickness_factor) =
1910 set_char_box (0, width_factor * solfa_base_notewidth#,
1911 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1914 offset := 2 * thickness_factor - 1;
1917 pen_radius := min (solfa_pen_radius,
1918 .3 * (h + d) / (1 + offset));
1920 pickup pencircle scaled (2 * pen_radius);
1931 x4 = x1 - pen_radius;
1932 y4 = y1 + offset * pen_radius;
1935 x5 = x2 + pen_radius;
1938 y6 = y3 - offset * pen_radius;
1940 save p_up_in, p_up_out, p_down_in, p_down_out;
1941 path p_up_in, p_up_out, p_down_in, p_down_out;
1943 p_down_in := z4{left}
1948 p_down_out := bot z1{left}
1955 p_up_in := p_down_in rotated 180 shifted (w,0);
1956 p_up_out := p_down_out rotated 180 shifted (w,0);
1961 save funk_do_weight;
1962 funk_do_weight := 1.7;
1964 fet_beginchar ("Whole up Funk dohead", "u0doFunk");
1965 draw_Funk_do_head (funk_notehead_width, funk_do_weight);
1971 fet_beginchar ("Whole down Funk dohead", "d0doFunk");
1972 draw_Funk_do_head (funk_notehead_width, funk_do_weight);
1978 fet_beginchar ("Half up Funk dohead", "u1doFunk");
1979 draw_Funk_do_head (funk_notehead_width, funk_do_weight);
1985 fet_beginchar ("Half down Funk dohead", "d1doFunk");
1986 draw_Funk_do_head (funk_notehead_width, funk_do_weight);
1992 fet_beginchar ("Quarter up Funk dohead", "u2doFunk");
1993 draw_Funk_do_head (funk_notehead_width, funk_do_weight);
1998 fet_beginchar ("Quarter down Funk dohead", "d2doFunk");
1999 draw_Funk_do_head (funk_notehead_width, funk_do_weight);
2006 % Has up and down shapes for *all* notes
2008 def draw_Funk_re_head (expr width_factor, thickness_factor) =
2009 set_char_box (0, width_factor * solfa_base_notewidth#,
2010 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
2013 offset := 2 * thickness_factor - 1;
2016 pen_radius := min (solfa_pen_radius,
2017 .3 * (h + d) / (1 + offset));
2019 pickup pencircle scaled (2 * pen_radius);
2030 x3 := curve_in [x1, x2];
2038 save ne, se, ne_perp, se_perp;
2039 pair ne, se, ne_perp, se_perp;
2041 ne := unitvector (z2 - z1);
2042 se := unitvector (z4 - z1);
2043 ne_perp := ne rotated 90;
2044 se_perp := se rotated 90;
2046 save path_a, path_b, path_c, path_d;
2047 path path_a, path_b, path_c, path_d;
2048 save arrow_a_perp, arrow_b_perp;
2049 pair arrow_a_perp, arrow_b_perp;
2052 path_d := z2 .. z3{down} .. z4;
2053 arrow_a_perp = unitvector (direction 0 of path_d rotated 90)
2055 arrow_b_perp = unitvector (direction 2 of path_d rotated 90)
2058 path_b := (z1 + se_perp * pen_radius)
2059 -- z4 + se_perp * offset * pen_radius;
2060 path_a := (z1 - ne_perp * pen_radius)
2061 -- z2 - ne_perp * offset * pen_radius;
2062 path_c := z2 - arrow_a_perp
2064 .. z4 - arrow_b_perp;
2066 z5 = path_a intersectionpoint path_b;
2067 z7 = path_a intersectionpoint path_c;
2068 z8 = path_b intersectionpoint path_c;
2070 save p_up_in, p_down_in, p_up_out, p_down_out;
2071 path p_up_in, p_down_in, p_up_out, p_down_out;
2079 p_down_out := lft z1{up}
2080 .. (z1 + ne_perp * pen_radius){ne}
2081 -- (z2 + ne_perp * pen_radius){ne}
2084 .. (z2 + arrow_a_perp)
2086 .. (z4 + arrow_b_perp)
2089 .. z4 - se_perp * pen_radius
2090 -- z1 - se_perp * pen_radius
2093 p_up_in := p_down_in rotated 180 shifted (w, 0);
2094 p_up_out := p_down_out rotated 180 shifted (w, 0);
2099 save funk_re_weight;
2100 funk_re_weight = 1.7;
2102 fet_beginchar ("Whole up Funk rehead", "u0reFunk");
2103 draw_Funk_re_head (funk_notehead_width, funk_re_weight);
2109 fet_beginchar ("Whole down Funk rehead", "d0reFunk");
2110 draw_Funk_re_head (funk_notehead_width, funk_re_weight);
2116 fet_beginchar ("Half up Funk rehead", "u1reFunk");
2117 draw_Funk_re_head (funk_notehead_width, funk_re_weight);
2123 fet_beginchar ("Half down Funk rehead", "d1reFunk");
2124 draw_Funk_re_head (funk_notehead_width, funk_re_weight);
2130 fet_beginchar ("Quarter up Funk rehead", "u2reFunk");
2131 draw_Funk_re_head (funk_notehead_width, funk_re_weight);
2136 fet_beginchar ("Quarter down Funk rehead", "d2reFunk");
2137 draw_Funk_re_head (funk_notehead_width, funk_re_weight);
2144 % Has up and down shapes for all hollow notes
2146 save funk_mi_width, funk_mi_weight;
2147 funk_mi_width := 1.2;
2148 funk_mi_weight := 1.9;
2150 fet_beginchar ("Whole up Funk mihead", "u0miFunk");
2151 draw_mi_head (funk_mi_width * funk_notehead_width,
2152 funk_mi_weight, false);
2158 fet_beginchar ("Whole down Funk mihead", "d0miFunk");
2159 draw_mi_head (funk_mi_width * funk_notehead_width,
2160 funk_mi_weight, true);
2166 fet_beginchar ("Half up Funk mihead", "u1miFunk");
2167 draw_mi_head (funk_mi_width * funk_notehead_width,
2168 funk_mi_weight, false);
2174 fet_beginchar ("Half down Funk mihead", "d1miFunk");
2175 draw_mi_head (funk_mi_width * funk_notehead_width,
2176 funk_mi_weight, true);
2182 fet_beginchar ("Quarter Funk mihead", "s2miFunk");
2183 draw_mi_head (funk_mi_width * funk_notehead_width,
2184 funk_mi_weight, false);
2191 % Does it rotate for whole notes?
2192 % Same as other shape note systems
2193 % Need special notes because of special width
2195 save funk_fa_weight;
2196 funk_fa_weight := 1.9;
2198 fet_beginchar ("Whole up Funk fahead", "u0faFunk");
2199 draw_fa_head (funk_notehead_width, funk_fa_weight);
2205 fet_beginchar ("Whole down Funk fahead", "d0faFunk");
2206 draw_fa_head (funk_notehead_width, funk_fa_weight);
2212 fet_beginchar ("Half up Funk fahead", "u1faFunk");
2213 draw_fa_head (funk_notehead_width, funk_fa_weight);
2219 fet_beginchar ("Half down Funk fahead", "d1faFunk");
2220 draw_fa_head (funk_notehead_width, funk_fa_weight);
2226 fet_beginchar ("Quarter up Funk fahead", "u2faFunk");
2227 draw_fa_head (funk_notehead_width, funk_fa_weight);
2232 fet_beginchar ("Quarter down Funk fahead", "d2faFunk");
2233 draw_fa_head (funk_notehead_width, funk_fa_weight);
2238 %%%%%% Funk sol head is the same as the others
2239 % Need special character because of skinnier head
2241 def draw_Funk_sol_head (expr filled) =
2244 noteheight# := solfa_noteheight#;
2245 draw_outside_ellipse (1.2, 34, 0.71, 0.);
2247 undraw_inside_ellipse (1.9, 33, 0.74, 5.5 stafflinethickness#);
2249 draw_staff (-2, 2, 0);
2254 fet_beginchar ("Whole Funk solhead", "s0solFunk");
2255 draw_Funk_sol_head ( false);
2259 fet_beginchar ("Half Funk solhead", "s1solFunk");
2260 draw_Funk_sol_head ( false);
2264 fet_beginchar ("Quarter Funk solhead", "s2solFunk");
2265 draw_Funk_sol_head ( true);
2271 % Same as for other shape notes
2272 % Smaller width requires special characters
2274 save funk_la_weight;
2275 funk_la_weight := 1.9;
2277 fet_beginchar ("Whole Funk lahead", "s0laFunk");
2278 draw_la_head (funk_notehead_width, funk_notehead_width);
2284 fet_beginchar ("Half Funk lahead", "s1laFunk");
2285 draw_la_head (funk_notehead_width, funk_notehead_width);
2291 fet_beginchar ("Quarter Funk lahead", "s2laFunk");
2292 draw_la_head (funk_notehead_width, funk_notehead_width);
2298 % `Sideways snow cone'.
2299 % Rotates for all notes.
2301 def draw_Funk_ti_head (expr width_factor, thickness_factor) =
2302 set_char_box (0, width_factor * solfa_base_notewidth#,
2303 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
2308 offset := 2 * thickness_factor - 1;
2311 pen_radius := min (solfa_pen_radius,
2312 .33 * (h + d) / (1 + offset));
2314 pickup pencircle scaled (2 * pen_radius);
2319 x2 = cone_width [x1, x3];
2328 save nw_dist, sw_dist, ne, se;
2329 pair nw_dist, sw_dist, ne, se;
2331 ne = unitvector (z2 - z1);
2332 se = unitvector (z4 - z1);
2334 nw_dist = (ne rotated 90) * pen_radius ;
2335 sw_dist = (se rotated -90) * pen_radius;
2337 save path_a, path_b;
2338 path path_a, path_b;
2339 path_a := z1 - nw_dist
2340 -- z2 - offset * nw_dist;
2341 path_b := z1 - sw_dist
2342 -- z4 - offset * sw_dist;
2344 save path_right, path_right_in;
2345 path path_right, path_right_in;
2346 path_right := (z2 + ne * pen_radius)
2348 .. (z4 + se * pen_radius);
2350 path_right_in := (z2 - ne * pen_radius)
2352 .. (z4 - se * pen_radius);
2354 z5 = path_a intersectionpoint path_b;
2355 z6 = path_a intersectionpoint path_right_in;
2356 z7 = path_b intersectionpoint path_right_in;
2358 save p_up_in, p_down_in, p_up_out, p_down_out;
2359 path p_up_in, p_down_in, p_up_out, p_down_out;
2367 p_down_out := lft z1
2371 .. (z2 + ne * pen_radius){direction 0 of path_right}
2373 & {direction infinity of path_right}(z4 + se * pen_radius)
2379 p_up_in := p_down_in rotated 180 shifted (w, 0);
2380 p_up_out := p_down_out rotated 180 shifted (w, 0);
2384 save funk_ti_weight;
2385 funk_ti_weight := 1.6;
2387 fet_beginchar ("Whole up Funk tihead", "u0tiFunk");
2388 draw_Funk_ti_head (funk_notehead_width, funk_ti_weight);
2394 fet_beginchar ("Whole down Funk tihead", "d0tiFunk");
2395 draw_Funk_ti_head (funk_notehead_width, funk_ti_weight);
2401 fet_beginchar ("Half up Funk tihead", "u1tiFunk");
2402 draw_Funk_ti_head (funk_notehead_width, funk_ti_weight);
2408 fet_beginchar ("Half down Funk tihead", "d1tiFunk");
2409 draw_Funk_ti_head (funk_notehead_width, funk_ti_weight);
2415 fet_beginchar ("Quarter up Funk tihead", "u2tiFunk");
2416 draw_Funk_ti_head (funk_notehead_width, funk_ti_weight);
2421 fet_beginchar ("Quarter down Funk tihead", "d2tiFunk");
2422 draw_Funk_ti_head (funk_notehead_width, funk_ti_weight);
2427 %%%%%% Walker shape note heads
2429 % Walker heads are narrow like Funk heads, so use funk_notehead_width.
2432 %%%%%% Walker do head
2434 % Trapezoid, with largest side on stem side
2436 def draw_Walker_do_head (expr width_factor, dir, thickness_factor) =
2437 set_char_box (0, width_factor * solfa_base_notewidth#,
2438 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
2440 pickup pencircle scaled solfa_pen_thick;
2443 offset := 2 * thickness_factor - 1;
2445 % adjust width so stem can be centered
2446 if .5w <> good.x .5w: change_width; fi
2450 scaling# = charwd / w;
2455 x1 = inset [x4, x3];
2458 x2 = inset [x3, x4];
2467 labels (range 1 thru 4);
2469 save left_dir, left_perp, right_dir, right_perp;
2470 pair left_dir, left_perp, right_dir, right_perp;
2472 left_dir = unitvector(z1 - z4);
2473 left_perp = (left_dir rotated 90) * solfa_pen_radius;
2474 right_dir = unitvector(z3 - z2);
2475 right_perp = (right_dir rotated 90) * solfa_pen_radius;
2477 save path_a, path_b, path_c, path_d;
2478 path path_a, path_b, path_c, path_d;
2480 path_a := (z4 - left_perp)
2481 -- (z1 - left_perp);
2482 path_b := (z1 - (0, offset*solfa_pen_radius))
2483 -- (z2 - (0, offset*solfa_pen_radius));
2484 path_c := (z2 - right_perp)
2485 -- (z3 - right_perp);
2486 path_d := (z3 + (0, offset*solfa_pen_radius))
2487 -- (z4 + (0, offset*solfa_pen_radius));
2492 p_in := (path_a intersectionpoint path_b)
2493 -- (path_b intersectionpoint path_c)
2494 -- (path_c intersectionpoint path_d)
2495 -- (path_d intersectionpoint path_a)
2498 p_out := top z1{right}
2500 .. z2 + right_perp {right_dir}
2501 -- z3 + right_perp {right_dir}
2504 .. z4 + left_perp {left_dir}
2505 .. z1 + left_perp {left_dir}
2508 charwx := scaling# * (w/2 + solfa_pen_radius);
2509 charwy := scaling# * y2 ;
2512 p_in := p_in rotated 180 shifted (w,0);
2513 p_out := p_out rotated 180 shifted (w,0);
2518 save walker_do_weight;
2519 walker_do_weight := 1.5;
2521 fet_beginchar ("Whole Walker dohead", "s0doWalker");
2522 draw_Walker_do_head (funk_notehead_width, 0, walker_do_weight);
2528 fet_beginchar ("Half up Walker dohead", "u1doWalker");
2529 draw_Walker_do_head (funk_notehead_width, 1, walker_do_weight);
2535 fet_beginchar ("Half down Walker dohead", "d1doWalker");
2536 draw_Walker_do_head (funk_notehead_width, 0, walker_do_weight);
2542 fet_beginchar ("Quarter up Walker dohead", "u2doWalker");
2543 draw_Walker_do_head (funk_notehead_width, 1, walker_do_weight);
2548 fet_beginchar ("Quarter down Walker dohead", "d2doWalker");
2549 draw_Walker_do_head (funk_notehead_width, 0, walker_do_weight);
2554 %%%%%% Walker re head
2555 % Parabolic on one side, shallow parabola on other
2556 % Has up and down shapes for *all* notes
2558 def draw_Walker_re_head (expr width_factor, thickness_factor) =
2559 set_char_box (0, width_factor * solfa_base_notewidth#,
2560 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
2563 offset := 2 * thickness_factor - 1;
2566 pen_radius := min (solfa_pen_radius,
2567 .3 * (h + d) / (1 + offset));
2569 pickup pencircle scaled (2 * pen_radius);
2572 dish_factor := 0.20;
2583 x4 = dish_factor [x1, x2];
2587 y5 = y1 + offset * pen_radius;
2590 x6 = x2 + pen_radius;
2593 y7 = y3 - offset * pen_radius;
2596 x8 = x4 - pen_radius;
2598 save path_a, path_d;
2599 path path_a, path_d;
2601 save p_a_start_dir, p_a_end_dir, p_a_start_perp, p_a_end_perp;
2602 pair p_a_start_dir, p_a_end_dir, p_a_start_perp, p_a_end_perp;
2604 path_a := z3 .. z4{down} .. z1;
2606 p_a_start_dir := unitvector(direction 0 of path_a);
2607 p_a_end_dir := unitvector(direction infinity of path_a);
2608 p_a_start_perp := (p_a_start_dir rotated 90) * pen_radius;
2609 p_a_end_perp := (p_a_end_dir rotated 90) * pen_radius;
2611 path_d := (z3 - p_a_start_perp){p_a_start_dir}
2613 ..(z1 - p_a_end_perp){p_a_end_dir};
2615 save path_b, path_c;
2616 path path_b, path_c;
2618 path_b := z5 {left} .. z6{up};
2619 path_c := z7 {left} .. z6{down};
2621 z9 = path_d intersectionpoint path_b;
2622 z10 = path_d intersectionpoint path_c;
2624 labels (range 1 thru 4);
2626 save p_up_in, p_up_out, p_down_in, p_down_out;
2627 path p_up_in, p_up_out, p_down_in, p_down_out;
2630 ... {right} z10 {p_a_start_dir}
2632 .. {p_a_end_dir} z9 {left}
2635 p_down_out := lft z2{up}
2638 .. (z3 + p_a_start_perp){p_a_start_dir}
2640 .. (z1 + p_a_end_perp) {p_a_end_dir}
2645 p_up_in := p_down_in rotated 180 shifted (w,0);
2646 p_up_out := p_down_out rotated 180 shifted (w,0);
2650 save walker_re_weight;
2651 walker_re_weight := 1.2;
2653 fet_beginchar ("Whole Walker rehead", "s0reWalker");
2654 draw_Walker_re_head (funk_notehead_width, walker_re_weight);
2660 fet_beginchar ("Half up Walker rehead", "u1reWalker");
2661 draw_Walker_re_head (funk_notehead_width, walker_re_weight);
2667 fet_beginchar ("Half down Walker rehead", "d1reWalker");
2668 draw_Walker_re_head (funk_notehead_width, walker_re_weight);
2674 fet_beginchar ("Quarter up Walker rehead", "u2reWalker");
2675 draw_Walker_re_head (funk_notehead_width, walker_re_weight);
2680 fet_beginchar ("Quarter down Walker rehead", "d2reWalker");
2681 draw_Walker_re_head (funk_notehead_width, walker_re_weight);
2686 %%%%%% Walker mi head
2688 % Symmetric for all hollow notes
2690 save walker_mi_width, walker_mi_weight;
2691 walker_mi_width := 1.2;
2692 walker_mi_weight := 1.5;
2694 fet_beginchar ("Whole Walker mihead", "s0miWalker");
2695 draw_mi_head (walker_mi_width * funk_notehead_width,
2696 walker_mi_weight, true);
2702 fet_beginchar ("Half Walker mihead", "s1miWalker");
2703 draw_mi_head (walker_mi_width * funk_notehead_width,
2704 walker_mi_weight, true);
2710 fet_beginchar ("Quarter Walker mihead", "s2miWalker");
2711 draw_mi_head (walker_mi_width * funk_notehead_width,
2712 walker_mi_weight, true);
2719 % Does not rotate for whole notes
2720 % Whole rotation is different from Funk, so special notes
2722 %%%%%% Funk sol head is the same as the others
2723 % Need special character because of skinnier head
2725 save walker_fa_weight;
2726 walker_fa_weight := 1.5;
2728 fet_beginchar ("Whole Walker fahead", "s0faWalker");
2729 draw_fa_head (funk_notehead_width, walker_fa_weight);
2735 fet_beginchar ("Half up Walker fahead", "u1faWalker");
2736 draw_fa_head (funk_notehead_width, walker_fa_weight);
2742 fet_beginchar ("Half down Walker fahead", "d1faWalker");
2743 draw_fa_head (funk_notehead_width, walker_fa_weight);
2749 fet_beginchar ("Quarter up Walker fahead", "u2faWalker");
2750 draw_fa_head (funk_notehead_width, walker_fa_weight);
2755 fet_beginchar ("Quarter down Walker fahead", "d2faWalker");
2756 draw_fa_head (funk_notehead_width, walker_fa_weight);
2762 % Same as Funk, no special notes
2765 %%%%%% Walker la head
2767 % Lighter weight requires separate notes
2769 save walker_la_weight;
2770 walker_la_weight := 1.5;
2772 fet_beginchar ("Whole Walker lahead", "s0laWalker");
2773 draw_la_head (funk_notehead_width, walker_la_weight);
2779 fet_beginchar ("Half Funk lahead", "s1laWalker");
2780 draw_la_head (funk_notehead_width, walker_la_weight);
2786 fet_beginchar ("Quarter Funk lahead", "s2laWalker");
2787 draw_la_head (funk_notehead_width, walker_la_weight);
2792 %%%%%% Walker ti head
2793 % Triangular arrowhead
2794 % Rotates for all but whole notes
2796 def draw_Walker_ti_head (expr width_factor, thickness_factor) =
2797 set_char_box (0, width_factor * solfa_base_notewidth#,
2798 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
2801 offset := 2 * thickness_factor - 1;
2804 pen_radius := min (solfa_pen_radius,
2805 .3 * (h + d) / (1 + offset));
2807 pickup pencircle scaled (2 * pen_radius);
2819 labels (range 1 thru 4);
2821 save nw_dist, sw_dist, ne, se;
2822 pair nw_dist, sw_dist, ne, se;
2824 ne = unitvector (z2 - z1);
2825 se = unitvector (z3 - z1);
2827 nw_dist = (ne rotated 90) * pen_radius ;
2828 sw_dist = (se rotated -90) * pen_radius;
2831 save path_a, path_b, path_c;
2832 path path_a, path_b, path_c;
2833 path_a := z2 - nw_dist * offset
2834 -- z1 - nw_dist * offset;
2835 path_b := z3 - sw_dist * offset
2836 -- z1 - sw_dist * offset;
2837 path_c := z2 + left * pen_radius
2838 -- z3 + left * pen_radius;
2840 z4 = path_a intersectionpoint path_b;
2841 z5 = path_a intersectionpoint path_c;
2842 z6 = path_b intersectionpoint path_c;
2844 save p_up_in, p_down_in, p_up_out, p_down_out;
2845 path p_up_in, p_down_in, p_up_out, p_down_out;
2852 p_down_out := lft z1{up}
2853 .. (z1 + nw_dist){ne}
2854 -- (z2 + nw_dist){ne}
2859 .. (z3 + sw_dist){- se}
2860 .. (z1 + sw_dist){- se}
2863 p_up_in := p_down_in rotated 180 shifted (w, 0);
2864 p_up_out := p_down_out rotated 180 shifted (w, 0);
2868 save walker_ti_weight;
2869 walker_ti_weight := 1.4;
2871 fet_beginchar ("Whole Walker tihead", "s0tiWalker");
2872 draw_Walker_ti_head (funk_notehead_width, walker_ti_weight);
2878 fet_beginchar ("Half up Walker tihead", "u1tiWalker");
2879 draw_Walker_ti_head (funk_notehead_width, walker_ti_weight);
2885 fet_beginchar ("Half down Walker tihead", "d1tiWalker");
2886 draw_Walker_ti_head (funk_notehead_width, walker_ti_weight);
2892 fet_beginchar ("Quarter up Walker tihead", "u2tiWalker");
2893 draw_Walker_ti_head (funk_notehead_width, walker_ti_weight);
2898 fet_beginchar ("Quarter down Walker tihead", "d2tiWalker");
2899 draw_Walker_ti_head (funk_notehead_width, walker_ti_weight);
2903 fet_endgroup ("noteheads");
2907 % we derive black_notehead_width# from the quarter head,
2908 % so we have to define black_notehead_width (pixel qty)
2909 % after the black_notehead_width# itself.
2911 % Let's keep it outside the group as well.
2914 define_pixels (black_notehead_width);