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--2010 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 black_notehead_width, noteheight;
40 save half_notehead_width, whole_notehead_width, slash_thick;
41 save slash_slope, overdone_heads, solfa_noteheight;
45 numeric black_notehead_width;
46 numeric whole_notehead_width;
47 numeric half_notehead_width;
50 fet_begingroup ("noteheads");
53 % Slope of slash. From scm/grob-description.scm. How to auto-copy?
56 % Thickness of slash lines. Quarter notes get 1.5slt width.
57 slash_thick# := 2/3 * 0.48 staff_space#;
61 % Hand-engraved music often has balls extending above and below
62 % the lines. If you like that, modify overdone heads (unit:
63 % stafflinethickness).
66 noteheight# := staff_space# + (1 + overdone_heads) * stafflinethickness#;
70 % solfa heads should not overlap on chords.
72 solfa_noteheight# := staff_space# - stafflinethickness#;
74 define_pixels (slash_thick);
75 define_whole_vertical_pixels (noteheight);
78 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
80 % SLANT moves both extrema on the long axis (by SLANT * ELLIPTICITY,
81 % so SLANT = -1, puts the extreme on the long axis next to the short
85 def draw_outside_ellipse (expr ellipticity, tilt, superness, slant) =
90 pat := superellipse ((ellipticity, 0), (-slant * ellipticity, 1.0),
91 (-ellipticity, 0), (slant * ellipticity, -1.0),
93 pat := pat rotated tilt;
95 save top_point, right_point;
96 pair top_point, right_point;
98 top_point := directionpoint left of pat;
99 right_point := directionpoint up of pat;
103 scaling# = noteheight# / (2 ypart (top_point));
104 width# := 2 xpart (right_point) * scaling#;
105 define_pixels (scaling, width);
107 set_char_box (0, width#, noteheight# / 2, noteheight# / 2);
109 d := d - feta_space_shift;
112 charwy := ypart (right_point) * scaling#;
115 pat := pat scaled scaling shifted (w / 2, .5 (h - d));
117 width := hround width;
119 if test_outlines = 1:
127 def undraw_inside_ellipse (expr ellipticity, tilt, superness, clearance) =
132 pat := superellipse ((ellipticity, 0), (0, 1.0),
133 (-ellipticity, 0), (0, -1.0),
135 pat := pat rotated tilt;
137 save top_point, right_point;
138 pair top_point, right_point;
140 top_point := directionpoint left of pat;
141 right_point := directionpoint up of pat;
143 save height, scaling;
145 height# = staff_space# + stafflinethickness# - clearance;
146 scaling# = height# / (2 ypart (top_point));
147 define_pixels (scaling);
148 pat := pat scaled scaling shifted (w / 2, .5 (h - d));
150 if test_outlines = 1:
160 % dimensions aren't entirely right.
162 def draw_longa (expr up) =
163 save stemthick, fudge;
165 stemthick# = 2 stafflinethickness#;
166 define_whole_blacker_pixels (stemthick);
168 fudge = hround (blot_diameter / 2);
170 draw_outside_ellipse (1.80, 0, 0.707, 0);
171 undraw_inside_ellipse (1.30, 125, 0.68, 2 stafflinethickness#);
173 pickup pencircle scaled stemthick;
183 top y4 = h + 3.0 staff_space;
186 bot y1 = -d - 3.0 staff_space;
197 draw_gridline (z1, z2, stemthick);
198 draw_gridline (z3, z4, stemthick);
204 fet_beginchar ("Longa notehead", "uM2");
207 draw_staff (-2, 2, 0);
210 fet_beginchar ("Longa notehead", "dM2");
213 draw_staff (-2, 2, 0);
218 fet_beginchar ("Longa notehead", "uM2");
221 draw_staff (-2, 2, 0.5);
224 fet_beginchar ("Longa notehead", "dM2");
227 draw_staff (-2, 2, 0.5);
233 % dimensions aren't entirely right.
235 def draw_brevis (expr linecount) =
236 save stemthick, fudge;
238 stemthick# = 2 stafflinethickness#;
239 define_whole_blacker_pixels (stemthick);
241 fudge = hround (blot_diameter / 2);
243 draw_outside_ellipse (1.80, 0, 0.707, 0);
244 undraw_inside_ellipse (1.30, 125, 0.68, 2 stafflinethickness#);
246 pickup pencircle scaled stemthick;
258 for i := 0 step 1 until linecount - 1:
259 draw_gridline (z1 - (1.5 * i * stemthick, 0),
260 z2 - (1.5 * i * stemthick, 0), stemthick);
261 draw_gridline (z3 + (1.5 * i * stemthick, 0),
262 z4 + (1.5 * i * stemthick, 0), stemthick);
267 fet_beginchar ("Brevis notehead", "sM1");
270 draw_staff (-2, 2, 0);
275 fet_beginchar ("Brevis notehead", "sM1");
278 draw_staff (-2, 2, 0.5);
283 fet_beginchar ("Double-lined brevis notehead", "sM1double");
286 draw_staff (-2, 2, 0);
291 fet_beginchar ("Double-lined brevis notehead", "sM1double");
294 draw_staff (-2, 2, 0.5);
299 fet_beginchar ("Whole notehead", "s0");
300 draw_outside_ellipse (1.80 - puff_up_factor / 3.0, 0, 0.707, 0);
301 undraw_inside_ellipse (1.30, 125 - puff_up_factor * 10,
302 0.68, 2 stafflinethickness#);
304 whole_notehead_width# := charwd;
306 draw_staff (-2, 2, 0);
311 fet_beginchar ("Whole notehead", "s0");
312 draw_outside_ellipse (1.80 - puff_up_factor / 3.0, 0,
314 undraw_inside_ellipse (1.30, 125 - puff_up_factor * 10,
315 0.68, 2 stafflinethickness#);
317 draw_staff (-2, 2, 0.5);
322 fet_beginchar ("Half notehead", "s1");
323 draw_outside_ellipse (1.53 - puff_up_factor / 3.0, 34, 0.66, 0.17);
324 undraw_inside_ellipse (3.25, 33, 0.81, 2.5 stafflinethickness#);
326 half_notehead_width# := charwd;
328 draw_staff (-2, 2, 0);
333 fet_beginchar ("Half notehead", "s1");
334 draw_outside_ellipse (1.53 - puff_up_factor / 3.0, 34,
336 undraw_inside_ellipse (3.25, 33, 0.81,
337 2.5 stafflinethickness#);
339 draw_staff (-2, 2, 0.5);
344 fet_beginchar ("Quart notehead", "s2");
345 % used to have 32. With 31, they are slightly bolder.
346 draw_outside_ellipse (1.49 - puff_up_factor / 3.0, 31, 0.707, 0);
347 black_notehead_width# := charwd;
349 draw_staff (-2, 2, 0);
354 fet_beginchar ("Quart notehead", "s2");
355 draw_outside_ellipse (1.49 - puff_up_factor / 3.0, 31,
358 draw_staff (-2, 2, 0.5);
363 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
366 fet_beginchar ("Whole diamondhead", "s0diamond");
367 draw_outside_ellipse (1.80, 0, 0.495, 0);
368 undraw_inside_ellipse (1.30, 125, 0.6,
369 .4 staff_space# + stafflinethickness#);
371 draw_staff (-2, 2, 0);
376 fet_beginchar ("Whole diamondhead", "s0diamond");
377 draw_outside_ellipse (1.80, 0, 0.495, 0);
378 undraw_inside_ellipse (1.30, 125, 0.6,
379 .4 staff_space# + stafflinethickness#);
381 draw_staff (-2, 2, 0.5);
386 fet_beginchar ("Half diamondhead", "s1diamond");
387 draw_outside_ellipse (1.50, 34, 0.49, 0.17);
388 undraw_inside_ellipse (3.5, 33, 0.80,
389 .3 staff_space# + 1.5 stafflinethickness#);
391 draw_staff (-2, 2, 0);
396 fet_beginchar ("Half diamondhead", "s1diamond");
397 draw_outside_ellipse (1.50, 34, 0.49, 0.17);
398 undraw_inside_ellipse (3.5, 33, 0.80,
400 + 1.5 stafflinethickness#);
402 draw_staff (-2, 2, 0.5);
407 fet_beginchar ("Quart diamondhead", "s2diamond");
408 draw_outside_ellipse (1.80, 35, 0.495, -0.25);
410 draw_staff (-2, 2, 0);
415 fet_beginchar ("Quart diamondhead", "s2diamond");
416 draw_outside_ellipse (1.80, 35, 0.495, -0.25);
418 draw_staff (-2, 2, 0.5);
423 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
426 vardef penposx@# (expr d) =
436 z@#l = pat intersectionpoint (z@# -- infinity * dir (d + 180));
437 z@#r = pat intersectionpoint (z@# -- infinity * dir (d));
443 % UGH: xs not declared as argument.
445 def define_triangle_shape (expr stemdir) =
446 save triangle_a, triangle_b, triangle_c;
447 save triangle_out_a, triangle_out_b, triangle_out_c;
448 save triangle_in, triangle_out;
449 save width, depth, height;
450 save origin, left_up_dir;
451 save exact_left_point, exact_right_point, exact_down_point;
453 path triangle_a, triangle_b, triangle_c;
454 path triangle_out_a, triangle_out_b, triangle_out_c;
455 path triangle_in, triangle_out;
456 pair origin, left_up_dir;
457 pair exact_down_point, exact_left_point, exact_right_point;
460 pen_thick# = stafflinethickness# + .1 staff_space#;
461 define_pixels (llap);
462 define_blacker_pixels (pen_thick);
464 left_up_dir = llap# * dir (90 + tilt);
466 xpart (left_up_dir) * xs - (pen_thick# * xs) / 2 + xpart origin = 0;
469 exact_left_point := origin + (left_up_dir xscaled xs);
470 exact_down_point := origin + (left_up_dir rotated 120 xscaled xs);
471 exact_right_point := origin + (left_up_dir rotated 240 xscaled xs);
473 height# = ypart (exact_left_point + origin) + pen_thick# / 2;
474 depth# = -ypart (exact_down_point + origin) + pen_thick# / 2;
475 width# = xpart (exact_right_point - exact_left_point)
478 set_char_box (0, width#, depth#, height#);
480 % Formerly, the shape has simply been drawn with an elliptical pen
481 % (`scaled pen_thick xscaled xs'), but the envelope of such a curve
482 % is of 6th degree. For the sake of mf2pt1, we approximate it.
484 pickup pencircle scaled pen_thick xscaled xs;
486 z0 = (hround_pixels (xpart origin), 0);
488 z1 = z1' = z0 + llap * dir (90 + tilt) xscaled xs;
489 z2 = z2' = z0 + llap * dir (90 + tilt + 120) xscaled xs;
490 z3 = z3' = z0 + llap * dir (90 + tilt + 240) xscaled xs;
492 z12 = caveness [.5[z1, z2], z3];
493 z23 = caveness [.5[z2, z3], z1];
494 z31 = caveness [.5[z3, z1], z2];
496 triangle_a = z1 .. z12 .. z2;
497 triangle_b = z2 .. z23 .. z3;
498 triangle_c = z3 .. z31 .. z1;
500 penposx1 (angle (direction 0 of triangle_a) - 90);
501 penposx2 (angle (direction 0 of triangle_b) - 90);
502 penposx3 (angle (direction 0 of triangle_c) - 90);
504 penposx1' (angle (direction infinity of triangle_c) + 90);
505 penposx2' (angle (direction infinity of triangle_a) + 90);
506 penposx3' (angle (direction infinity of triangle_b) + 90);
508 penposx12 (angle (z12 - z0));
509 penposx23 (angle (z23 - z0));
510 penposx31 (angle (z31 - z0));
512 z10 = (z0 -- z1) intersectionpoint (z1l .. z12l .. z2'r);
513 z20 = (z0 -- z2) intersectionpoint (z2l .. z23l .. z3'r);
514 z30 = (z0 -- z3) intersectionpoint (z3l .. z31l .. z1'r);
527 triangle_out_a = z1r .. z12r .. z2'l;
528 triangle_out_b = z2r .. z23r .. z3'l;
529 triangle_out_c = z3r .. z31r .. z1'l;
531 triangle_out = top z1
533 .. z1r{direction 0 of triangle_out_a}
535 & {direction infinity of triangle_out_a}z2'l
538 .. z2r{direction 0 of triangle_out_b}
540 & {direction infinity of triangle_out_b}z3'l
543 .. z3r{direction 0 of triangle_out_c}
545 & {direction infinity of triangle_out_c}z1'l
548 labels (0, 10, 20, 30);
549 penlabels (1, 1', 2, 2', 3, 3', 12, 23, 31);
553 charwy := ypart exact_right_point;
554 charwx := xpart exact_right_point + .5 pen_thick# * xs;
556 charwy := -ypart exact_down_point;
557 charwx := width# - (xpart exact_down_point - .5 pen_thick# * xs);
562 def draw_whole_triangle_head =
568 llap# = 3/4 noteheight#;
572 define_triangle_shape (1);
578 fet_beginchar ("Whole trianglehead", "s0triangle");
579 draw_whole_triangle_head;
581 draw_staff (-2, 2, 0);
586 fet_beginchar ("Whole trianglehead", "s0triangle");
587 draw_whole_triangle_head;
589 draw_staff (-2, 2, 0.5);
594 def draw_small_triangle_head (expr dir) =
600 llap# = 2/3 noteheight#;
603 define_triangle_shape (dir);
607 filldraw triangle_out;
608 unfilldraw triangle_in;
612 fet_beginchar ("Half trianglehead (downstem)", "d1triangle");
613 draw_small_triangle_head (-1);
615 draw_staff (-2, 2, 0);
619 fet_beginchar ("Half trianglehead (upstem)", "u1triangle");
620 draw_small_triangle_head (1);
622 draw_staff (-2, 2, 0.5);
626 def draw_closed_triangle_head (expr dir) =
632 llap# = 2/3 noteheight#;
635 define_triangle_shape (dir);
640 fet_beginchar ("Quart trianglehead (upstem)", "u2triangle");
641 draw_closed_triangle_head (1);
643 draw_staff (-2, 2, 0);
647 fet_beginchar ("Quart trianglehead (downstem)", "d2triangle");
648 draw_closed_triangle_head (-1);
650 draw_staff (-2, 2, 0.5);
654 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
656 % Slash heads are for indicating improvisation. They are
657 % twice as high as normal heads.
659 def draw_slash (expr hwid_hash) =
663 exact_height = staff_space# + stafflinethickness# / 2;
665 set_char_box (0, 2 exact_height / slash_slope + hwid_hash,
666 exact_height, exact_height);
675 pickup pencircle scaled blot_diameter;
680 lft x2 = 2 h / slash_slope;
687 ne = unitvector (z3 - z4);
688 nw_dist = (ne rotated 90) * 0.5 blot_diameter;
691 .. (z1 + nw_dist){ne}
692 -- (z2 + nw_dist){ne}
695 .. (z3 - nw_dist){-ne}
696 -- (z4 - nw_dist){-ne}
700 if hwid_hash > 2 slash_thick#:
703 th = slash_thick - blot_diameter;
708 z6 - z5 = whatever * ne;
709 z8 - z7 = whatever * ne;
711 z5 = z1 + whatever * ne + th * (ne rotated -90);
712 z8 = z4 + whatever * ne + th * (ne rotated 90);
720 labels (range 1 thru 10);
724 fet_beginchar ("Whole slashhead", "s0slash");
725 draw_slash (4 slash_thick# + 0.5 staff_space#);
727 draw_staff (-2, 2, 0);
731 fet_beginchar ("Half slashhead", "s1slash");
732 draw_slash (3.0 slash_thick# + 0.15 staff_space#);
734 draw_staff (-2, 2, 0);
738 fet_beginchar ("Quart slashhead", "s2slash");
739 draw_slash (1.5 slash_thick#);
741 draw_staff (-2, 2, 0);
745 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
747 % `thick' is the distance between the NE/SW parallel lines in the cross
748 % (distance between centres of lines) in multiples of stafflinethickness
750 def draw_cross (expr thick) =
752 save ne_dist, nw_dist, rt_dist, up_dist;
753 save crz_in, crz_out;
756 pair ne_dist, nw_dist, rt_dist, up_dist;
757 path crz_in, crz_out;
759 pen_thick# := 1.2 stafflinethickness#;
760 thickness# := thick * stafflinethickness#;
761 define_pixels (thickness);
762 define_blacker_pixels (pen_thick);
764 pickup pencircle scaled pen_thick;
769 ne = unitvector ((1, (2 h - pen_thick) / (w - pen_thick)));
772 z4 - z5 = whatever * ne;
774 z6 - z3 = whatever * ne;
775 z3 - z4 = whatever * (ne yscaled -1);
777 z4 - z3 = whatever * (ne) + (ne rotated -90) * thickness;
780 x1 = charwd / 2 - .5 pen_thick#;
782 + thick / 2 * stafflinethickness# * (ne rotated -90);
784 % labels (1, 2, 3, 4, 5, 6);
786 nw = unitvector (z3 - z4);
788 up_dist = up * 0.5 pen_thick / cosd (angle (ne));
789 rt_dist = right * 0.5 pen_thick / sind (angle (ne));
790 nw_dist = (ne rotated 90) * 0.5 pen_thick;
791 ne_dist = (nw rotated -90) * 0.5 pen_thick;
797 x4 := hround (x4' + .5 pen_thick) - .5 pen_thick;
798 x5 := hfloor (x5' + xpart rt_dist) - xpart rt_dist;
799 y6 := vfloor (y6' + ypart up_dist) - ypart up_dist;
801 crz_out = (z6 + up_dist)
802 -- (z3 + nw_dist){ne}
804 .. (z3 + ne_dist){-nw}
805 -- (z4 + ne_dist){-nw}
807 .. (z4 - nw_dist){-ne}
809 crz_out := crz_out shifted (0, feta_shift)
810 -- reverse crz_out yscaled -1 shifted (0, -feta_eps);
812 -- reverse crz_out xscaled -1 shifted (-feta_eps, 0)
816 x4 := hround (x4' - xpart rt_dist) + xpart rt_dist;
817 x5 := hceiling (x5' - .5 pen_thick) + .5 pen_thick;
818 y6 := vfloor (y6' - .5 pen_thick) + .5 pen_thick;
820 crz_in = (bot z6){right}
821 .. (z6 - nw_dist){ne}
824 -- (z5 + nw_dist){-ne}
826 crz_in := crz_in shifted (0, feta_shift)
827 -- reverse crz_in yscaled -1 shifted (0, -feta_eps);
829 -- reverse crz_in xscaled -1 shifted (-feta_eps, 0)
834 currentpicture := currentpicture shifted (hround (w / 2), 0);
837 charwy := y1 + feta_shift;
839 z12 = (charwx * hppp, y1 * vppp);
845 fet_beginchar ("Whole Crossed notehead", "s0cross");
848 wid# := black_notehead_width# + 4 stafflinethickness#;
849 hei# := noteheight# + stafflinethickness#;
851 set_char_box (0, wid#, hei# / 2, hei# / 2);
855 remember_pic := currentpicture;
857 draw_staff (-2, 2, 0);
862 fet_beginchar ("Whole Crossed notehead", "s0cross");
865 wid# := black_notehead_width# + 4 stafflinethickness#;
866 hei# := noteheight# + stafflinethickness#;
868 set_char_box (0, wid#, hei# / 2, hei# / 2);
870 currentpicture := remember_pic;
872 draw_staff (-2, 2, 0.5);
877 fet_beginchar ("Half Crossed notehead", "s1cross");
880 wid# := black_notehead_width# + 2 stafflinethickness#;
881 hei# := noteheight# + stafflinethickness# / 2;
883 set_char_box (0, wid#, hei# / 2, hei# / 2);
887 remember_pic := currentpicture;
889 draw_staff (-2, 2, 0);
894 fet_beginchar ("Half Crossed notehead", "s1cross");
897 wid# := black_notehead_width# + 2 stafflinethickness#;
898 hei# := noteheight# + stafflinethickness# / 2;
900 set_char_box (0, wid#, hei# / 2, hei# / 2);
902 currentpicture := remember_pic;
904 draw_staff (-2, 2, 0.5);
909 fet_beginchar ("Crossed notehead", "s2cross");
910 wid# := black_notehead_width#;
912 set_char_box (0, wid#, hei# / 2, hei# / 2);
916 remember_pic := currentpicture;
918 draw_staff (-2, 2, 0);
923 fet_beginchar ("Crossed notehead", "s2cross");
924 wid# := black_notehead_width#;
926 set_char_box (0, wid#, hei# / 2, hei# / 2);
928 currentpicture := remember_pic;
930 draw_staff (-2, 2, 0.5);
935 fet_beginchar ("X-Circled notehead", "s2xcircle");
937 save cthick, cxd, cyd, dy;
939 wid# := black_notehead_width# * sqrt (sqrt2);
940 hei# := noteheight# * sqrt (sqrt2);
942 set_char_box (0, wid#, hei# / 2, hei# / 2);
944 d := d - feta_space_shift;
946 cthick# := (1.2 + 1/4) * stafflinethickness#;
947 define_blacker_pixels (cthick);
950 cyd := h + d - cthick / 2;
954 pickup pencircle scaled cthick;
956 fill fullcircle xscaled (cxd + cthick)
957 yscaled (cyd + cthick)
959 unfill fullcircle xscaled (cxd - cthick)
960 yscaled (cyd - cthick)
963 xpos := .5 cxd / sqrt2;
964 ypos := .5 cyd / sqrt2;
966 pickup penrazor scaled cthick rotated (angle (xpos, ypos) + 90);
967 draw (-xpos + w / 2, -ypos + dy) -- (xpos + w / 2, ypos + dy);
969 pickup penrazor scaled cthick rotated (angle (xpos, -ypos) + 90);
970 draw (-xpos + w / 2, ypos + dy) -- (xpos + w / 2, -ypos + dy);
975 z12 = (charwx * hppp, charwy * vppp);
978 remember_pic := currentpicture;
980 draw_staff (-2, 2, 0);
985 fet_beginchar ("X-Circled notehead", "s2xcircle");
987 save cthick, cxr, cyr;
989 wid# := black_notehead_width# * sqrt (sqrt2);
990 hei# := noteheight# * sqrt (sqrt2);
992 set_char_box (0, wid#, hei# / 2, hei# / 2);
994 currentpicture := remember_pic;
996 draw_staff (-2, 2, 0.5);
1003 % SOLFA SHAPED NOTES
1006 % Note: for whole and half notes, the "fill" curve (p_out) is offset
1007 % from the points that specify the outer geometry, because we need
1008 % to add the rounding. In contrast, the inner curve is not
1009 % offset, because there is no rounding.
1011 % This means that to get a line of thick_factor * pen_thickness,
1012 % we need to offset the inner curve by
1013 % (thick_factor - 0.5) * pen_thickness or by
1014 % (2 * thick_factor - 1) * half_pen_thickness
1016 save solfa_pen_thick;
1017 solfa_pen_thick# = 1.3 stafflinethickness#;
1018 define_blacker_pixels (solfa_pen_thick);
1020 save solfa_pen_radius;
1021 solfa_pen_radius = 0.5 solfa_pen_thick;
1023 save solfa_base_notewidth;
1024 solfa_base_notewidth# := black_notehead_width#;
1026 solfa_whole_width := 1.0;
1027 solfa_half_width := 1.0;
1028 solfa_quarter_width := 1.0;
1033 % Triangle with base parallel to staff lines.
1036 def draw_do_head (expr width_factor, dir, thickness_factor) =
1038 save left_dist, right_dist, bottom_dist;
1040 pair left_dist, right_dist, bottom_dist;
1042 set_char_box (0, width_factor * solfa_base_notewidth#,
1043 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1045 pickup pencircle scaled solfa_pen_thick;
1048 bottom_thick_factor := 2 * thickness_factor - 1;
1049 % no different thickness for left side if we want uniform thickness
1050 left_thick_factor := if thickness_factor = 1 :
1053 0.7 * bottom_thick_factor;
1062 left_dist = (unitvector (z3 - z1) rotated 90) * solfa_pen_radius;
1063 right_dist = (unitvector (z2 - z3) rotated 90) * solfa_pen_radius;
1064 bottom_dist = (0,1) * solfa_pen_radius;
1068 save point_a, point_b, point_c;
1069 pair point_a, point_b, point_c;
1071 pa := (z1 - left_thick_factor * left_dist) --
1072 (z3 - left_thick_factor * left_dist);
1073 pb := (z1 + bottom_thick_factor * bottom_dist) --
1074 (z2 + bottom_thick_factor * bottom_dist);
1075 pc := (z2 - right_dist) -- (z3 - right_dist);
1078 point_a := pa intersectionpoint pb;
1079 point_b := pb intersectionpoint pc;
1080 point_c := pc intersectionpoint pa;
1082 p_in := point_a -- point_b -- point_c -- cycle;
1087 .. (z2 + right_dist){z3 - z2}
1088 -- (z3 + right_dist){z3 - z2}
1090 .. (z3 + left_dist){z1 - z3}
1091 -- (z1 + left_dist){z1 - z3}
1098 charwy := -chardp + 0.5 stafflinethickness#;
1108 fet_beginchar ("Whole dohead", "s0do");
1109 draw_do_head (solfa_whole_width, 1, do_weight);
1115 fet_beginchar ("Half dohead", "d1do");
1116 draw_do_head (solfa_half_width, -1, do_weight);
1122 fet_beginchar ("Half dohead", "u1do");
1123 draw_do_head (solfa_half_width, 1, do_weight);
1129 fet_beginchar ("Quart dohead", "d2do");
1130 draw_do_head (solfa_quarter_width, -1, do_weight);
1135 fet_beginchar ("Quart dohead", "u2do");
1136 draw_do_head (solfa_quarter_width, 1, do_weight);
1142 fet_beginchar ("Whole thin dohead", "s0doThin");
1143 draw_do_head (solfa_whole_width, 1, 1);
1149 fet_beginchar ("Half thin dohead", "d1doThin");
1150 draw_do_head (solfa_half_width, -1, 1);
1156 fet_beginchar ("Half thin dohead", "u1doThin");
1157 draw_do_head (solfa_half_width, 1, 1);
1163 fet_beginchar ("Quart thin dohead", "d2doThin");
1164 draw_do_head (solfa_quarter_width, -1, 1);
1169 fet_beginchar ("Quart thin dohead", "u2doThin");
1170 draw_do_head (solfa_quarter_width, 1, 1);
1177 % re - flat top, curved bottom:
1178 % (0,h/2) {dir -90} .. (w/2,-h/2) .. {dir 90} (w,h/2) -- cycle;
1179 % (broader along the base and with more vertical sides for half and
1182 % Note: According to some shape-note singers, there should be no size
1183 % differences for half and whole notes, contrary to
1184 % the comment above. Consequently, we have made them all the
1187 % stem attachment: h/2
1190 def draw_re_head (expr width_factor, dir, thickness_factor) =
1194 set_char_box (0, width_factor * solfa_base_notewidth#,
1195 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1197 pickup pencircle scaled solfa_pen_thick;
1205 y2 = curve_start [y3, y1];
1214 offset = (2 * thickness_factor - 1);
1216 labels (range 1 thru 5);
1218 p_in := (z1 + solfa_pen_radius * (1, -1 * offset))
1220 .. ((top z3) + (0, offset * solfa_pen_radius))
1222 -- (z5 + solfa_pen_radius * (-1, -1 * offset))
1235 charwy := curve_start [-chardp, charht];
1245 fet_beginchar ("Whole rehead", "s0re");
1246 draw_re_head (solfa_whole_width, 1, re_weight);
1252 fet_beginchar ("Half up rehead", "u1re");
1253 draw_re_head (solfa_half_width, 1, re_weight);
1259 fet_beginchar ("Half down rehead", "d1re");
1260 draw_re_head (solfa_half_width, -1, re_weight);
1266 fet_beginchar ("Quart up rehead", "u2re");
1267 draw_re_head (solfa_quarter_width, 1, re_weight);
1272 fet_beginchar ("Quart down rehead", "d2re");
1273 draw_re_head (solfa_quarter_width, -1, re_weight);
1278 fet_beginchar ("Whole thin rehead", "s0reThin");
1279 draw_re_head (solfa_whole_width, 1, 1);
1285 fet_beginchar ("Half up thin rehead", "u1reThin");
1286 draw_re_head (solfa_half_width, 1, 1);
1292 fet_beginchar ("Half down thin rehead", "d1reThin");
1293 draw_re_head (solfa_half_width, -1, 1);
1299 fet_beginchar ("Quart thin rehead", "u2reThin");
1300 draw_re_head (solfa_quarter_width, 1, 1);
1305 fet_beginchar ("Quart thin rehead", "d2reThin");
1306 draw_re_head (solfa_quarter_width, -1, 1);
1313 %%%% mi head -- diamond shape
1315 % two versions, depending on whether the "strong" lines are on
1316 % the nw & se or the ne & sw
1319 def draw_mi_head (expr width_factor, thickness_factor, mirror) =
1320 save path_out, path_in;
1321 save ne_dist, se_dist, ne, se;
1322 save path_a, path_b, path_c, path_d;
1323 path path_out, path_in;
1324 pair ne_dist, se_dist, ne, se;
1325 path path_a, path_b, path_c, path_d;
1329 set_char_box (0, width_factor * solfa_base_notewidth#,
1330 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1332 pickup pencircle scaled solfa_pen_thick;
1335 offset := 2 * thickness_factor - 1;
1346 % inner sides are parallel to outer sides
1347 z6 - z5 = whatever * (z2 - z1);
1348 z8 - z7 = whatever * (z4 - z3);
1349 z8 - z5 = whatever * (z4 - z1);
1350 z7 - z6 = whatever * (z3 - z2);
1352 ne = unitvector (z4 - z1);
1353 se = unitvector (z2 - z1);
1355 ne_dist = (ne rotated 90) * solfa_pen_radius;
1356 se_dist = (se rotated 90) * solfa_pen_radius;
1358 path_a := (z1 + se_dist) -- (z2 + se_dist);
1359 path_b := (z2 + (ne_dist * offset)) --
1360 (z3 + (ne_dist * offset));
1361 path_c := (z3 - se_dist) -- (z4 - se_dist);
1362 path_d := (z4 - (ne_dist * offset)) --
1363 (z1 - (ne_dist * offset));
1365 z5 = path_a intersectionpoint path_d;
1366 z7 = path_b intersectionpoint path_c;
1368 labels (range 1 thru 8);
1376 path_in := if mirror:
1379 inner_path reflectedabout (z2, z4);
1382 path_out := lft z1 {down}
1383 .. (z1 - se_dist){se}
1384 -- (z2 - se_dist){se}
1386 .. (z2 - ne_dist){ne}
1387 -- (z3 - ne_dist){ne}
1389 .. (z3 + se_dist){-se}
1390 -- (z4 + se_dist){-se}
1392 .. (z4 + ne_dist){-ne}
1393 -- (z1 + ne_dist){-ne}
1397 save mi_weight, mi_width;
1401 fet_beginchar ("Whole mihead", "s0mi");
1402 draw_mi_head (mi_width * solfa_whole_width, mi_weight, false);
1408 fet_beginchar ("Half mihead", "s1mi");
1409 draw_mi_head (mi_width * solfa_quarter_width, mi_weight, false);
1414 fet_beginchar ("Quart mihead", "s2mi");
1415 draw_mi_head (mi_width * solfa_quarter_width, mi_weight, false);
1419 fet_beginchar ("Whole mirror mihead", "s0miMirror");
1420 draw_mi_head (mi_width * solfa_whole_width, mi_weight, true);
1425 fet_beginchar ("Half mirror mihead", "s1miMirror");
1426 draw_mi_head (mi_width * solfa_quarter_width, mi_weight, true);
1431 fet_beginchar ("Quart mirror mihead", "s2miMirror");
1432 draw_mi_head (mi_width * solfa_quarter_width, mi_weight, true);
1438 fet_beginchar ("Whole thin mihead", "s0miThin");
1439 draw_mi_head (mi_width * solfa_whole_width, 1, false);
1445 fet_beginchar ("Half thin mihead", "s1miThin");
1446 draw_mi_head (mi_width * solfa_quarter_width, 1, false);
1452 fet_beginchar ("Quart thin mihead", "s2miThin");
1453 draw_mi_head (mi_width * solfa_quarter_width, 1, false);
1461 % Right triangle, hypotenuse from nw to se corner
1462 % Stem attaches on vertical side in direction of
1466 def draw_fa_head (expr width_factor, thickness_factor) =
1467 set_char_box (0, width_factor * solfa_base_notewidth#,
1468 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1470 save p_down_in, p_down_out, p_up_in, p_up_out, nw_dist, nw;
1471 path p_down_in, p_down_out, p_up_in, p_up_out;
1472 save path_a, path_b, path_c;
1473 path path_a, path_b, path_c;
1477 offset := 2 * thickness_factor - 0.5;
1479 pickup pencircle scaled solfa_pen_thick;
1492 labels (1, 2, 3, 4);
1494 nw = unitvector (z1 - z3);
1495 nw_dist = (nw rotated 90) * solfa_pen_radius;
1497 path_a := (z1 - (0,1) * offset * solfa_pen_radius) --
1498 (z2 - (0,1) * offset * solfa_pen_radius);
1499 path_b := (z2 - (1,0) * solfa_pen_radius) --
1500 (z3 - (1,0) * solfa_pen_radius);
1501 path_c := (z3 - nw_dist) -- (z1 - nw_dist);
1503 p_up_in := (path_a intersectionpoint path_b) --
1504 (path_b intersectionpoint path_c) --
1505 (path_c intersectionpoint path_a) --
1508 p_up_out := lft z1{down}
1509 .. (z1 + nw_dist){-nw}
1510 -- (z3 + nw_dist){-nw}
1518 p_down_in := p_up_in rotated 180 shifted (w, 0);
1519 p_down_out := p_up_out rotated 180 shifted (w, 0);
1528 fet_beginchar ("Whole fa up head", "u0fa");
1529 draw_fa_head (solfa_whole_width, fa_weight);
1535 fet_beginchar ("Whole fa down head", "d0fa");
1536 draw_fa_head (solfa_whole_width, fa_weight);
1542 fet_beginchar ("half fa up head", "u1fa");
1543 draw_fa_head (solfa_half_width, fa_weight);
1549 fet_beginchar ("Half fa down head", "d1fa");
1550 draw_fa_head (solfa_half_width, fa_weight);
1556 fet_beginchar ("Quarter fa up head", "u2fa");
1557 draw_fa_head (solfa_quarter_width, fa_weight);
1562 fet_beginchar ("Quarter fa down head", "d2fa");
1563 draw_fa_head (solfa_quarter_width, fa_weight);
1568 fet_beginchar ("Whole thin fa up head", "u0faThin");
1569 draw_fa_head (solfa_whole_width, 1);
1575 fet_beginchar ("Whole thin fa down head", "d0faThin");
1576 draw_fa_head (solfa_whole_width, 1);
1582 fet_beginchar ("half thin fa up head", "u1faThin");
1583 draw_fa_head (solfa_half_width, 1);
1589 fet_beginchar ("Half thin fa down head", "d1faThin");
1590 draw_fa_head (solfa_half_width, 1);
1596 fet_beginchar ("Quarter thin fa up head", "u2faThin");
1597 draw_fa_head (solfa_quarter_width, 1);
1602 fet_beginchar ("Quarter thin fa down head", "d2faThin");
1603 draw_fa_head (solfa_quarter_width, 1);
1611 %% Note -- sol head is the same shape as a standard music
1612 %% head, and doesn't vary from style to style.
1613 %% However, width is constant with duration, so we
1614 %% can't just use the standard note font.
1616 def draw_sol_head (expr filled) =
1617 draw_outside_ellipse (1.53 - puff_up_factor / 3.0, 34, 0.66, 0.17);
1619 undraw_inside_ellipse (3.25, 33, 0.81, 2.5 stafflinethickness#);
1621 draw_staff (-2, 2, 0);
1624 fet_beginchar ("Whole solhead", "s0sol");
1625 draw_sol_head ( false);
1629 fet_beginchar ("Half solhead", "s1sol");
1630 draw_sol_head ( false);
1634 fet_beginchar ("Quart solhead", "s2sol");
1635 draw_sol_head ( true);
1645 def draw_la_head (expr width_factor, thickness_factor) =
1646 set_char_box (0, width_factor * solfa_base_notewidth#,
1647 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1651 pickup pencircle scaled solfa_pen_thick;
1654 offset := 2 * thickness_factor - 1;
1667 labels (range 1 thru 4);
1669 p_in := (z1 + solfa_pen_radius * (1, -offset))
1670 -- (z2 + solfa_pen_radius * (-1, -offset))
1671 -- (z3 + solfa_pen_radius * (-1, offset))
1672 -- (z4 + solfa_pen_radius * (1, offset))
1689 fet_beginchar ("Whole lahead", "s0la");
1690 draw_la_head (solfa_whole_width, la_weight);
1696 fet_beginchar ("Half lahead", "s1la");
1697 draw_la_head (solfa_half_width, la_weight);
1703 fet_beginchar ("Quart lahead", "s2la");
1704 draw_la_head (solfa_quarter_width, la_weight);
1709 fet_beginchar ("Whole thin lahead", "s0laThin");
1710 draw_la_head (solfa_whole_width, 1);
1716 fet_beginchar ("Half thin lahead", "s1laThin");
1717 draw_la_head (solfa_half_width, 1);
1723 fet_beginchar ("Quart lahead", "s2laThin");
1724 draw_la_head (solfa_quarter_width, 1);
1732 % "Snow-cone", V with rounded top.
1735 def draw_ti_head (expr width_factor, dir, thickness_factor) =
1736 set_char_box (0, width_factor * solfa_base_notewidth#,
1737 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1738 save p_in, p_out, p_top, p_top_in;
1739 path p_in, p_out, p_top, p_top_in;
1744 offset := 2 * thickness_factor - 1;
1746 pickup pencircle scaled solfa_pen_thick;
1751 y2 = cone_height [y1, y3];
1757 y5 = y1 + offset * solfa_pen_radius;
1759 labels (range 1 thru 4);
1761 save nw_dist, sw_dist, nw, sw;
1762 pair nw_dist, sw_dist, nw, sw;
1764 nw = unitvector (z2 - z1);
1765 sw = unitvector (z1 - z4);
1767 nw_dist = (nw rotated 90) * solfa_pen_radius;
1768 sw_dist = (sw rotated 90) * solfa_pen_radius;
1770 p_top := (z2 + nw * solfa_pen_radius)
1772 .. (z4 - sw * solfa_pen_radius);
1774 p_top_in := (z2 - nw * offset * solfa_pen_radius)
1775 .. (z3 - (0,1) * solfa_pen_radius) {right}
1776 .. (z4 + sw * offset * solfa_pen_radius);
1778 save path_a, path_b;
1779 path path_a, path_b;
1783 z6 = path_a intersectionpoint p_top_in;
1784 z7 = path_b intersectionpoint p_top_in;
1786 p_in := z5 -- z6 .. bot z3 .. z7 -- cycle;
1792 .. (z2 + nw * solfa_pen_radius){direction 0 of p_top}
1794 & {direction infinity of p_top}(z4 -sw * solfa_pen_radius)
1801 charwy := cone_height [-chardp, charht];
1810 fet_beginchar ("Whole up tihead", "s0ti");
1811 draw_ti_head (solfa_whole_width, 1, ti_weight);
1817 fet_beginchar ("Half up tihead", "u1ti");
1818 draw_ti_head (solfa_half_width, 1, ti_weight);
1824 fet_beginchar ("Half down tihead", "d1ti");
1825 draw_ti_head (solfa_half_width, -1, ti_weight);
1831 fet_beginchar ("Quart up tihead", "u2ti");
1832 draw_ti_head (solfa_quarter_width, 1, ti_weight);
1837 fet_beginchar ("Quart down tihead", "d2ti");
1838 draw_ti_head (solfa_quarter_width, -1, ti_weight);
1843 fet_beginchar ("Whole thin up tihead", "s0tiThin");
1844 draw_ti_head (solfa_whole_width, 1, 1);
1850 fet_beginchar ("Half thin up tihead", "u1tiThin");
1851 draw_ti_head (solfa_half_width, 1, 1);
1857 fet_beginchar ("Half thin down tihead", "d1tiThin");
1858 draw_ti_head (solfa_half_width, -1, 1);
1864 fet_beginchar ("Quart thin up tihead", "u2tiThin");
1865 draw_ti_head (solfa_quarter_width, 1, 1);
1870 fet_beginchar ("Quart thin down tihead", "d2tiThin");
1871 draw_ti_head (solfa_quarter_width, -1, 1);
1876 %%%%%% Funk shape note heads
1878 % Funk heads are narrower than Aiken and Sacred Harp,
1879 % so we need a new width
1881 funk_notehead_width := 0.75;
1884 % Parabolic on one side, vertical line on other
1885 % Has up and down shapes for *all* notes
1888 def draw_Funk_do_head (expr width_factor, thickness_factor) =
1889 set_char_box (0, width_factor * solfa_base_notewidth#,
1890 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1892 pickup pencircle scaled solfa_pen_thick;
1894 offset := 2 * thickness_factor - 1;
1905 x4 = x1 - solfa_pen_radius;
1906 y4 = y1 + offset * solfa_pen_radius;
1909 x5 = x2 + solfa_pen_radius;
1912 y6 = y3 - offset * solfa_pen_radius;
1914 save p_up_in, p_up_out, p_down_in, p_down_out;
1915 path p_up_in, p_up_out, p_down_in, p_down_out;
1917 p_down_in := z4{left} .. z5{up} .. z6{right} -- cycle;
1919 p_down_out := bot z1{left}
1926 p_up_in := p_down_in rotated 180 shifted (w,0);
1927 p_up_out := p_down_out rotated 180 shifted (w,0);
1931 save funk_do_weight;
1932 funk_do_weight := 1.7;
1934 fet_beginchar ("Whole up Funk dohead", "u0doFunk");
1935 draw_Funk_do_head (funk_notehead_width, funk_do_weight);
1940 fet_beginchar ("Whole down Funk dohead", "d0doFunk");
1941 draw_Funk_do_head (funk_notehead_width, funk_do_weight);
1946 fet_beginchar ("Half up Funk dohead", "u1doFunk");
1947 draw_Funk_do_head (funk_notehead_width, funk_do_weight);
1952 fet_beginchar ("Half down Funk dohead", "d1doFunk");
1953 draw_Funk_do_head (funk_notehead_width, funk_do_weight);
1958 fet_beginchar ("Quarter up Funk dohead", "u2doFunk");
1959 draw_Funk_do_head (funk_notehead_width, funk_do_weight);
1963 fet_beginchar ("Quarter down Funk dohead", "d2doFunk");
1964 draw_Funk_do_head (funk_notehead_width, funk_do_weight);
1970 % Has up and down shapes for *all* notes
1971 def draw_Funk_re_head (expr width_factor, thickness_factor) =
1972 set_char_box (0, width_factor * solfa_base_notewidth#,
1973 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
1975 pickup pencircle scaled solfa_pen_thick;
1977 offset := 2 * thickness_factor - 1;
1988 x3 := curve_in [x1, x2];
1996 save ne, se, ne_perp, se_perp;
1997 pair ne, se, ne_perp, se_perp;
1999 ne := unitvector (z2 - z1);
2000 se := unitvector (z4 - z1);
2001 ne_perp := ne rotated 90;
2002 se_perp := se rotated 90;
2004 save path_a, path_b, path_c, path_d;
2005 path path_a, path_b, path_c, path_d;
2006 save arrow_a_perp, arrow_b_perp;
2007 pair arrow_a_perp, arrow_b_perp;
2010 path_d := z2 .. z3{down} .. z4;
2011 arrow_a_perp = unitvector (direction 0 of path_d rotated 90) * solfa_pen_radius;
2012 arrow_b_perp = unitvector (direction 1 of path_d rotated 90) * solfa_pen_radius;
2014 path_b := (z1 + se_perp * solfa_pen_radius)
2015 -- z4 + se_perp * offset * solfa_pen_radius;
2016 path_a := (z1 - ne_perp * solfa_pen_radius)
2017 -- z2 - ne_perp * offset * solfa_pen_radius;
2018 path_c := z2 - arrow_a_perp
2020 .. z4 - arrow_b_perp;
2022 z5 = path_a intersectionpoint path_b;
2023 z7 = path_a intersectionpoint path_c;
2024 z8 = path_b intersectionpoint path_c;
2026 save p_up_in, p_down_in, p_up_out, p_down_out;
2027 path p_up_in, p_down_in, p_up_out, p_down_out;
2029 p_down_in := z5 -- z7 .. z6{down} .. z8 -- cycle;
2031 p_down_out := lft z1{up}
2032 .. (z1 + ne_perp * solfa_pen_radius){ne}
2033 -- (z2 + ne_perp * solfa_pen_radius){ne}
2036 .. (z2 + arrow_a_perp)
2038 .. (z4 + arrow_b_perp)
2041 .. z4 - se_perp * solfa_pen_radius
2042 -- z1 - se_perp * solfa_pen_radius
2045 p_up_in := p_down_in rotated 180 shifted (w,0);
2046 p_up_out := p_down_out rotated 180 shifted (w,0);
2050 save funk_re_weight;
2051 funk_re_weight = 1.7;
2053 fet_beginchar ("Whole up Funk rehead", "u0reFunk");
2054 draw_Funk_re_head (funk_notehead_width, funk_re_weight);
2059 fet_beginchar ("Whole down Funk rehead", "d0reFunk");
2060 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);
2071 fet_beginchar ("Half down Funk rehead", "d1reFunk");
2072 draw_Funk_re_head (funk_notehead_width, funk_re_weight);
2077 fet_beginchar ("Quarter up Funk rehead", "u2reFunk");
2078 draw_Funk_re_head (funk_notehead_width, funk_re_weight);
2082 fet_beginchar ("Quarter down Funk rehead", "d2reFunk");
2083 draw_Funk_re_head (funk_notehead_width, funk_re_weight);
2090 % Has up and down shapes for all hollow notes
2092 save funk_mi_width, funk_mi_weight;
2093 funk_mi_width := 1.2;
2094 funk_mi_weight := 1.9;
2096 fet_beginchar ("Whole up Funk mihead", "u0miFunk");
2097 draw_mi_head (funk_mi_width * funk_notehead_width, funk_mi_weight, false);
2102 fet_beginchar ("Whole down Funk mihead", "d0miFunk");
2103 draw_mi_head (funk_mi_width * funk_notehead_width, funk_mi_weight, true);
2108 fet_beginchar ("Half up Funk mihead", "u1miFunk");
2109 draw_mi_head (funk_mi_width * funk_notehead_width, funk_mi_weight, false);
2114 fet_beginchar ("Half down Funk mihead", "d1miFunk");
2115 draw_mi_head (funk_mi_width * funk_notehead_width, funk_mi_weight, true);
2120 fet_beginchar ("Quarter Funk mihead", "s2miFunk");
2121 draw_mi_head (funk_mi_width * funk_notehead_width, funk_mi_weight, false);
2129 % Does it rotate for whole notes?
2130 % Same as other shape note systems
2131 % Need special notes because of special width
2133 save funk_fa_weight;
2134 funk_fa_weight := 1.9;
2136 fet_beginchar ("Whole up Funk fahead", "u0faFunk");
2137 draw_fa_head (funk_notehead_width, funk_fa_weight);
2142 fet_beginchar ("Whole down Funk fahead", "d0faFunk");
2143 draw_fa_head (funk_notehead_width, funk_fa_weight);
2148 fet_beginchar ("Half up Funk fahead", "u1faFunk");
2149 draw_fa_head (funk_notehead_width, funk_fa_weight);
2154 fet_beginchar ("Half down Funk fahead", "d1faFunk");
2155 draw_fa_head (funk_notehead_width, funk_fa_weight);
2160 fet_beginchar ("Quarter up Funk fahead", "u2faFunk");
2161 draw_fa_head (funk_notehead_width, funk_fa_weight);
2165 fet_beginchar ("Quarter down Funk fahead", "d2faFunk");
2166 draw_fa_head (funk_notehead_width, funk_fa_weight);
2173 %%%%%% Funk sol head is the same as the others
2174 % Need special character because of skinnier head
2177 def draw_Funk_sol_head (expr filled) =
2180 noteheight# := solfa_noteheight#;
2181 draw_outside_ellipse (1.2, 34, 0.71, 0.);
2183 undraw_inside_ellipse (1.9, 33, 0.74, 5.5 stafflinethickness#);
2185 draw_staff (-2, 2, 0);
2189 fet_beginchar ("Whole Funk solhead", "s0solFunk");
2190 draw_Funk_sol_head ( false);
2194 fet_beginchar ("Half Funk solhead", "s1solFunk");
2195 draw_Funk_sol_head ( false);
2199 fet_beginchar ("Quarter Funk solhead", "s2solFunk");
2200 draw_Funk_sol_head ( true);
2208 % Same as for other shape notes
2209 % Smaller width requires special characters
2211 save funk_la_weight;
2212 funk_la_weight := 1.9;
2214 fet_beginchar ("Whole Funk lahead", "s0laFunk");
2215 draw_la_head (funk_notehead_width, funk_notehead_width);
2221 fet_beginchar ("Half Funk lahead", "s1laFunk");
2222 draw_la_head (funk_notehead_width, funk_notehead_width);
2228 fet_beginchar ("Quart Funk lahead", "s2laFunk");
2229 draw_la_head (funk_notehead_width, funk_notehead_width);
2236 % "Sideways snow cone"
2237 % Rotates for all notes
2240 def draw_Funk_ti_head (expr width_factor, thickness_factor) =
2241 set_char_box (0, width_factor * solfa_base_notewidth#,
2242 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
2247 offset := 2 * thickness_factor - 1;
2249 pickup pencircle scaled solfa_pen_thick;
2254 x2 = cone_width [x1, x3];
2263 save nw_dist, sw_dist, ne, se;
2264 pair nw_dist, sw_dist, ne, se;
2266 ne = unitvector (z2 - z1);
2267 se = unitvector (z4 - z1);
2269 nw_dist = (ne rotated 90) * solfa_pen_radius ;
2270 sw_dist = (se rotated -90) * solfa_pen_radius;
2272 save path_a, path_b;
2273 path path_a, path_b;
2274 path_a := z1 - nw_dist -- z2 - offset * nw_dist;
2275 path_b := z1 - sw_dist -- z4 - offset * sw_dist;
2277 save path_right, path_right_in;
2278 path path_right, path_right_in;
2279 path_right := (z2 + ne * solfa_pen_radius)
2281 .. (z4 + se * solfa_pen_radius);
2283 path_right_in := (z2 - ne * solfa_pen_radius)
2285 .. (z4 - se * solfa_pen_radius);
2287 z5 = path_a intersectionpoint path_b;
2288 z6 = path_a intersectionpoint path_right_in;
2289 z7 = path_b intersectionpoint path_right_in;
2291 save p_up_in, p_down_in, p_up_out, p_down_out;
2292 path p_up_in, p_down_in, p_up_out, p_down_out;
2294 p_down_in := z5 -- z6 .. lft z3 .. z7 -- cycle;
2296 p_down_out := lft z1
2300 .. (z2 + ne * solfa_pen_radius){direction 0 of path_right}
2302 & {direction infinity of path_right}(z4 + se * solfa_pen_radius)
2308 p_up_in := p_down_in rotated 180 shifted (w,0);
2309 p_up_out := p_down_out rotated 180 shifted (w,0);
2312 save funk_ti_weight;
2313 funk_ti_weight := 1.6;
2315 fet_beginchar ("Whole up Funk tihead", "u0tiFunk");
2316 draw_Funk_ti_head (funk_notehead_width, funk_ti_weight);
2321 fet_beginchar ("Whole down Funk tihead", "d0tiFunk");
2322 draw_Funk_ti_head (funk_notehead_width, funk_ti_weight);
2327 fet_beginchar ("Half up Funk tihead", "u1tiFunk");
2328 draw_Funk_ti_head (funk_notehead_width, funk_ti_weight);
2333 fet_beginchar ("Half down Funk tihead", "d1tiFunk");
2334 draw_Funk_ti_head (funk_notehead_width, funk_ti_weight);
2339 fet_beginchar ("Quarter up Funk tihead", "u2tiFunk");
2340 draw_Funk_ti_head (funk_notehead_width, funk_ti_weight);
2344 fet_beginchar ("Quarter down Funk tihead", "d2tiFunk");
2345 draw_Funk_ti_head (funk_notehead_width, funk_ti_weight);
2351 %%%%%% Walker shape note heads
2353 % Walker heads are narrow like Funk heads, so use
2354 % funk_notehead_width
2357 %%%%%% Walker do head
2359 % Trapezoid, with largest side on stem side
2362 def draw_Walker_do_head (expr width_factor, dir, thickness_factor) =
2363 set_char_box (0, width_factor * solfa_base_notewidth#,
2364 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
2366 pickup pencircle scaled solfa_pen_thick;
2369 offset := 2 * thickness_factor - 1;
2371 % adjust width so stem can be centered
2372 if .5w <> good.x .5w: change_width; fi
2376 scaling# = charwd / w;
2381 x1 = inset [x4, x3];
2384 x2 = inset [x3, x4];
2393 labels (range 1 thru 4);
2395 save left_dir, left_perp, right_dir, right_perp;
2396 pair left_dir, left_perp, right_dir, right_perp;
2398 left_dir = unitvector(z1 - z4);
2399 left_perp = (left_dir rotated 90) * solfa_pen_radius;
2400 right_dir = unitvector(z3 - z2);
2401 right_perp = (right_dir rotated 90) * solfa_pen_radius;
2403 save path_a, path_b, path_c, path_d;
2404 path path_a, path_b, path_c, path_d;
2406 path_a := (z4 - left_perp) -- (z1 - left_perp);
2407 path_b := (z1 - (0, offset*solfa_pen_radius))
2408 -- (z2 - (0, offset*solfa_pen_radius));
2409 path_c := (z2 - right_perp) -- (z3 - right_perp);
2410 path_d := (z3 + (0, offset*solfa_pen_radius))
2411 -- (z4 + (0, offset*solfa_pen_radius));
2416 p_in := (path_a intersectionpoint path_b)
2417 -- (path_b intersectionpoint path_c)
2418 -- (path_c intersectionpoint path_d)
2419 -- (path_d intersectionpoint path_a)
2422 p_out := top z1{right}
2424 .. z2 + right_perp {right_dir}
2425 -- z3 + right_perp {right_dir}
2428 .. z4 + left_perp {left_dir}
2429 .. z1 + left_perp {left_dir}
2432 charwx := scaling# * (w/2 + solfa_pen_radius);
2433 charwy := scaling# * y2 ;
2436 p_in := p_in rotated 180 shifted (w,0);
2437 p_out := p_out rotated 180 shifted (w,0);
2442 save walker_do_weight;
2443 walker_do_weight := 1.5;
2445 fet_beginchar ("Whole Walker dohead", "s0doWalker");
2446 draw_Walker_do_head (funk_notehead_width, 0, walker_do_weight);
2451 fet_beginchar ("Half up Walker dohead", "u1doWalker");
2452 draw_Walker_do_head (funk_notehead_width, 1, walker_do_weight);
2457 fet_beginchar ("Half down Walker dohead", "d1doWalker");
2458 draw_Walker_do_head (funk_notehead_width, 0, walker_do_weight);
2463 fet_beginchar ("Quarter up Walker dohead", "u2doWalker");
2464 draw_Walker_do_head (funk_notehead_width, 1, walker_do_weight);
2468 fet_beginchar ("Quarter down Walker dohead", "d2doWalker");
2469 draw_Walker_do_head (funk_notehead_width, 0, walker_do_weight);
2476 %%%%%% Walker re head
2477 % Parabolic on one side, shallow parabola on other
2478 % Has up and down shapes for *all* notes
2481 def draw_Walker_re_head (expr width_factor, thickness_factor) =
2482 set_char_box (0, width_factor * solfa_base_notewidth#,
2483 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
2485 pickup pencircle scaled solfa_pen_thick;
2487 offset := 2 * thickness_factor - 1;
2490 dish_factor := 0.20;
2501 x4 = dish_factor [x1, x2];
2505 y5 = y1 + offset * solfa_pen_radius;
2508 x6 = x2 + solfa_pen_radius;
2511 y7 = y3 - offset * solfa_pen_radius;
2514 x8 = x4 - solfa_pen_radius;
2516 save path_a, path_d;
2517 path path_a, path_d;
2519 save p_a_start_dir, p_a_end_dir, p_a_start_perp, p_a_end_perp;
2520 pair p_a_start_dir, p_a_end_dir, p_a_start_perp, p_a_end_perp;
2522 path_a := z3 .. z4{down} .. z1;
2524 p_a_start_dir := unitvector(direction 0 of path_a);
2525 p_a_end_dir := unitvector(direction infinity of path_a);
2526 p_a_start_perp := (p_a_start_dir rotated 90) * solfa_pen_radius;
2527 p_a_end_perp := (p_a_end_dir rotated 90) * solfa_pen_radius;
2529 path_d := (z3 - p_a_start_perp){p_a_start_dir}
2531 ..(z1 - p_a_end_perp){p_a_end_dir};
2533 save path_b, path_c;
2534 path path_b, path_c;
2536 path_b := z5 {left} .. z6{up};
2537 path_c := z7 {left} .. z6{down};
2540 z9 = path_d intersectionpoint path_b;
2541 z10 = path_d intersectionpoint path_c;
2543 labels (range 1 thru 4);
2545 save p_in_dir_b, p_in_dir_c;
2546 pair p_in_dir_b, p_in_dir_c;
2548 p_in_dir_b := unitvector (direction 0.4 of path_b);
2549 p_in_dir_c := unitvector (direction 0.4 of path_c);
2551 save p_up_in, p_up_out, p_down_in, p_down_out;
2552 path p_up_in, p_up_out, p_down_in, p_down_out;
2554 p_down_in := z6{up} .. tension 1 and 1.5
2555 .. {- p_in_dir_c} z10 {p_a_start_dir}
2557 .. {p_a_end_dir} z9 {p_in_dir_b} .. tension 1.5 and 1
2560 p_down_out := lft z2{up}
2563 .. (z3 + p_a_start_perp){p_a_start_dir}
2565 .. (z1 + p_a_end_perp) {p_a_end_dir}
2570 p_up_in := p_down_in rotated 180 shifted (w,0);
2571 p_up_out := p_down_out rotated 180 shifted (w,0);
2574 save walker_re_weight;
2575 walker_re_weight := 1.5;
2577 fet_beginchar ("Whole Walker rehead", "s0reWalker");
2578 draw_Walker_re_head (funk_notehead_width, walker_re_weight);
2583 fet_beginchar ("Half up Walker rehead", "u1reWalker");
2584 draw_Walker_re_head (funk_notehead_width, walker_re_weight);
2589 fet_beginchar ("Half down Walker rehead", "d1reWalker");
2590 draw_Walker_re_head (funk_notehead_width, walker_re_weight);
2595 fet_beginchar ("Quarter up Walker rehead", "u2reWalker");
2596 draw_Walker_re_head (funk_notehead_width, walker_re_weight);
2600 fet_beginchar ("Quarter down Walker rehead", "d2reWalker");
2601 draw_Walker_re_head (funk_notehead_width, walker_re_weight);
2606 %%%%%% Walker mi head
2608 % Symmetric for all hollow notes
2610 save walker_mi_width, walker_mi_weight;
2611 walker_mi_width := 1.2;
2612 walker_mi_weight := 1.5;
2614 fet_beginchar ("Whole Walker mihead", "s0miWalker");
2615 draw_mi_head (walker_mi_width * funk_notehead_width, walker_mi_weight, true);
2620 fet_beginchar ("Half Walker mihead", "s1miWalker");
2621 draw_mi_head (walker_mi_width * funk_notehead_width, walker_mi_weight, true);
2626 fet_beginchar ("Quarter Walker mihead", "s2miWalker");
2627 draw_mi_head (walker_mi_width * funk_notehead_width, walker_mi_weight, true);
2635 % Does not rotate for whole notes
2636 % Whole rotation is different from Funk, so special notes
2637 %%%%%% Funk sol head is the same as the others
2638 % Need special character because of skinnier head
2640 save walker_fa_weight;
2641 walker_fa_weight := 1.5;
2643 fet_beginchar ("Whole Walker fahead", "s0faWalker");
2644 draw_fa_head (funk_notehead_width, walker_fa_weight);
2649 fet_beginchar ("Half up Walker fahead", "u1faWalker");
2650 draw_fa_head (funk_notehead_width, walker_fa_weight);
2655 fet_beginchar ("Half down Walker fahead", "d1faWalker");
2656 draw_fa_head (funk_notehead_width, walker_fa_weight);
2661 fet_beginchar ("Quarter up Walker fahead", "u2faWalker");
2662 draw_fa_head (funk_notehead_width, walker_fa_weight);
2666 fet_beginchar ("Quarter down Walker fahead", "d2faWalker");
2667 draw_fa_head (funk_notehead_width, walker_fa_weight);
2674 % Same as Funk, no special notes
2679 %%%%%% Walker la head
2681 % Lighter weight requires separate notes
2683 save walker_la_weight;
2684 walker_la_weight := 1.5;
2686 fet_beginchar ("Whole Walker lahead", "s0laWalker");
2687 draw_la_head (funk_notehead_width, walker_la_weight);
2693 fet_beginchar ("Half Funk lahead", "s1laWalker");
2694 draw_la_head (funk_notehead_width, walker_la_weight);
2700 fet_beginchar ("Quart Funk lahead", "s2laWalker");
2701 draw_la_head (funk_notehead_width, walker_la_weight);
2707 %%%%%% Walker ti head
2708 % Triangular arrowhead
2709 % Rotates for all but whole notes
2712 def draw_Walker_ti_head (expr width_factor, thickness_factor) =
2713 set_char_box (0, width_factor * solfa_base_notewidth#,
2714 0.5 solfa_noteheight#, 0.5 solfa_noteheight#);
2717 offset := 2 * thickness_factor - 1;
2719 pickup pencircle scaled solfa_pen_thick;
2731 labels (range 1 thru 4);
2733 save nw_dist, sw_dist, ne, se;
2734 pair nw_dist, sw_dist, ne, se;
2736 ne = unitvector (z2 - z1);
2737 se = unitvector (z3 - z1);
2739 nw_dist = (ne rotated 90) * solfa_pen_radius ;
2740 sw_dist = (se rotated -90) * solfa_pen_radius;
2743 save path_a, path_b, path_c;
2744 path path_a, path_b, path_c;
2745 path_a := z2 - nw_dist * offset -- z1 - nw_dist * offset;
2746 path_b := z3 - sw_dist * offset -- z1 - sw_dist * offset;
2747 path_c := z2 + left * solfa_pen_radius -- z3 + left * solfa_pen_radius;
2749 z4 = path_a intersectionpoint path_b;
2750 z5 = path_a intersectionpoint path_c;
2751 z6 = path_b intersectionpoint path_c;
2753 save p_up_in, p_down_in, p_up_out, p_down_out;
2754 path p_up_in, p_down_in, p_up_out, p_down_out;
2756 p_down_in := z4 -- z5 -- z6 -- cycle;
2758 p_down_out := lft z1{up}
2759 .. (z1 + nw_dist){ne}
2760 -- (z2 + nw_dist){ne}
2765 .. (z3 + sw_dist){- se}
2766 .. (z1 + sw_dist){- se}
2769 p_up_in := p_down_in rotated 180 shifted (w,0);
2770 p_up_out := p_down_out rotated 180 shifted (w,0);
2773 save walker_ti_weight;
2774 walker_ti_weight := 1.4;
2776 fet_beginchar ("Whole Walker tihead", "s0tiWalker");
2777 draw_Walker_ti_head (funk_notehead_width, walker_ti_weight);
2782 fet_beginchar ("Half up Walker tihead", "u1tiWalker");
2783 draw_Walker_ti_head (funk_notehead_width, walker_ti_weight);
2788 fet_beginchar ("Half down Walker tihead", "d1tiWalker");
2789 draw_Walker_ti_head (funk_notehead_width, walker_ti_weight);
2794 fet_beginchar ("Quarter up Walker tihead", "u2tiWalker");
2795 draw_Walker_ti_head (funk_notehead_width, walker_ti_weight);
2799 fet_beginchar ("Quarter down Walker tihead", "d2tiWalker");
2800 draw_Walker_ti_head (funk_notehead_width, walker_ti_weight);
2805 fet_endgroup ("noteheads");
2810 % we derive black_notehead_width# from the quarter head,
2811 % so we have to define black_notehead_width (pixel qty)
2812 % after the black_notehead_width# itself.
2814 % Let's keep it outside the group as well.
2817 define_pixels (black_notehead_width);