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);
161 % dimensions aren't entirely right.
163 def draw_brevis (expr linecount) =
164 save stemthick, fudge;
166 stemthick# = 2 stafflinethickness#;
167 define_whole_blacker_pixels (stemthick);
169 fudge = hround (blot_diameter / 2);
171 draw_outside_ellipse (1.80, 0, 0.707, 0);
172 undraw_inside_ellipse (1.30, 125, 0.68, 2 stafflinethickness#);
174 pickup pencircle scaled stemthick;
186 for i := 0 step 1 until linecount - 1:
187 draw_gridline (z1 - (1.5 * i * stemthick, 0),
188 z2 - (1.5 * i * stemthick, 0), stemthick);
189 draw_gridline (z3 + (1.5 * i * stemthick, 0),
190 z4 + (1.5 * i * stemthick, 0), stemthick);
195 fet_beginchar ("Brevis notehead", "sM1");
198 draw_staff (-2, 2, 0);
203 fet_beginchar ("Brevis notehead", "sM1");
206 draw_staff (-2, 2, 0.5);
211 fet_beginchar ("Double-lined brevis notehead", "sM1double");
214 draw_staff (-2, 2, 0);
219 fet_beginchar ("Double-lined brevis notehead", "sM1double");
222 draw_staff (-2, 2, 0.5);
227 fet_beginchar ("Whole notehead", "s0");
228 draw_outside_ellipse (1.80 - puff_up_factor / 3.0, 0, 0.707, 0);
229 undraw_inside_ellipse (1.30, 125 - puff_up_factor * 10,
230 0.68, 2 stafflinethickness#);
232 whole_notehead_width# := charwd;
234 draw_staff (-2, 2, 0);
239 fet_beginchar ("Whole notehead", "s0");
240 draw_outside_ellipse (1.80 - puff_up_factor / 3.0, 0,
242 undraw_inside_ellipse (1.30, 125 - puff_up_factor * 10,
243 0.68, 2 stafflinethickness#);
245 draw_staff (-2, 2, 0.5);
250 fet_beginchar ("Half notehead", "s1");
251 draw_outside_ellipse (1.53 - puff_up_factor / 3.0, 34, 0.66, 0.17);
252 undraw_inside_ellipse (3.25, 33, 0.81, 2.5 stafflinethickness#);
254 half_notehead_width# := charwd;
256 draw_staff (-2, 2, 0);
261 fet_beginchar ("Half notehead", "s1");
262 draw_outside_ellipse (1.53 - puff_up_factor / 3.0, 34,
264 undraw_inside_ellipse (3.25, 33, 0.81,
265 2.5 stafflinethickness#);
267 draw_staff (-2, 2, 0.5);
272 fet_beginchar ("Quarter notehead", "s2");
274 draw_staff (-2, 2, 0);
279 fet_beginchar ("Quarter notehead", "s2");
280 draw_outside_ellipse (1.49 - puff_up_factor / 3.0, 31,
283 draw_staff (-2, 2, 0.5);
288 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
291 fet_beginchar ("Whole diamondhead", "s0diamond");
292 draw_outside_ellipse (1.80, 0, 0.495, 0);
293 undraw_inside_ellipse (1.30, 125, 0.6,
294 .4 staff_space# + stafflinethickness#);
296 draw_staff (-2, 2, 0);
301 fet_beginchar ("Whole diamondhead", "s0diamond");
302 draw_outside_ellipse (1.80, 0, 0.495, 0);
303 undraw_inside_ellipse (1.30, 125, 0.6,
304 .4 staff_space# + stafflinethickness#);
306 draw_staff (-2, 2, 0.5);
311 fet_beginchar ("Half diamondhead", "s1diamond");
312 draw_outside_ellipse (1.50, 34, 0.49, 0.17);
313 undraw_inside_ellipse (3.5, 33, 0.80,
314 .3 staff_space# + 1.5 stafflinethickness#);
316 draw_staff (-2, 2, 0);
321 fet_beginchar ("Half diamondhead", "s1diamond");
322 draw_outside_ellipse (1.50, 34, 0.49, 0.17);
323 undraw_inside_ellipse (3.5, 33, 0.80,
325 + 1.5 stafflinethickness#);
327 draw_staff (-2, 2, 0.5);
332 fet_beginchar ("Quarter diamondhead", "s2diamond");
333 draw_outside_ellipse (1.80, 35, 0.495, -0.25);
335 draw_staff (-2, 2, 0);
340 fet_beginchar ("Quarter diamondhead", "s2diamond");
341 draw_outside_ellipse (1.80, 35, 0.495, -0.25);
343 draw_staff (-2, 2, 0.5);
348 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
351 vardef penposx@# (expr d) =
361 z@#l = pat intersectionpoint (z@# -- infinity * dir (d + 180));
362 z@#r = pat intersectionpoint (z@# -- infinity * dir (d));
368 % UGH: xs not declared as argument.
370 def define_triangle_shape (expr stemdir) =
371 save triangle_a, triangle_b, triangle_c;
372 save triangle_out_a, triangle_out_b, triangle_out_c;
373 save triangle_in, triangle_out;
374 save width, depth, height;
375 save origin, left_up_dir;
376 save exact_left_point, exact_right_point, exact_down_point;
378 path triangle_a, triangle_b, triangle_c;
379 path triangle_out_a, triangle_out_b, triangle_out_c;
380 path triangle_in, triangle_out;
381 pair origin, left_up_dir;
382 pair exact_down_point, exact_left_point, exact_right_point;
385 pen_thick# = stafflinethickness# + .1 staff_space#;
386 define_pixels (llap);
387 define_blacker_pixels (pen_thick);
389 left_up_dir = llap# * dir (90 + tilt);
391 xpart (left_up_dir) * xs - (pen_thick# * xs) / 2 + xpart origin = 0;
394 exact_left_point := origin + (left_up_dir xscaled xs);
395 exact_down_point := origin + (left_up_dir rotated 120 xscaled xs);
396 exact_right_point := origin + (left_up_dir rotated 240 xscaled xs);
398 height# = ypart (exact_left_point + origin) + pen_thick# / 2;
399 depth# = -ypart (exact_down_point + origin) + pen_thick# / 2;
400 width# = xpart (exact_right_point - exact_left_point)
403 set_char_box (0, width#, depth#, height#);
405 % Formerly, the shape has simply been drawn with an elliptical pen
406 % (`scaled pen_thick xscaled xs'), but the envelope of such a curve
407 % is of 6th degree. For the sake of mf2pt1, we approximate it.
409 pickup pencircle scaled pen_thick xscaled xs;
411 z0 = (hround_pixels (xpart origin), 0);
413 z1 = z1' = z0 + llap * dir (90 + tilt) xscaled xs;
414 z2 = z2' = z0 + llap * dir (90 + tilt + 120) xscaled xs;
415 z3 = z3' = z0 + llap * dir (90 + tilt + 240) xscaled xs;
417 z12 = caveness [.5[z1, z2], z3];
418 z23 = caveness [.5[z2, z3], z1];
419 z31 = caveness [.5[z3, z1], z2];
421 triangle_a = z1 .. z12 .. z2;
422 triangle_b = z2 .. z23 .. z3;
423 triangle_c = z3 .. z31 .. z1;
425 penposx1 (angle (direction 0 of triangle_a) - 90);
426 penposx2 (angle (direction 0 of triangle_b) - 90);
427 penposx3 (angle (direction 0 of triangle_c) - 90);
429 penposx1' (angle (direction infinity of triangle_c) + 90);
430 penposx2' (angle (direction infinity of triangle_a) + 90);
431 penposx3' (angle (direction infinity of triangle_b) + 90);
433 penposx12 (angle (z12 - z0));
434 penposx23 (angle (z23 - z0));
435 penposx31 (angle (z31 - z0));
437 z10 = (z0 -- z1) intersectionpoint (z1l .. z12l .. z2'r);
438 z20 = (z0 -- z2) intersectionpoint (z2l .. z23l .. z3'r);
439 z30 = (z0 -- z3) intersectionpoint (z3l .. z31l .. z1'r);
452 triangle_out_a = z1r .. z12r .. z2'l;
453 triangle_out_b = z2r .. z23r .. z3'l;
454 triangle_out_c = z3r .. z31r .. z1'l;
456 triangle_out = top z1
458 .. z1r{direction 0 of triangle_out_a}
460 & {direction infinity of triangle_out_a}z2'l
463 .. z2r{direction 0 of triangle_out_b}
465 & {direction infinity of triangle_out_b}z3'l
468 .. z3r{direction 0 of triangle_out_c}
470 & {direction infinity of triangle_out_c}z1'l
473 labels (0, 10, 20, 30);
474 penlabels (1, 1', 2, 2', 3, 3', 12, 23, 31);
478 charwy := ypart exact_right_point;
479 charwx := xpart exact_right_point + .5 pen_thick# * xs;
481 charwy := -ypart exact_down_point;
482 charwx := width# - (xpart exact_down_point - .5 pen_thick# * xs);
487 def draw_whole_triangle_head =
493 llap# = 3/4 noteheight#;
497 define_triangle_shape (1);
503 fet_beginchar ("Whole trianglehead", "s0triangle");
504 draw_whole_triangle_head;
506 draw_staff (-2, 2, 0);
511 fet_beginchar ("Whole trianglehead", "s0triangle");
512 draw_whole_triangle_head;
514 draw_staff (-2, 2, 0.5);
519 def draw_small_triangle_head (expr dir) =
525 llap# = 2/3 noteheight#;
528 define_triangle_shape (dir);
532 filldraw triangle_out;
533 unfilldraw triangle_in;
537 fet_beginchar ("Half trianglehead (downstem)", "d1triangle");
538 draw_small_triangle_head (-1);
540 draw_staff (-2, 2, 0);
544 fet_beginchar ("Half trianglehead (upstem)", "u1triangle");
545 draw_small_triangle_head (1);
547 draw_staff (-2, 2, 0.5);
551 def draw_closed_triangle_head (expr dir) =
557 llap# = 2/3 noteheight#;
560 define_triangle_shape (dir);
565 fet_beginchar ("Quarter trianglehead (upstem)", "u2triangle");
566 draw_closed_triangle_head (1);
568 draw_staff (-2, 2, 0);
572 fet_beginchar ("Quarter trianglehead (downstem)", "d2triangle");
573 draw_closed_triangle_head (-1);
575 draw_staff (-2, 2, 0.5);
579 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
581 % Slash heads are for indicating improvisation. They are
582 % twice as high as normal heads.
584 def draw_slash (expr hwid_hash) =
588 exact_height = staff_space# + stafflinethickness# / 2;
590 set_char_box (0, 2 exact_height / slash_slope + hwid_hash,
591 exact_height, exact_height);
600 pickup pencircle scaled blot_diameter;
605 lft x2 = 2 h / slash_slope;
612 ne = unitvector (z3 - z4);
613 nw_dist = (ne rotated 90) * 0.5 blot_diameter;
616 .. (z1 + nw_dist){ne}
617 -- (z2 + nw_dist){ne}
620 .. (z3 - nw_dist){-ne}
621 -- (z4 - nw_dist){-ne}
625 if hwid_hash > 2 slash_thick#:
628 th = slash_thick - blot_diameter;
633 z6 - z5 = whatever * ne;
634 z8 - z7 = whatever * ne;
636 z5 = z1 + whatever * ne + th * (ne rotated -90);
637 z8 = z4 + whatever * ne + th * (ne rotated 90);
645 labels (range 1 thru 10);
649 fet_beginchar ("Whole slashhead", "s0slash");
650 draw_slash (4 slash_thick# + 0.5 staff_space#);
652 draw_staff (-2, 2, 0);
656 fet_beginchar ("Half slashhead", "s1slash");
657 draw_slash (3.0 slash_thick# + 0.15 staff_space#);
659 draw_staff (-2, 2, 0);
663 fet_beginchar ("Quarter slashhead", "s2slash");
664 draw_slash (1.5 slash_thick#);
666 draw_staff (-2, 2, 0);
670 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
672 % `thick' is the distance between the NE/SW parallel lines in the cross
673 % (distance between centres of lines) in multiples of stafflinethickness
675 def draw_cross (expr thick) =
677 save ne_dist, nw_dist, rt_dist, up_dist;
678 save crz_in, crz_out;
681 pair ne_dist, nw_dist, rt_dist, up_dist;
682 path crz_in, crz_out;
684 pen_thick# := 1.2 stafflinethickness#;
685 thickness# := thick * stafflinethickness#;
686 define_pixels (thickness);
687 define_blacker_pixels (pen_thick);
689 pickup pencircle scaled pen_thick;
694 ne = unitvector ((1, (2 h - pen_thick) / (w - pen_thick)));
697 z4 - z5 = whatever * ne;
699 z6 - z3 = whatever * ne;
700 z3 - z4 = whatever * (ne yscaled -1);
702 z4 - z3 = whatever * (ne) + (ne rotated -90) * thickness;
705 x1 = charwd / 2 - .5 pen_thick#;
707 + thick / 2 * stafflinethickness# * (ne rotated -90);
709 % labels (1, 2, 3, 4, 5, 6);
711 nw = unitvector (z3 - z4);
713 up_dist = up * 0.5 pen_thick / cosd (angle (ne));
714 rt_dist = right * 0.5 pen_thick / sind (angle (ne));
715 nw_dist = (ne rotated 90) * 0.5 pen_thick;
716 ne_dist = (nw rotated -90) * 0.5 pen_thick;
722 x4 := hround (x4' + .5 pen_thick) - .5 pen_thick;
723 x5 := hfloor (x5' + xpart rt_dist) - xpart rt_dist;
724 y6 := vfloor (y6' + ypart up_dist) - ypart up_dist;
726 crz_out = (z6 + up_dist)
727 -- (z3 + nw_dist){ne}
729 .. (z3 + ne_dist){-nw}
730 -- (z4 + ne_dist){-nw}
732 .. (z4 - nw_dist){-ne}
734 crz_out := crz_out shifted (0, feta_shift)
735 -- reverse crz_out yscaled -1 shifted (0, -feta_eps);
737 -- reverse crz_out xscaled -1 shifted (-feta_eps, 0)
741 x4 := hround (x4' - xpart rt_dist) + xpart rt_dist;
742 x5 := hceiling (x5' - .5 pen_thick) + .5 pen_thick;
743 y6 := vfloor (y6' - .5 pen_thick) + .5 pen_thick;
745 crz_in = (bot z6){right}
746 .. (z6 - nw_dist){ne}
749 -- (z5 + nw_dist){-ne}
751 crz_in := crz_in shifted (0, feta_shift)
752 -- reverse crz_in yscaled -1 shifted (0, -feta_eps);
754 -- reverse crz_in xscaled -1 shifted (-feta_eps, 0)
759 currentpicture := currentpicture shifted (hround (w / 2), 0);
762 charwy := y1 + feta_shift;
764 z12 = (charwx * hppp, y1 * vppp);
770 fet_beginchar ("Whole Crossed notehead", "s0cross");
773 wid# := black_notehead_width# + 4 stafflinethickness#;
774 hei# := noteheight# + stafflinethickness#;
776 set_char_box (0, wid#, hei# / 2, hei# / 2);
780 remember_pic := currentpicture;
782 draw_staff (-2, 2, 0);
787 fet_beginchar ("Whole Crossed notehead", "s0cross");
790 wid# := black_notehead_width# + 4 stafflinethickness#;
791 hei# := noteheight# + stafflinethickness#;
793 set_char_box (0, wid#, hei# / 2, hei# / 2);
795 currentpicture := remember_pic;
797 draw_staff (-2, 2, 0.5);
802 fet_beginchar ("Half Crossed notehead", "s1cross");
805 wid# := black_notehead_width# + 2 stafflinethickness#;
806 hei# := noteheight# + stafflinethickness# / 2;
808 set_char_box (0, wid#, hei# / 2, hei# / 2);
812 remember_pic := currentpicture;
814 draw_staff (-2, 2, 0);
819 fet_beginchar ("Half Crossed notehead", "s1cross");
822 wid# := black_notehead_width# + 2 stafflinethickness#;
823 hei# := noteheight# + stafflinethickness# / 2;
825 set_char_box (0, wid#, hei# / 2, hei# / 2);
827 currentpicture := remember_pic;
829 draw_staff (-2, 2, 0.5);
834 fet_beginchar ("Crossed notehead", "s2cross");
835 wid# := black_notehead_width#;
837 set_char_box (0, wid#, hei# / 2, hei# / 2);
841 remember_pic := currentpicture;
843 draw_staff (-2, 2, 0);
848 fet_beginchar ("Crossed notehead", "s2cross");
849 wid# := black_notehead_width#;
851 set_char_box (0, wid#, hei# / 2, hei# / 2);
853 currentpicture := remember_pic;
855 draw_staff (-2, 2, 0.5);
860 fet_beginchar ("X-Circled notehead", "s2xcircle");
862 save cthick, cxd, cyd, dy;
864 wid# := black_notehead_width# * sqrt (sqrt2);
865 hei# := noteheight# * sqrt (sqrt2);
867 set_char_box (0, wid#, hei# / 2, hei# / 2);
869 d := d - feta_space_shift;
871 cthick# := (1.2 + 1/4) * stafflinethickness#;
872 define_blacker_pixels (cthick);
875 cyd := h + d - cthick / 2;
879 pickup pencircle scaled cthick;
881 fill fullcircle xscaled (cxd + cthick)
882 yscaled (cyd + cthick)
884 unfill fullcircle xscaled (cxd - cthick)
885 yscaled (cyd - cthick)
888 xpos := .5 cxd / sqrt2;
889 ypos := .5 cyd / sqrt2;
891 pickup penrazor scaled cthick rotated (angle (xpos, ypos) + 90);
892 draw (-xpos + w / 2, -ypos + dy)
893 -- (xpos + w / 2, ypos + dy);
895 pickup penrazor scaled cthick rotated (angle (xpos, -ypos) + 90);
896 draw (-xpos + w / 2, ypos + dy)
897 -- (xpos + w / 2, -ypos + dy);
902 z12 = (charwx * hppp, charwy * vppp);
905 remember_pic := currentpicture;
907 draw_staff (-2, 2, 0);
912 fet_beginchar ("X-Circled notehead", "s2xcircle");
914 save cthick, cxr, cyr;
916 wid# := black_notehead_width# * sqrt (sqrt2);
917 hei# := noteheight# * sqrt (sqrt2);
919 set_char_box (0, wid#, hei# / 2, hei# / 2);
921 currentpicture := remember_pic;
923 draw_staff (-2, 2, 0.5);
933 % Note: For whole and half notes, the `fill' curve (p_out) is offset from
934 % the points that specify the outer geometry, because we need to add
935 % the rounding. In contrast, the inner curve is not offset, because
936 % there is no rounding.
938 % This means that to get a line of thick_factor * pen_thickness,
939 % we need to offset the inner curve by
941 % (thick_factor - 0.5) * pen_thickness
945 % (2 * thick_factor - 1) * half_pen_thickness
947 save solfa_pen_thick;
948 solfa_pen_thick# = 1.3 stafflinethickness#;
949 define_blacker_pixels (solfa_pen_thick);
951 save solfa_pen_radius;
952 solfa_pen_radius = 0.5 solfa_pen_thick;
954 save solfa_base_notewidth;
955 solfa_base_notewidth# := black_notehead_width#;
957 solfa_whole_width := 1.0;
958 solfa_half_width := 1.0;
959 solfa_quarter_width := 1.0;
964 % Triangle with base parallel to staff lines.
967 def draw_do_head (expr width_factor, dir, thickness_factor) =
969 save left_dist, right_dist, bottom_dist;
971 pair left_dist, right_dist, bottom_dist;
973 set_char_box (0, width_factor * solfa_base_notewidth#,
974 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
976 bottom_thick_factor := 2 * thickness_factor - 1;
977 % no different thickness for left side if we want uniform thickness
978 if thickness_factor = 1:
979 left_thick_factor := 1;
981 left_thick_factor := 0.7 * bottom_thick_factor;
985 pen_radius := min (solfa_pen_radius,
986 (h + d) / (3 * (1 + bottom_thick_factor)));
988 pickup pencircle scaled (2 * pen_radius);
997 left_dist = (unitvector (z3 - z1) rotated 90) * pen_radius;
998 right_dist = (unitvector (z2 - z3) rotated 90) * pen_radius;
999 bottom_dist = (0,1) * pen_radius;
1003 save point_a, point_b, point_c;
1004 pair point_a, point_b, point_c;
1006 pa := (z1 - left_thick_factor * left_dist)
1007 -- (z3 - left_thick_factor * left_dist);
1008 pb := (z1 + bottom_thick_factor * bottom_dist)
1009 -- (z2 + bottom_thick_factor * bottom_dist);
1010 pc := (z2 - right_dist)
1011 -- (z3 - right_dist);
1013 point_a := pa intersectionpoint pb;
1014 point_b := pb intersectionpoint pc;
1015 point_c := pc intersectionpoint pa;
1025 .. (z2 + right_dist){z3 - z2}
1026 -- (z3 + right_dist){z3 - z2}
1028 .. (z3 + left_dist){z1 - z3}
1029 -- (z1 + left_dist){z1 - z3}
1036 charwy := -chardp + 0.5 stafflinethickness#;
1046 fet_beginchar ("Whole dohead", "s0do");
1047 draw_do_head (solfa_whole_width, 1, do_weight);
1053 fet_beginchar ("Half dohead", "d1do");
1054 draw_do_head (solfa_half_width, -1, do_weight);
1060 fet_beginchar ("Half dohead", "u1do");
1061 draw_do_head (solfa_half_width, 1, do_weight);
1067 fet_beginchar ("Quarter dohead", "d2do");
1068 draw_do_head (solfa_quarter_width, -1, do_weight);
1073 fet_beginchar ("Quarter dohead", "u2do");
1074 draw_do_head (solfa_quarter_width, 1, do_weight);
1079 fet_beginchar ("Whole thin dohead", "s0doThin");
1080 draw_do_head (solfa_whole_width, 1, 1);
1086 fet_beginchar ("Half thin dohead", "d1doThin");
1087 draw_do_head (solfa_half_width, -1, 1);
1093 fet_beginchar ("Half thin dohead", "u1doThin");
1094 draw_do_head (solfa_half_width, 1, 1);
1100 fet_beginchar ("Quarter thin dohead", "d2doThin");
1101 draw_do_head (solfa_quarter_width, -1, 1);
1106 fet_beginchar ("Quarter thin dohead", "u2doThin");
1107 draw_do_head (solfa_quarter_width, 1, 1);
1113 % re - flat top, curved bottom:
1117 % .. {dir 90} (w,h/2)
1120 % (broader along the base and with more vertical sides for half and
1123 % Note: According to some shape-note singers, there should be no size
1124 % differences for half and whole notes, contrary to the comment above.
1125 % Consequently, we have made them all the same width.
1127 % stem attachment: h/2
1129 def draw_re_head (expr width_factor, dir, thickness_factor) =
1133 set_char_box (0, width_factor * solfa_base_notewidth#,
1134 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1137 offset = (2 * thickness_factor - 1);
1144 pen_radius := min (solfa_pen_radius,
1145 (h + d) * (1-curve_start) / (1+ offset));
1147 pickup pencircle scaled (2 * pen_radius);
1152 y2 = curve_start [y3, y1];
1160 labels (range 1 thru 5);
1162 p_in := (z1 + pen_radius * (1, -1 * offset))
1164 .. ((top z3) + (0, offset * pen_radius))
1166 -- (z5 + pen_radius * (-1, -1 * offset))
1179 charwy := curve_start [-chardp, charht];
1190 fet_beginchar ("Whole rehead", "s0re");
1191 draw_re_head (solfa_whole_width, 1, re_weight);
1197 fet_beginchar ("Half up rehead", "u1re");
1198 draw_re_head (solfa_half_width, 1, re_weight);
1204 fet_beginchar ("Half down rehead", "d1re");
1205 draw_re_head (solfa_half_width, -1, re_weight);
1211 fet_beginchar ("Quarter up rehead", "u2re");
1212 draw_re_head (solfa_quarter_width, 1, re_weight);
1217 fet_beginchar ("Quarter down rehead", "d2re");
1218 draw_re_head (solfa_quarter_width, -1, re_weight);
1223 fet_beginchar ("Whole thin rehead", "s0reThin");
1224 draw_re_head (solfa_whole_width, 1, 1);
1230 fet_beginchar ("Half up thin rehead", "u1reThin");
1231 draw_re_head (solfa_half_width, 1, 1);
1237 fet_beginchar ("Half down thin rehead", "d1reThin");
1238 draw_re_head (solfa_half_width, -1, 1);
1244 fet_beginchar ("Quarter thin rehead", "u2reThin");
1245 draw_re_head (solfa_quarter_width, 1, 1);
1250 fet_beginchar ("Quarter thin rehead", "d2reThin");
1251 draw_re_head (solfa_quarter_width, -1, 1);
1256 %%%% mi head -- diamond shape
1258 % two versions, depending on whether the `strong' lines are on the nw & se
1261 def draw_mi_head (expr width_factor, thickness_factor, mirror) =
1262 save path_out, path_in;
1263 save ne_dist, se_dist, ne, se;
1264 save path_a, path_b, path_c, path_d;
1265 path path_out, path_in;
1266 pair ne_dist, se_dist, ne, se;
1267 path path_a, path_b, path_c, path_d;
1271 set_char_box (0, width_factor * solfa_base_notewidth#,
1272 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1275 offset := 2 * thickness_factor - 1;
1279 note_diagonal := w / 2 ++ (h + d) / 2;
1283 pen_radius := min (solfa_pen_radius,
1284 .3 * note_diagonal / (1 + offset));
1286 pickup pencircle scaled (2 * pen_radius);
1297 % inner sides are parallel to outer sides
1298 z6 - z5 = whatever * (z2 - z1);
1299 z8 - z7 = whatever * (z4 - z3);
1300 z8 - z5 = whatever * (z4 - z1);
1301 z7 - z6 = whatever * (z3 - z2);
1303 ne = unitvector (z4 - z1);
1304 se = unitvector (z2 - z1);
1306 ne_dist = (ne rotated 90) * pen_radius;
1307 se_dist = (se rotated 90) * pen_radius;
1309 path_a := (z1 + se_dist)
1311 path_b := (z2 + (ne_dist * offset))
1312 -- (z3 + (ne_dist * offset));
1313 path_c := (z3 - se_dist)
1315 path_d := (z4 - (ne_dist * offset))
1316 -- (z1 - (ne_dist * offset));
1318 z5 = path_a intersectionpoint path_d;
1319 z7 = path_b intersectionpoint path_c;
1321 labels (range 1 thru 8);
1330 path_in := inner_path;
1332 path_in := inner_path reflectedabout (z2, z4);
1335 path_out := lft z1 {down}
1336 .. (z1 - se_dist){se}
1337 -- (z2 - se_dist){se}
1339 .. (z2 - ne_dist){ne}
1340 -- (z3 - ne_dist){ne}
1342 .. (z3 + se_dist){-se}
1343 -- (z4 + se_dist){-se}
1345 .. (z4 + ne_dist){-ne}
1346 -- (z1 + ne_dist){-ne}
1351 save mi_weight, mi_width;
1355 fet_beginchar ("Whole mihead", "s0mi");
1356 draw_mi_head (mi_width * solfa_whole_width, mi_weight, false);
1362 fet_beginchar ("Half mihead", "s1mi");
1363 draw_mi_head (mi_width * solfa_quarter_width, mi_weight, false);
1369 fet_beginchar ("Quarter mihead", "s2mi");
1370 draw_mi_head (mi_width * solfa_quarter_width, mi_weight, false);
1375 fet_beginchar ("Whole mirror mihead", "s0miMirror");
1376 draw_mi_head (mi_width * solfa_whole_width, mi_weight, true);
1382 fet_beginchar ("Half mirror mihead", "s1miMirror");
1383 draw_mi_head (mi_width * solfa_quarter_width, mi_weight, true);
1389 fet_beginchar ("Quarter mirror mihead", "s2miMirror");
1390 draw_mi_head (mi_width * solfa_quarter_width, mi_weight, true);
1395 fet_beginchar ("Whole thin mihead", "s0miThin");
1396 draw_mi_head (mi_width * solfa_whole_width, 1, false);
1402 fet_beginchar ("Half thin mihead", "s1miThin");
1403 draw_mi_head (mi_width * solfa_quarter_width, 1, false);
1409 fet_beginchar ("Quarter thin mihead", "s2miThin");
1410 draw_mi_head (mi_width * solfa_quarter_width, 1, false);
1417 % Right triangle, hypotenuse from nw to se corner. Stem attaches on
1418 % vertical side in direction of horizontal side.
1420 def draw_fa_head (expr width_factor, thickness_factor) =
1421 set_char_box (0, width_factor * solfa_base_notewidth#,
1422 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1424 save p_down_in, p_down_out, p_up_in, p_up_out, nw_dist, nw;
1425 path p_down_in, p_down_out, p_up_in, p_up_out;
1426 save path_a, path_b, path_c;
1427 path path_a, path_b, path_c;
1431 offset := 2 * thickness_factor - 1;
1434 pen_radius := min (solfa_pen_radius,
1435 .33 * (h + d) / (1 + offset));
1437 pickup pencircle scaled (2 * pen_radius);
1450 labels (1, 2, 3, 4);
1452 nw = unitvector (z1 - z3);
1453 nw_dist = (nw rotated 90) * pen_radius;
1455 path_a := (z1 - (0,1) * offset * pen_radius)
1456 -- (z2 - (0,1) * offset * pen_radius);
1457 path_b := (z2 - (1,0) * pen_radius)
1458 -- (z3 - (1,0) * pen_radius);
1459 path_c := (z3 - nw_dist)
1462 p_up_in := (path_a intersectionpoint path_b)
1463 -- (path_b intersectionpoint path_c)
1464 -- (path_c intersectionpoint path_a)
1467 p_up_out := lft z1{down}
1468 .. (z1 + nw_dist){-nw}
1469 -- (z3 + nw_dist){-nw}
1477 p_down_in := p_up_in rotated 180 shifted (w, 0);
1478 p_down_out := p_up_out rotated 180 shifted (w, 0);
1487 fet_beginchar ("Whole fa up head", "u0fa");
1488 draw_fa_head (solfa_whole_width, fa_weight);
1494 fet_beginchar ("Whole fa down head", "d0fa");
1495 draw_fa_head (solfa_whole_width, fa_weight);
1501 fet_beginchar ("half fa up head", "u1fa");
1502 draw_fa_head (solfa_half_width, fa_weight);
1508 fet_beginchar ("Half fa down head", "d1fa");
1509 draw_fa_head (solfa_half_width, fa_weight);
1515 fet_beginchar ("Quarter fa up head", "u2fa");
1516 draw_fa_head (solfa_quarter_width, fa_weight);
1521 fet_beginchar ("Quarter fa down head", "d2fa");
1522 draw_fa_head (solfa_quarter_width, fa_weight);
1527 fet_beginchar ("Whole thin fa up head", "u0faThin");
1528 draw_fa_head (solfa_whole_width, 1);
1534 fet_beginchar ("Whole thin fa down head", "d0faThin");
1535 draw_fa_head (solfa_whole_width, 1);
1541 fet_beginchar ("half thin fa up head", "u1faThin");
1542 draw_fa_head (solfa_half_width, 1);
1548 fet_beginchar ("Half thin fa down head", "d1faThin");
1549 draw_fa_head (solfa_half_width, 1);
1555 fet_beginchar ("Quarter thin fa up head", "u2faThin");
1556 draw_fa_head (solfa_quarter_width, 1);
1561 fet_beginchar ("Quarter thin fa down head", "d2faThin");
1562 draw_fa_head (solfa_quarter_width, 1);
1570 % Note: sol head is the same shape as a standard music head, and doesn't
1571 % vary from style to style. However, width is constant with duration,
1572 % so we can't just use the standard note font.
1574 def draw_sol_head (expr filled) =
1575 draw_outside_ellipse (1.53 - puff_up_factor / 3.0, 34, 0.66, 0.17);
1577 undraw_inside_ellipse (3.25, 33, 0.81, 2.5 stafflinethickness#);
1579 draw_staff (-2, 2, 0);
1582 fet_beginchar ("Whole solhead", "s0sol");
1583 draw_sol_head ( false);
1587 fet_beginchar ("Half solhead", "s1sol");
1588 draw_sol_head ( false);
1592 fet_beginchar ("Quarter solhead", "s2sol");
1593 draw_sol_head ( true);
1601 def draw_la_head (expr width_factor, thickness_factor) =
1602 set_char_box (0, width_factor * solfa_base_notewidth#,
1603 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1608 offset := 2 * thickness_factor - 1;
1611 pen_radius := min (solfa_pen_radius,
1612 .35 * (h + d) / (1 + offset));
1614 pickup pencircle scaled (2 * pen_radius);
1627 labels (range 1 thru 4);
1629 p_in := (z1 + pen_radius * (1, -offset))
1630 -- (z2 + pen_radius * (-1, -offset))
1631 -- (z3 + pen_radius * (-1, offset))
1632 -- (z4 + pen_radius * (1, offset))
1650 fet_beginchar ("Whole lahead", "s0la");
1651 draw_la_head (solfa_whole_width, la_weight);
1657 fet_beginchar ("Half lahead", "s1la");
1658 draw_la_head (solfa_half_width, la_weight);
1664 fet_beginchar ("Quarter lahead", "s2la");
1665 draw_la_head (solfa_quarter_width, la_weight);
1670 fet_beginchar ("Whole thin lahead", "s0laThin");
1671 draw_la_head (solfa_whole_width, 1);
1677 fet_beginchar ("Half thin lahead", "s1laThin");
1678 draw_la_head (solfa_half_width, 1);
1684 fet_beginchar ("Quarter lahead", "s2laThin");
1685 draw_la_head (solfa_quarter_width, 1);
1692 % `Snow-cone', V with rounded top.
1694 def draw_ti_head (expr width_factor, dir, thickness_factor) =
1695 set_char_box (0, width_factor * solfa_base_notewidth#,
1696 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1697 save p_in, p_out, p_top, p_top_in;
1698 path p_in, p_out, p_top, p_top_in;
1703 offset := 2 * thickness_factor - 1;
1706 pen_radius := min (solfa_pen_radius,
1707 .4 * (h + d) / (1 + offset));
1709 pickup pencircle scaled (2 * pen_radius);
1714 y2 = cone_height [y1, y3];
1720 y5 = y1 + offset * pen_radius;
1722 labels (range 1 thru 4);
1724 save nw_dist, sw_dist, nw, sw;
1725 pair nw_dist, sw_dist, nw, sw;
1727 nw = unitvector (z2 - z1);
1728 sw = unitvector (z1 - z4);
1730 nw_dist = (nw rotated 90) * pen_radius;
1731 sw_dist = (sw rotated 90) * pen_radius;
1733 p_top := (z2 + nw * pen_radius)
1735 .. (z4 - sw * pen_radius);
1737 p_top_in := (z2 - nw * offset * pen_radius)
1738 .. (z3 - (0,1) * pen_radius) {right}
1739 .. (z4 + sw * offset * pen_radius);
1741 save path_a, path_b;
1742 path path_a, path_b;
1748 z6 = path_a intersectionpoint p_top_in;
1749 z7 = path_b intersectionpoint p_top_in;
1761 .. (z2 + nw * pen_radius){direction 0 of p_top}
1763 & {direction infinity of p_top}(z4 - sw * pen_radius)
1770 charwy := cone_height [-chardp, charht];
1780 fet_beginchar ("Whole up tihead", "s0ti");
1781 draw_ti_head (solfa_whole_width, 1, ti_weight);
1787 fet_beginchar ("Half up tihead", "u1ti");
1788 draw_ti_head (solfa_half_width, 1, ti_weight);
1794 fet_beginchar ("Half down tihead", "d1ti");
1795 draw_ti_head (solfa_half_width, -1, ti_weight);
1801 fet_beginchar ("Quarter up tihead", "u2ti");
1802 draw_ti_head (solfa_quarter_width, 1, ti_weight);
1807 fet_beginchar ("Quarter down tihead", "d2ti");
1808 draw_ti_head (solfa_quarter_width, -1, ti_weight);
1813 fet_beginchar ("Whole thin up tihead", "s0tiThin");
1814 draw_ti_head (solfa_whole_width, 1, 1);
1820 fet_beginchar ("Half thin up tihead", "u1tiThin");
1821 draw_ti_head (solfa_half_width, 1, 1);
1827 fet_beginchar ("Half thin down tihead", "d1tiThin");
1828 draw_ti_head (solfa_half_width, -1, 1);
1834 fet_beginchar ("Quarter thin up tihead", "u2tiThin");
1835 draw_ti_head (solfa_quarter_width, 1, 1);
1840 fet_beginchar ("Quarter thin down tihead", "d2tiThin");
1841 draw_ti_head (solfa_quarter_width, -1, 1);
1846 %%%%%% Funk shape note heads
1848 % Funk heads are narrower than Aiken and Sacred Harp, so we need a new
1851 funk_notehead_width := 0.75;
1855 % Parabolic on one side, vertical line on other
1856 % Has up and down shapes for *all* notes
1858 def draw_Funk_do_head (expr width_factor, thickness_factor) =
1859 set_char_box (0, width_factor * solfa_base_notewidth#,
1860 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1863 offset := 2 * thickness_factor - 1;
1866 pen_radius := min (solfa_pen_radius,
1867 .3 * (h + d) / (1 + offset));
1869 pickup pencircle scaled (2 * pen_radius);
1880 x4 = x1 - pen_radius;
1881 y4 = y1 + offset * pen_radius;
1884 x5 = x2 + pen_radius;
1887 y6 = y3 - offset * pen_radius;
1889 save p_up_in, p_up_out, p_down_in, p_down_out;
1890 path p_up_in, p_up_out, p_down_in, p_down_out;
1892 p_down_in := z4{left}
1897 p_down_out := bot z1{left}
1904 p_up_in := p_down_in rotated 180 shifted (w,0);
1905 p_up_out := p_down_out rotated 180 shifted (w,0);
1910 save funk_do_weight;
1911 funk_do_weight := 1.7;
1913 fet_beginchar ("Whole up Funk dohead", "u0doFunk");
1914 draw_Funk_do_head (funk_notehead_width, funk_do_weight);
1920 fet_beginchar ("Whole down Funk dohead", "d0doFunk");
1921 draw_Funk_do_head (funk_notehead_width, funk_do_weight);
1927 fet_beginchar ("Half up Funk dohead", "u1doFunk");
1928 draw_Funk_do_head (funk_notehead_width, funk_do_weight);
1934 fet_beginchar ("Half down Funk dohead", "d1doFunk");
1935 draw_Funk_do_head (funk_notehead_width, funk_do_weight);
1941 fet_beginchar ("Quarter up Funk dohead", "u2doFunk");
1942 draw_Funk_do_head (funk_notehead_width, funk_do_weight);
1947 fet_beginchar ("Quarter down Funk dohead", "d2doFunk");
1948 draw_Funk_do_head (funk_notehead_width, funk_do_weight);
1955 % Has up and down shapes for *all* notes
1957 def draw_Funk_re_head (expr width_factor, thickness_factor) =
1958 set_char_box (0, width_factor * solfa_base_notewidth#,
1959 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1962 offset := 2 * thickness_factor - 1;
1965 pen_radius := min (solfa_pen_radius,
1966 .3 * (h + d) / (1 + offset));
1968 pickup pencircle scaled (2 * pen_radius);
1979 x3 := curve_in [x1, x2];
1987 save ne, se, ne_perp, se_perp;
1988 pair ne, se, ne_perp, se_perp;
1990 ne := unitvector (z2 - z1);
1991 se := unitvector (z4 - z1);
1992 ne_perp := ne rotated 90;
1993 se_perp := se rotated 90;
1995 save path_a, path_b, path_c, path_d;
1996 path path_a, path_b, path_c, path_d;
1997 save arrow_a_perp, arrow_b_perp;
1998 pair arrow_a_perp, arrow_b_perp;
2001 path_d := z2 .. z3{down} .. z4;
2002 arrow_a_perp = unitvector (direction 0 of path_d rotated 90)
2004 arrow_b_perp = unitvector (direction 2 of path_d rotated 90)
2007 path_b := (z1 + se_perp * pen_radius)
2008 -- z4 + se_perp * offset * pen_radius;
2009 path_a := (z1 - ne_perp * pen_radius)
2010 -- z2 - ne_perp * offset * pen_radius;
2011 path_c := z2 - arrow_a_perp
2013 .. z4 - arrow_b_perp;
2015 z5 = path_a intersectionpoint path_b;
2016 z7 = path_a intersectionpoint path_c;
2017 z8 = path_b intersectionpoint path_c;
2019 save p_up_in, p_down_in, p_up_out, p_down_out;
2020 path p_up_in, p_down_in, p_up_out, p_down_out;
2028 p_down_out := lft z1{up}
2029 .. (z1 + ne_perp * pen_radius){ne}
2030 -- (z2 + ne_perp * pen_radius){ne}
2033 .. (z2 + arrow_a_perp)
2035 .. (z4 + arrow_b_perp)
2038 .. z4 - se_perp * pen_radius
2039 -- z1 - se_perp * pen_radius
2042 p_up_in := p_down_in rotated 180 shifted (w, 0);
2043 p_up_out := p_down_out rotated 180 shifted (w, 0);
2048 save funk_re_weight;
2049 funk_re_weight = 1.7;
2051 fet_beginchar ("Whole up Funk rehead", "u0reFunk");
2052 draw_Funk_re_head (funk_notehead_width, funk_re_weight);
2058 fet_beginchar ("Whole down Funk rehead", "d0reFunk");
2059 draw_Funk_re_head (funk_notehead_width, funk_re_weight);
2065 fet_beginchar ("Half up Funk rehead", "u1reFunk");
2066 draw_Funk_re_head (funk_notehead_width, funk_re_weight);
2072 fet_beginchar ("Half down Funk rehead", "d1reFunk");
2073 draw_Funk_re_head (funk_notehead_width, funk_re_weight);
2079 fet_beginchar ("Quarter up Funk rehead", "u2reFunk");
2080 draw_Funk_re_head (funk_notehead_width, funk_re_weight);
2085 fet_beginchar ("Quarter down Funk rehead", "d2reFunk");
2086 draw_Funk_re_head (funk_notehead_width, funk_re_weight);
2093 % Has up and down shapes for all hollow notes
2095 save funk_mi_width, funk_mi_weight;
2096 funk_mi_width := 1.2;
2097 funk_mi_weight := 1.9;
2099 fet_beginchar ("Whole up Funk mihead", "u0miFunk");
2100 draw_mi_head (funk_mi_width * funk_notehead_width,
2101 funk_mi_weight, false);
2107 fet_beginchar ("Whole down Funk mihead", "d0miFunk");
2108 draw_mi_head (funk_mi_width * funk_notehead_width,
2109 funk_mi_weight, true);
2115 fet_beginchar ("Half up Funk mihead", "u1miFunk");
2116 draw_mi_head (funk_mi_width * funk_notehead_width,
2117 funk_mi_weight, false);
2123 fet_beginchar ("Half down Funk mihead", "d1miFunk");
2124 draw_mi_head (funk_mi_width * funk_notehead_width,
2125 funk_mi_weight, true);
2131 fet_beginchar ("Quarter Funk mihead", "s2miFunk");
2132 draw_mi_head (funk_mi_width * funk_notehead_width,
2133 funk_mi_weight, false);
2140 % Does it rotate for whole notes?
2141 % Same as other shape note systems
2142 % Need special notes because of special width
2144 save funk_fa_weight;
2145 funk_fa_weight := 1.9;
2147 fet_beginchar ("Whole up Funk fahead", "u0faFunk");
2148 draw_fa_head (funk_notehead_width, funk_fa_weight);
2154 fet_beginchar ("Whole down Funk fahead", "d0faFunk");
2155 draw_fa_head (funk_notehead_width, funk_fa_weight);
2161 fet_beginchar ("Half up Funk fahead", "u1faFunk");
2162 draw_fa_head (funk_notehead_width, funk_fa_weight);
2168 fet_beginchar ("Half down Funk fahead", "d1faFunk");
2169 draw_fa_head (funk_notehead_width, funk_fa_weight);
2175 fet_beginchar ("Quarter up Funk fahead", "u2faFunk");
2176 draw_fa_head (funk_notehead_width, funk_fa_weight);
2181 fet_beginchar ("Quarter down Funk fahead", "d2faFunk");
2182 draw_fa_head (funk_notehead_width, funk_fa_weight);
2187 %%%%%% Funk sol head is the same as the others
2188 % Need special character because of skinnier head
2190 def draw_Funk_sol_head (expr filled) =
2193 noteheight# := solfa_noteheight#;
2194 draw_outside_ellipse (1.2, 34, 0.71, 0.);
2196 undraw_inside_ellipse (1.9, 33, 0.74, 5.5 stafflinethickness#);
2198 draw_staff (-2, 2, 0);
2203 fet_beginchar ("Whole Funk solhead", "s0solFunk");
2204 draw_Funk_sol_head ( false);
2208 fet_beginchar ("Half Funk solhead", "s1solFunk");
2209 draw_Funk_sol_head ( false);
2213 fet_beginchar ("Quarter Funk solhead", "s2solFunk");
2214 draw_Funk_sol_head ( true);
2220 % Same as for other shape notes
2221 % Smaller width requires special characters
2223 save funk_la_weight;
2224 funk_la_weight := 1.9;
2226 fet_beginchar ("Whole Funk lahead", "s0laFunk");
2227 draw_la_head (funk_notehead_width, funk_notehead_width);
2233 fet_beginchar ("Half Funk lahead", "s1laFunk");
2234 draw_la_head (funk_notehead_width, funk_notehead_width);
2240 fet_beginchar ("Quarter Funk lahead", "s2laFunk");
2241 draw_la_head (funk_notehead_width, funk_notehead_width);
2247 % `Sideways snow cone'.
2248 % Rotates for all notes.
2250 def draw_Funk_ti_head (expr width_factor, thickness_factor) =
2251 set_char_box (0, width_factor * solfa_base_notewidth#,
2252 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
2257 offset := 2 * thickness_factor - 1;
2260 pen_radius := min (solfa_pen_radius,
2261 .33 * (h + d) / (1 + offset));
2263 pickup pencircle scaled (2 * pen_radius);
2268 x2 = cone_width [x1, x3];
2277 save nw_dist, sw_dist, ne, se;
2278 pair nw_dist, sw_dist, ne, se;
2280 ne = unitvector (z2 - z1);
2281 se = unitvector (z4 - z1);
2283 nw_dist = (ne rotated 90) * pen_radius ;
2284 sw_dist = (se rotated -90) * pen_radius;
2286 save path_a, path_b;
2287 path path_a, path_b;
2288 path_a := z1 - nw_dist
2289 -- z2 - offset * nw_dist;
2290 path_b := z1 - sw_dist
2291 -- z4 - offset * sw_dist;
2293 save path_right, path_right_in;
2294 path path_right, path_right_in;
2295 path_right := (z2 + ne * pen_radius)
2297 .. (z4 + se * pen_radius);
2299 path_right_in := (z2 - ne * pen_radius)
2301 .. (z4 - se * pen_radius);
2303 z5 = path_a intersectionpoint path_b;
2304 z6 = path_a intersectionpoint path_right_in;
2305 z7 = path_b intersectionpoint path_right_in;
2307 save p_up_in, p_down_in, p_up_out, p_down_out;
2308 path p_up_in, p_down_in, p_up_out, p_down_out;
2316 p_down_out := lft z1
2320 .. (z2 + ne * pen_radius){direction 0 of path_right}
2322 & {direction infinity of path_right}(z4 + se * pen_radius)
2328 p_up_in := p_down_in rotated 180 shifted (w, 0);
2329 p_up_out := p_down_out rotated 180 shifted (w, 0);
2333 save funk_ti_weight;
2334 funk_ti_weight := 1.6;
2336 fet_beginchar ("Whole up Funk tihead", "u0tiFunk");
2337 draw_Funk_ti_head (funk_notehead_width, funk_ti_weight);
2343 fet_beginchar ("Whole down Funk tihead", "d0tiFunk");
2344 draw_Funk_ti_head (funk_notehead_width, funk_ti_weight);
2350 fet_beginchar ("Half up Funk tihead", "u1tiFunk");
2351 draw_Funk_ti_head (funk_notehead_width, funk_ti_weight);
2357 fet_beginchar ("Half down Funk tihead", "d1tiFunk");
2358 draw_Funk_ti_head (funk_notehead_width, funk_ti_weight);
2364 fet_beginchar ("Quarter up Funk tihead", "u2tiFunk");
2365 draw_Funk_ti_head (funk_notehead_width, funk_ti_weight);
2370 fet_beginchar ("Quarter down Funk tihead", "d2tiFunk");
2371 draw_Funk_ti_head (funk_notehead_width, funk_ti_weight);
2376 %%%%%% Walker shape note heads
2378 % Walker heads are narrow like Funk heads, so use funk_notehead_width.
2381 %%%%%% Walker do head
2383 % Trapezoid, with largest side on stem side
2385 def draw_Walker_do_head (expr width_factor, dir, thickness_factor) =
2386 set_char_box (0, width_factor * solfa_base_notewidth#,
2387 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
2389 pickup pencircle scaled solfa_pen_thick;
2392 offset := 2 * thickness_factor - 1;
2394 % adjust width so stem can be centered
2395 if .5w <> good.x .5w: change_width; fi
2399 scaling# = charwd / w;
2404 x1 = inset [x4, x3];
2407 x2 = inset [x3, x4];
2416 labels (range 1 thru 4);
2418 save left_dir, left_perp, right_dir, right_perp;
2419 pair left_dir, left_perp, right_dir, right_perp;
2421 left_dir = unitvector(z1 - z4);
2422 left_perp = (left_dir rotated 90) * solfa_pen_radius;
2423 right_dir = unitvector(z3 - z2);
2424 right_perp = (right_dir rotated 90) * solfa_pen_radius;
2426 save path_a, path_b, path_c, path_d;
2427 path path_a, path_b, path_c, path_d;
2429 path_a := (z4 - left_perp)
2430 -- (z1 - left_perp);
2431 path_b := (z1 - (0, offset*solfa_pen_radius))
2432 -- (z2 - (0, offset*solfa_pen_radius));
2433 path_c := (z2 - right_perp)
2434 -- (z3 - right_perp);
2435 path_d := (z3 + (0, offset*solfa_pen_radius))
2436 -- (z4 + (0, offset*solfa_pen_radius));
2441 p_in := (path_a intersectionpoint path_b)
2442 -- (path_b intersectionpoint path_c)
2443 -- (path_c intersectionpoint path_d)
2444 -- (path_d intersectionpoint path_a)
2447 p_out := top z1{right}
2449 .. z2 + right_perp {right_dir}
2450 -- z3 + right_perp {right_dir}
2453 .. z4 + left_perp {left_dir}
2454 .. z1 + left_perp {left_dir}
2457 charwx := scaling# * (w/2 + solfa_pen_radius);
2458 charwy := scaling# * y2 ;
2461 p_in := p_in rotated 180 shifted (w,0);
2462 p_out := p_out rotated 180 shifted (w,0);
2467 save walker_do_weight;
2468 walker_do_weight := 1.5;
2470 fet_beginchar ("Whole Walker dohead", "s0doWalker");
2471 draw_Walker_do_head (funk_notehead_width, 0, walker_do_weight);
2477 fet_beginchar ("Half up Walker dohead", "u1doWalker");
2478 draw_Walker_do_head (funk_notehead_width, 1, walker_do_weight);
2484 fet_beginchar ("Half down Walker dohead", "d1doWalker");
2485 draw_Walker_do_head (funk_notehead_width, 0, walker_do_weight);
2491 fet_beginchar ("Quarter up Walker dohead", "u2doWalker");
2492 draw_Walker_do_head (funk_notehead_width, 1, walker_do_weight);
2497 fet_beginchar ("Quarter down Walker dohead", "d2doWalker");
2498 draw_Walker_do_head (funk_notehead_width, 0, walker_do_weight);
2503 %%%%%% Walker re head
2504 % Parabolic on one side, shallow parabola on other
2505 % Has up and down shapes for *all* notes
2507 def draw_Walker_re_head (expr width_factor, thickness_factor) =
2508 set_char_box (0, width_factor * solfa_base_notewidth#,
2509 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
2512 offset := 2 * thickness_factor - 1;
2515 pen_radius := min (solfa_pen_radius,
2516 .3 * (h + d) / (1 + offset));
2518 pickup pencircle scaled (2 * pen_radius);
2521 dish_factor := 0.20;
2532 x4 = dish_factor [x1, x2];
2536 y5 = y1 + offset * pen_radius;
2539 x6 = x2 + pen_radius;
2542 y7 = y3 - offset * pen_radius;
2545 x8 = x4 - pen_radius;
2547 save path_a, path_d;
2548 path path_a, path_d;
2550 save p_a_start_dir, p_a_end_dir, p_a_start_perp, p_a_end_perp;
2551 pair p_a_start_dir, p_a_end_dir, p_a_start_perp, p_a_end_perp;
2553 path_a := z3 .. z4{down} .. z1;
2555 p_a_start_dir := unitvector(direction 0 of path_a);
2556 p_a_end_dir := unitvector(direction infinity of path_a);
2557 p_a_start_perp := (p_a_start_dir rotated 90) * pen_radius;
2558 p_a_end_perp := (p_a_end_dir rotated 90) * pen_radius;
2560 path_d := (z3 - p_a_start_perp){p_a_start_dir}
2562 ..(z1 - p_a_end_perp){p_a_end_dir};
2564 save path_b, path_c;
2565 path path_b, path_c;
2567 path_b := z5 {left} .. z6{up};
2568 path_c := z7 {left} .. z6{down};
2570 z9 = path_d intersectionpoint path_b;
2571 z10 = path_d intersectionpoint path_c;
2573 labels (range 1 thru 4);
2575 save p_up_in, p_up_out, p_down_in, p_down_out;
2576 path p_up_in, p_up_out, p_down_in, p_down_out;
2579 ... {right} z10 {p_a_start_dir}
2581 .. {p_a_end_dir} z9 {left}
2584 p_down_out := lft z2{up}
2587 .. (z3 + p_a_start_perp){p_a_start_dir}
2589 .. (z1 + p_a_end_perp) {p_a_end_dir}
2594 p_up_in := p_down_in rotated 180 shifted (w,0);
2595 p_up_out := p_down_out rotated 180 shifted (w,0);
2599 save walker_re_weight;
2600 walker_re_weight := 1.2;
2602 fet_beginchar ("Whole Walker rehead", "s0reWalker");
2603 draw_Walker_re_head (funk_notehead_width, walker_re_weight);
2609 fet_beginchar ("Half up Walker rehead", "u1reWalker");
2610 draw_Walker_re_head (funk_notehead_width, walker_re_weight);
2616 fet_beginchar ("Half down Walker rehead", "d1reWalker");
2617 draw_Walker_re_head (funk_notehead_width, walker_re_weight);
2623 fet_beginchar ("Quarter up Walker rehead", "u2reWalker");
2624 draw_Walker_re_head (funk_notehead_width, walker_re_weight);
2629 fet_beginchar ("Quarter down Walker rehead", "d2reWalker");
2630 draw_Walker_re_head (funk_notehead_width, walker_re_weight);
2635 %%%%%% Walker mi head
2637 % Symmetric for all hollow notes
2639 save walker_mi_width, walker_mi_weight;
2640 walker_mi_width := 1.2;
2641 walker_mi_weight := 1.5;
2643 fet_beginchar ("Whole Walker mihead", "s0miWalker");
2644 draw_mi_head (walker_mi_width * funk_notehead_width,
2645 walker_mi_weight, true);
2651 fet_beginchar ("Half Walker mihead", "s1miWalker");
2652 draw_mi_head (walker_mi_width * funk_notehead_width,
2653 walker_mi_weight, true);
2659 fet_beginchar ("Quarter Walker mihead", "s2miWalker");
2660 draw_mi_head (walker_mi_width * funk_notehead_width,
2661 walker_mi_weight, true);
2668 % Does not rotate for whole notes
2669 % Whole rotation is different from Funk, so special notes
2671 %%%%%% Funk sol head is the same as the others
2672 % Need special character because of skinnier head
2674 save walker_fa_weight;
2675 walker_fa_weight := 1.5;
2677 fet_beginchar ("Whole Walker fahead", "s0faWalker");
2678 draw_fa_head (funk_notehead_width, walker_fa_weight);
2684 fet_beginchar ("Half up Walker fahead", "u1faWalker");
2685 draw_fa_head (funk_notehead_width, walker_fa_weight);
2691 fet_beginchar ("Half down Walker fahead", "d1faWalker");
2692 draw_fa_head (funk_notehead_width, walker_fa_weight);
2698 fet_beginchar ("Quarter up Walker fahead", "u2faWalker");
2699 draw_fa_head (funk_notehead_width, walker_fa_weight);
2704 fet_beginchar ("Quarter down Walker fahead", "d2faWalker");
2705 draw_fa_head (funk_notehead_width, walker_fa_weight);
2711 % Same as Funk, no special notes
2714 %%%%%% Walker la head
2716 % Lighter weight requires separate notes
2718 save walker_la_weight;
2719 walker_la_weight := 1.5;
2721 fet_beginchar ("Whole Walker lahead", "s0laWalker");
2722 draw_la_head (funk_notehead_width, walker_la_weight);
2728 fet_beginchar ("Half Funk lahead", "s1laWalker");
2729 draw_la_head (funk_notehead_width, walker_la_weight);
2735 fet_beginchar ("Quarter Funk lahead", "s2laWalker");
2736 draw_la_head (funk_notehead_width, walker_la_weight);
2741 %%%%%% Walker ti head
2742 % Triangular arrowhead
2743 % Rotates for all but whole notes
2745 def draw_Walker_ti_head (expr width_factor, thickness_factor) =
2746 set_char_box (0, width_factor * solfa_base_notewidth#,
2747 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
2750 offset := 2 * thickness_factor - 1;
2753 pen_radius := min (solfa_pen_radius,
2754 .3 * (h + d) / (1 + offset));
2756 pickup pencircle scaled (2 * pen_radius);
2768 labels (range 1 thru 4);
2770 save nw_dist, sw_dist, ne, se;
2771 pair nw_dist, sw_dist, ne, se;
2773 ne = unitvector (z2 - z1);
2774 se = unitvector (z3 - z1);
2776 nw_dist = (ne rotated 90) * pen_radius ;
2777 sw_dist = (se rotated -90) * pen_radius;
2780 save path_a, path_b, path_c;
2781 path path_a, path_b, path_c;
2782 path_a := z2 - nw_dist * offset
2783 -- z1 - nw_dist * offset;
2784 path_b := z3 - sw_dist * offset
2785 -- z1 - sw_dist * offset;
2786 path_c := z2 + left * pen_radius
2787 -- z3 + left * pen_radius;
2789 z4 = path_a intersectionpoint path_b;
2790 z5 = path_a intersectionpoint path_c;
2791 z6 = path_b intersectionpoint path_c;
2793 save p_up_in, p_down_in, p_up_out, p_down_out;
2794 path p_up_in, p_down_in, p_up_out, p_down_out;
2801 p_down_out := lft z1{up}
2802 .. (z1 + nw_dist){ne}
2803 -- (z2 + nw_dist){ne}
2808 .. (z3 + sw_dist){- se}
2809 .. (z1 + sw_dist){- se}
2812 p_up_in := p_down_in rotated 180 shifted (w, 0);
2813 p_up_out := p_down_out rotated 180 shifted (w, 0);
2817 save walker_ti_weight;
2818 walker_ti_weight := 1.4;
2820 fet_beginchar ("Whole Walker tihead", "s0tiWalker");
2821 draw_Walker_ti_head (funk_notehead_width, walker_ti_weight);
2827 fet_beginchar ("Half up Walker tihead", "u1tiWalker");
2828 draw_Walker_ti_head (funk_notehead_width, walker_ti_weight);
2834 fet_beginchar ("Half down Walker tihead", "d1tiWalker");
2835 draw_Walker_ti_head (funk_notehead_width, walker_ti_weight);
2841 fet_beginchar ("Quarter up Walker tihead", "u2tiWalker");
2842 draw_Walker_ti_head (funk_notehead_width, walker_ti_weight);
2847 fet_beginchar ("Quarter down Walker tihead", "d2tiWalker");
2848 draw_Walker_ti_head (funk_notehead_width, walker_ti_weight);
2852 fet_endgroup ("noteheads");
2856 % we derive black_notehead_width# from the quarter head,
2857 % so we have to define black_notehead_width (pixel qty)
2858 % after the black_notehead_width# itself.
2860 % Let's keep it outside the group as well.
2863 define_pixels (black_notehead_width);