1 % -*- Fundamental -*- (emacs-20 mf mode mucks
2 % feta-schrift.mf -- implement scripts
4 % source file of the Feta (defintively not an abbreviation for Font-En-Tja)
7 % (c) 1997--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
8 % Jan Nieuwenhuizen <janneke@gnu.org>
12 fet_begingroup ("scripts");
15 save alpha, radius, crook_thinness, crook_fatness, dot_size;
19 % [Wanske] and some Baerenreiter editions
20 % suggest about 80 degrees instead of a half-circle
23 radius# = 1.25 staff_space#;
24 crook_thinness# = 1.5 linethickness#;
25 crook_fatness# = 0.25 staff_space# + 1.5 linethickness#;
27 radius# + crook_fatness# / 2 = h#;
28 radius# + crook_thinness# / 2 = w#;
30 set_char_box (w#, w#, crook_thinness# / 2, h#);
32 define_pixels (radius, crook_thinness, crook_fatness);
34 dot_size# = 8/6 crook_fatness#;
35 define_whole_blacker_pixels (dot_size);
37 penpos1 (crook_thinness, 0);
38 penpos2 (crook_fatness, -90);
43 .. z1l{dir (-alpha - 90)}
44 .. {dir (90 - alpha)}z1r
47 -- reverse pat xscaled -1 shifted (-feta_eps, 0)
51 pickup pencircle scaled dot_size;
53 bot y4 = vround (-crook_thinness / 2);
58 fet_beginchar ("fermata up", "ufermata");
64 fet_beginchar ("fermata down", "dfermata");
70 def draw_short_fermata =
71 save fat_factor, thinness, dot_size;
72 save left_dist, right_dist, se, ne;
73 pair left_dist, right_dist, se, ne;
75 set_char_box (staff_space#, staff_space#, 0, 2.2 staff_space#);
77 dot_size# = 0.266 staff_space# + 2.666 linethickness#;
78 define_whole_blacker_pixels (dot_size);
81 thinness = 1.5 linethickness;
83 pickup pencircle scaled thinness;
92 z1 - z4 = whatever * (charwd, -charht);
93 z4 = fat_factor [z3, z5];
95 ne = unitvector (z3 - z5);
96 se = unitvector (z2 - z3);
98 left_dist = (ne rotated 90) * 0.5 thinness;
99 right_dist = (se rotated 90) * 0.5 thinness;
102 .. (z5 - left_dist){ne}
103 -- (((z5 - left_dist) -- (z3 - left_dist)) intersectionpoint
104 ((z1 - right_dist) -- (z4 - right_dist)))
105 -- (z1 - right_dist){se}
108 .. (z2 + right_dist){-se}
109 -- (z3 + right_dist){-se}
111 .. (z3 + left_dist){-ne}
112 -- (z5 + left_dist){-ne}
115 pickup pencircle scaled dot_size;
124 fet_beginchar ("short fermata up", "ushortfermata");
126 labels (1, 2, 3, 4, 5, 6);
130 fet_beginchar ("short fermata down", "dshortfermata");
136 def draw_long_fermata =
137 save stemthick, beamheight, dot_size, wd;
141 wd# = 2.5 staff_space#;
142 stemthick = hround (1.5 linethickness);
143 beamheight = 0.3 staff_space + linethickness;
144 dot_size# = 0.266 staff_space# + 2.666 * linethickness#;
146 define_whole_blacker_pixels (dot_size);
148 set_char_box (wd# / 2, wd# / 2, 0, 3/2 staff_space#);
150 pickup pencircle scaled blot_diameter;
158 pickup pencircle scaled stemthick;
171 -- reverse pat xscaled -1 shifted (-feta_eps, 0)
176 pickup pencircle scaled dot_size;
185 fet_beginchar ("long fermata up", "ulongfermata");
191 fet_beginchar ("long fermata down", "dlongfermata");
197 def draw_very_long_fermata =
198 save ibeamheight, obeamheight;
199 save ihwd, ohwd, iht, oht; % inner/outer half_width/height
200 save stemthick, dot_size;
204 ihwd# = 1.0 staff_space#;
205 ohwd# = 1.5 staff_space#;
206 iht# = 0.9 staff_space#;
207 oht# = 1.6 staff_space#;
208 define_pixels (ihwd, ohwd, iht, oht)
210 stemthick = hround (1.5 linethickness);
211 ibeamheight# = 0.3 staff_space#;
212 obeamheight# = 0.5 staff_space#;
213 define_pixels (ibeamheight, obeamheight);
215 dot_size# = (iht# - ibeamheight#) * 8/10;
216 define_whole_blacker_pixels (dot_size);
218 set_char_box (ohwd#, ohwd#, 0, oht#);
220 pickup pencircle scaled blot_diameter;
229 ipat := top z11{left}
232 pickup pencircle scaled stemthick;
234 x2 = -ohwd + stemthick;
235 y2 = oht - obeamheight;
238 x12 = -ihwd + stemthick;
239 y12 = iht - ibeamheight;
249 -- reverse opat xscaled -1 shifted (-feta_eps, 0)
257 -- reverse ipat xscaled -1 shifted (-feta_eps, 0)
263 pickup pencircle scaled dot_size;
272 fet_beginchar ("very long fermata up", "uverylongfermata");
273 draw_very_long_fermata;
274 labels (1, 2, 3, 11, 12, 13, 4);
278 fet_beginchar ("very long fermata down", "dverylongfermata");
279 draw_very_long_fermata;
285 % Thumbs are used in cello music.
286 % TODO : thumbs should look like the finger-font and should be placed in
287 % the same way in the score.
290 fet_beginchar ("Thumb", "thumb");
291 save thin, height, width, thick, depth;
292 height# = 5/4 width#;
293 height# = staff_space#;
294 depth# = 1.6 (height# / 2);
296 set_char_box (width# / 2, width# / 2, depth#, height# / 2);
298 define_pixels (height, width);
300 thin = .6 linethickness + 0.06 staff_space;
301 2 thick + 0.5 (height - 2 thin) = width;
305 penpos3 (thick, 180);
312 penlabels (1, 2, 3, 4);
321 y5 = -d + brush_thick / 2;
322 brush_thick = 0.9 thick;
327 draw_brush (z4r, 1.4 thin, z5, brush_thick);
332 % `\accent' is TeX reserved.
335 def draw_accent (expr bottom_left, top_right, thickness, diminish) =
337 thinning_start = 0.4;
338 pickup pencircle scaled thickness;
340 lft x1 = xpart bottom_left;
341 top y1 = ypart top_right;
342 lft x6 = xpart bottom_left;
343 bot y6 = ypart bottom_left;
345 rt z4 = (xpart top_right, (ypart top_right + ypart bottom_left) / 2);
346 x5 = x3 = thinning_start [xpart top_right, xpart bottom_left]
347 - linethickness + 0.1 staff_space;
348 z3 = whatever [z1, z4];
349 z5 = whatever [z6, z4];
351 penpos1 (thickness, angle (z3 - z1) + 90);
352 penpos3 (thickness, angle (z3 - z1) + 90);
353 penpos4 (thickness, 90);
354 penpos5 (thickness, angle (z6 - z5) + 90);
355 penpos6 (thickness, angle (z6 - z5) + 90);
357 x4 - x7 = diminish * thickness;
369 ..tension 0.8.. rt z4
378 fet_beginchar ("> accent", "sforzato");
379 set_char_box (.9 staff_space#, .9 staff_space#,
380 .5 staff_space#, .5 staff_space#);
382 draw_accent ((-w, -d), (w, h),
383 0.05 staff_space + linethickness, 0.7);
384 penlabels (1, 3, 4, 5, 6);
389 fet_beginchar ("espr", "espr");
390 set_char_box (1.9 staff_space#, 1.9 staff_space#,
391 .5 staff_space#, .5 staff_space#);
393 draw_accent ((w - 1.78 staff_space, -d), (w, h),
394 0.05 staff_space + linethickness, 0.6);
395 addto currentpicture also currentpicture xscaled -1;
399 fet_beginchar ("staccato dot", "staccato");
401 radius# = 0.20 * staff_space#;
402 define_whole_pixels (radius);
404 pickup pencircle scaled 2 radius;
407 set_char_box (radius#, radius#, radius#, radius#);
411 def draw_staccatissimo =
413 height# = .8 staff_space#;
414 radius# = linethickness# + .1 staff_space#;
415 define_whole_blacker_pixels (radius);
416 define_pixels (height);
418 draw_brush ((0, 0), linethickness, (0, height), 2 radius);
420 set_char_box (radius#, radius#,
421 blot_diameter# / 2, height# + radius#);
425 fet_beginchar ("staccatissimo/martellato up", "ustaccatissimo");
430 fet_beginchar ("staccatissimo/martellato down", "dstaccatissimo");
436 fet_beginchar ("portato/single tenuto", "tenuto");
438 thick# = 1.6 linethickness#;
439 define_whole_blacker_pixels (thick);
441 set_char_box (.6 staff_space#, .6 staff_space#,
442 thick# / 2, thick# / 2);
444 draw_rounded_block ((-b, -thick / 2), (w, thick / 2), thick);
449 save thick, dot_size;
450 thick# = 1.4 linethickness#;
451 dot_size# = 2.4 linethickness# + 0.08 staff_space#;
452 define_whole_blacker_pixels (thick, dot_size);
454 set_char_box (.6 staff_space#, .6 staff_space#,
455 thick# / 2, .5 staff_space# + .5 dot_size#);
457 draw_rounded_block ((-b, -thick / 2), (w, thick / 2), thick);
459 pickup pencircle scaled dot_size;
464 fet_beginchar ("portato/tenuto with staccato", "uportato");
469 fet_beginchar ("portato/tenuto with staccato", "dportato");
476 save fat_factor, thinness;
477 save left_dist, right_dist, ne, se;
478 pair left_dist, right_dist, ne, se;
480 set_char_box (staff_space# / 2, staff_space# / 2,
481 0, 1.1 staff_space#);
484 thinness = linethickness;
486 pickup pencircle scaled thinness;
495 z1 - z4 = whatever * (charwd, -charht);
496 z4 = fat_factor [z3, z5];
498 ne = unitvector (z3 - z5);
499 se = unitvector (z2 - z3);
501 left_dist = (ne rotated 90) * 0.5 thinness;
502 right_dist = (se rotated 90) * 0.5 thinness;
505 .. (z5 - left_dist){ne}
506 -- (((z5 - left_dist) -- (z3 - left_dist)) intersectionpoint
507 ((z1 - right_dist) -- (z4 - right_dist)))
508 -- (z1 - right_dist){se}
511 .. (z2 + right_dist){-se}
512 -- (z3 + right_dist){-se}
514 .. (z3 + left_dist){-ne}
515 -- (z5 + left_dist){-ne}
520 fet_beginchar ("marcato up", "umarcato");
522 labels (1, 2, 3, 4, 5);
527 % The down marcato char (not very much used).
528 % Contrary to what some MF/TeX `gurus' believe
529 % it is *point*-symmetric with the "up" version
532 fet_beginchar ("marcato down", "dmarcato");
539 % used in french horn music todo
541 % TODO: too light at 20pt
544 fet_beginchar ("open (unstopped)", "open");
545 save thin, height, width, thick;
547 height# = 5/4 width#;
548 height# = staff_space#;
549 thin = .6 linethickness + 0.06 staff_space;
551 set_char_box (width# / 2, width# / 2, height# / 2, height# / 2);
553 define_pixels (width, height);
555 2 thick + 0.6 (height - 2 thin) = width;
559 penpos3 (thick, 180);
566 penlabels (1, 2, 3, 4);
576 fet_beginchar ("plus (stopped)", "stopped");
577 save hthick, vthick, size, outer_hsize, outer_vsize;
579 hthick# = vthick# = 2 linethickness#;
580 size# = 1.1 staff_space#;
581 define_whole_blacker_pixels (vthick);
582 define_whole_vertical_blacker_pixels (hthick);
584 set_char_box (size# / 2, size# / 2, size# / 2, size# / 2);
586 outer_hsize = hround ((b + w - vthick) / 2);
587 outer_vsize = vround ((h + d - hthick) / 2);
588 w := b := (2 outer_hsize + vthick) / 2;
589 h := d := (2 outer_vsize + hthick) / 2;
591 draw_rounded_block ((-b, -d + outer_vsize),
592 (w, -d + outer_vsize + hthick), hthick);
593 draw_rounded_block ((-b + outer_hsize, -d),
594 (-b + outer_hsize + vthick, h), vthick);
598 fet_beginchar ("Upbow", "upbow");
601 thick = 1.4 linethickness;
602 wd# = 1.3 staff_space#;
605 set_char_box (wd# / 2, wd# / 2, 0, ht#);
607 draw_accent ((-h, -w), (0, w), thick, 0.9);
608 currentpicture := currentpicture rotated -90;
612 fet_beginchar ("Downbow", "downbow");
613 save stemthick, beamheight, wd;
617 wd# = 1.5 staff_space#;
620 stemthick = hround (1.2 linethickness);
622 set_char_box (wd# / 2, wd# / 2, 0, 4/3 staff_space#);
626 pickup pencircle scaled blot_diameter;
634 pickup pencircle scaled stemthick;
647 -- reverse pat xscaled -1 shifted (-feta_eps, 0)
656 % Inspired by a computer-set version of Auf dem Strom by Baerenreiter.
660 save thin, thick, ball_diam, darkness;
661 save wd, ht, thick_nibangle, ball_nib_thick;
665 wd# = 35/16 staff_space#;
666 ht# = 18/17 staff_space#;
667 darkness = 0.3 linethickness + 0.09 staff_space;
669 set_char_box (wd# / 2, wd# / 2, ht# / 2, ht# / 2);
674 ball_nib_thick = 2.7 darkness;
675 ball_diam = ball_nib_thick + (h - ball_nib_thick) / 10;
685 penpos1 (1.1 thick, thick_nibangle);
686 penpos2 (thick, thick_nibangle);
688 penpos4 (ball_nib_thick, -90);
691 swoosh := z1l{curl 0}
699 .. swoosh scaled -1 shifted (-feta_eps, -feta_eps)
703 y5r = y4l - ball_diam / 2;
706 penpos5 (1.6 ball_diam / 2, 10);
707 penpos6 (ball_diam / 2, 150);
714 fill ploop scaled -1 shifted (-feta_eps, -feta_eps);
718 fet_beginchar ("Reverse turn", "reverseturn");
720 currentpicture := currentpicture yscaled -1;
724 fet_beginchar ("Turn", "turn");
726 penlabels (1, 2, 3, 4, 5, 6, 7);
731 % Inspired by a (by now) PD edition of Durand & C'ie edition of
732 % Saint-Saens' Celloconcerto no. 1
734 % FIXME take out hardcoded vars.
735 % FIXME the two loops on the `t' should be smoother (and the left one bigger).
736 % FIXME generic macros for serifs: top of the t and bottom of r
739 fet_beginchar ("Trill (`tr')", "trill");
740 save start_nib_angle, ascender_extra, ex, hair_thick, fatness;
741 save slant, t_fatness, r_fatness, kerning, t_overshoot;
742 save uitschieter, bulb_size, krul_ang;
745 ascender_extra# = 1/2 ex#;
746 ascender# = ascender_extra# + ex#;
747 ex# = 1.4 staff_space#;
749 start_nib_angle = 20;
751 define_pixels (ex, ascender_extra, ascender, kerning);
753 t_overshoot = 0.03 ex;
755 t_fatness = 0.78 fatness;
756 t_width = 1.9 t_fatness;
757 r_fatness = 0.78 fatness;
758 uitschieter = 0.48 ex;
759 hair_thick = linethickness;
760 r_flare = .5 hair_thick + 0.25 r_fatness;
761 r_width = 2 r_fatness + 0.25 kerning;
764 local_copy (transform)(currenttransform);
765 currenttransform := currenttransform slanted slant
766 shifted (-staff_space, 0);
768 set_char_box (.85 staff_space#, .85 staff_space#, 0, ascender#);
772 % try to position in such a way that the center is the visual
775 x1l = 0.2 staff_space;
776 x1r - x1l = t_fatness;
777 penpos1 (start_nib_wid, start_nib_angle);
780 penpos2 (start_nib_wid, start_nib_angle);
782 z3l = (x2l + 0.5 t_width, - t_overshoot);
784 z4l = (x2l + t_width, 0.23 ex);
785 penpos4 (whatever, 180); % 200
786 x4l - x4r = hair_thick;
788 x3r = 0.5 [x4r, x2r];
789 % 1.7 [x3l, x3r] = x4r;
790 y3r - y3l = 0.6 t_fatness;
797 pickup pencircle scaled hair_thick;
799 z5 = (x2l + t_fatness / 2, 2/3 ex);
800 lft x6 = x2l - uitschieter;
801 y6 = y5; % - 1/20 ex;
802 z7 = z5 + whatever * dir krul_ang;
803 up_angle = krul_ang; % = angle (z7-z5)
804 x7 = 5/10 kerning + x5;
812 z4' = point 0.85 of krul_p;
813 penpos4' (hair_thick, angle (direction 0.85 of krul_p) + 90);
815 % the body of the `t' and the bottom loop
816 fill z1r{dir (angle (z1l - z1r) + 30)}
817 .. z1l{-dir (angle (z1r - z1l) - 45)}
819 ..tension (1 + .5 slant).. z3l{right}
821 .. z4'l{direction 0.85 of krul_p}
822 -- z4'r{-direction 0.85 of krul_p}
825 ..tension (1.5 + .7 slant).. z2r{up}
828 z5' = point 1.1 of krul_p;
829 penpos5' (hair_thick, angle (direction 1.1 of krul_p) + 90);
830 z5'' = point 1.5 of krul_p;
831 penpos5'' (hair_thick, angle (direction 1.5 of krul_p) + 90);
832 z5''' = point 1.8 of krul_p;
833 penpos5''' (hair_thick, angle (direction 1.8 of krul_p) + 90);
834 z6 = point 2 of krul_p;
835 penpos6 (hair_thick, angle (direction 2 of krul_p) + 90);
836 z6' = point 2.3 of krul_p;
837 penpos6' (hair_thick, angle (direction 2.3 of krul_p) + 90);
838 z6'' = point 2.6 of krul_p;
839 penpos6'' (hair_thick, angle (direction 2.6 of krul_p) + 90);
840 z6''' = point 2.9 of krul_p;
841 penpos6''' (hair_thick, angle (direction 2.9 of krul_p) + 90);
842 penpos7 (hair_thick, up_angle + 90);
843 z7' = point 3.2 of krul_p;
844 penpos7' (hair_thick, angle (direction 3.2 of krul_p) + 90);
847 penstroke z5'e{direction 1.1 of krul_p}
848 .. z5''e{direction 1.5 of krul_p}
849 .. z5'''e{direction 1.8 of krul_p}
850 .. z6e{direction 2 of krul_p}
851 .. z6'e{direction 2.3 of krul_p}
852 .. z6''e{direction 2.6 of krul_p}
853 .. {direction 2.9 of krul_p}z6'''e;
857 penpos9 (r_fatness, 0);
860 y10 = -0.3 linethickness;
861 penpos10 (r_fatness, 0);
863 penpos11 (hair_thick, -4);
866 z13l = (x9l + r_width, y11 - linethickness);
867 penpos13 (r_flare, 180);
869 z15 = z13r - (bulb_size * r_fatness, 0);
870 z14 = 0.5 [z13l, z15] - (0, bulb_size * r_fatness);
879 (u, v) = before intersectiontimes after;
881 save before_bulb, after_bulb;
882 path before_bulb, after_bulb;
883 before_bulb := z9r{up}
884 ..tension 0.94.. z13r{down};
885 after_bulb := z13l{up}
886 ..tension 1.06.. z15{down};
887 (u_bulb, v_bulb) = before_bulb intersectiontimes after_bulb;
889 % the connection between `t' and `r', the body of the `r',
894 -- simple_serif (z10l, z10r, -30)
896 .. subpath (0, u_bulb) of before_bulb
897 .. subpath (v_bulb, infinity) of after_bulb
900 .. subpath (0, u) of before
901 .. subpath (v, infinity) of after
904 penlabels (range 1 thru 15);
905 penlabels (4', 5', 5'', 5''', 6', 6'', 6''', 7');
910 save radius, thickness;
914 radius# := .5 staff_space#;
916 set_char_box (radius#, radius#, radius#, 2/3 staff_space#);
918 thickness := hround (1.5 linethickness);
920 pickup pencircle scaled thickness;
939 -- reverse pat xscaled -1 shifted (-feta_eps, 0)
945 fet_beginchar ("left heel", "upedalheel");
951 fet_beginchar ("right heel", "dpedalheel");
958 save ht, wd, thickness;
960 thickness := 1.5 linethickness;
961 ht# := 1.5 staff_space#;
963 define_pixels (ht, wd);
965 set_char_box (wd#, wd#, 0, ht#);
966 draw_accent ((-h, -w), (0, w), thickness, 0.9);
967 currentpicture := currentpicture rotated -90;
971 fet_beginchar ("left toe", "upedaltoe");
976 fet_beginchar ("right toe", "dpedaltoe");
982 fet_beginchar ("Flageolet", "flageolet");
983 save height, width, thickness, superness;
985 height# = 4/15 staffsize#;
987 thickness# = blot_diameter#;
988 define_pixels (height, width);
989 define_whole_blacker_pixels (thickness);
991 set_char_box (width# / 2, width# / 2, height# / 2, height# / 2);
993 penpos1 (thickness, 90);
994 penpos2 (thickness, 180);
995 penpos3 (thickness, 270);
996 penpos4 (thickness, 0);
1007 penlabels (1, 2, 3, 4);
1009 % mf doesn't handle pixel dropouts in outline objects, so we use
1010 % `draw' if not called by mpost
1011 if known miterlimit:
1018 pickup pencircle scaled thickness;
1029 % TODO: ARGRGHGH code dup.
1032 fet_beginchar ("Segno", "segno");
1033 save thin, thick, ball_diam, darkness, pointheight;
1034 save wd, ht, thick_nibangle, ball_nib_thick;
1038 ht# = 3 staff_space#;
1039 wd# = 2 staff_space#;
1040 darkness = .08 staff_space + 0.4 linethickness;
1042 set_char_box (wd# / 2, wd# / 2, ht# / 2, ht# / 2);
1044 thick_nibangle = 30;
1047 ball_nib_thick = 2.7 darkness;
1048 ball_diam = ball_nib_thick + (w - ball_nib_thick) / 10;
1049 pointheight = 2 linethickness;
1059 penpos1 (thick, 2 thick_nibangle);
1060 penpos2 (thick, thick_nibangle);
1061 penpos3 (thin, -90);
1062 penpos4 (ball_nib_thick, 180 - thick_nibangle);
1067 swoosh := z1l{curl 0}
1075 .. (swoosh scaled -1)
1079 x5r = x4l - ball_diam / 2;
1082 penpos5 (1.6 ball_diam / 2, 100);
1083 penpos6 (ball_diam / 2, 240);
1090 fill ploop scaled -1;
1092 penpos7 (2 thin, 0);
1094 penpos8 (2 thin, 0);
1100 pickup pencircle scaled 2 thin;
1101 drawdot (-x2r, pointheight);
1102 drawdot (x2r, -pointheight);
1104 penlabels (range 1 thru 8);
1108 fet_beginchar ("Coda", "coda");
1109 save stickout, thin, thick, codawidth, codaheight;
1111 stickout# = 0.35 staff_space#;
1112 codawidth# = 2/3 staff_space#;
1113 codaheight# = staff_space#;
1114 define_pixels (codawidth, codaheight);
1116 set_char_box (codawidth# + stickout#, codawidth# + stickout#,
1117 codaheight# + stickout#, codaheight# + stickout#);
1119 thin = 1.2 linethickness;
1120 0.1 (codaheight - 2 thin) = (codawidth - 2 thick);
1123 penpos2 (thin, -90);
1124 penpos3 (thick, -180);
1125 penpos4 (thin, -270);
1134 penlabels (1, 2, 3, 4);
1147 draw_gridline ((0, -h), (0, h), thin);
1148 draw_gridline ((-w, 0), (w, 0), thin);
1152 fet_beginchar ("Varied Coda", "varcoda");
1153 save thin, thick, codawidth, codaheight;
1154 thin# = 1.2 linethickness#;
1155 thick# = 1.0 linethickness# + 0.25 staff_space#;
1156 codawidth# = 2/3 staff_space#;
1157 codaheight# = staff_space#;
1158 define_pixels (thin, thick, codawidth, codaheight);
1160 set_char_box (codawidth# + thick#, codawidth# + thick#,
1161 codaheight# + thick#, codaheight# + thick#);
1163 x1 = -codawidth + thick - .5 blot_diameter;
1165 x2 = codawidth - thick + .5 blot_diameter;
1167 draw_square_block (z1, z2);
1173 draw_block (z3, z4);
1175 labels (1, 2, 3, 4);
1177 addto currentpicture also currentpicture scaled -1;
1179 draw_gridline ((0, -h), (0, h), thin);
1180 draw_gridline ((-w, 0), (w, 0), thin);
1185 save alpha, thick, thin, ht;
1188 thin# = 1.2 linethickness#;
1189 thick# = 3 linethickness#;
1190 ht# = .6 staff_space#;
1191 define_pixels (thin, thick, ht);
1193 set_char_box (0, .5 staff_space#, ht#, ht#);
1195 penpos1 (thick, alpha);
1196 penpos2 (thick, alpha + 90);
1197 penpos3 (thin, 180 - alpha);
1198 penpos4 (thin, 90 - alpha);
1206 fill z1l{dir (alpha + 90)}
1208 .. z1r{dir (alpha - 90)}
1209 .. z3l{dir (270 - alpha)}
1210 .. z4l{dir (180 - alpha)}
1211 .. z3r{dir (90-alpha)}
1216 fet_beginchar ("Right Comma", "rcomma");
1218 penlabels (1, 2, 3, 4);
1222 fet_beginchar ("Left Comma", "lcomma");
1229 save thick, thin, ht, wd, alpha;
1232 thin# = 1.2 linethickness#;
1233 thick# = 3 linethickness#;
1234 ht# = .6 staff_space#;
1235 wd# = .25 staff_space#;
1236 define_pixels (thin, thick, ht, alpha);
1238 set_char_box (wd#, wd#, ht#, ht#);
1243 draw_brush (z1, thin, z2, thick);
1247 fet_beginchar ("Right Varied Comma", "rvarcomma");
1253 fet_beginchar ("Left Varied Comma", "lvarcomma");
1259 thick# := 1/24 designsize;
1260 define_blacker_pixels (thick);
1262 rthin := 0.075 * staff_space + 0.5 linethickness;
1263 rthick := 2 thick + rthin;
1268 save ne, nw, se, sw;
1270 pair ne, nw, se, sw;
1274 nw = dir (alpha + 180);
1275 ne = dir (alpha + 90);
1277 sw = dir (alpha - 90);
1279 penpos1 (rthin, alpha + 90);
1280 penpos2 (5/4 rthick, alpha);
1281 penpos3 (3/4 rthick, alpha);
1282 penpos4 (5/4 rthick, alpha);
1283 penpos5 (rthin, alpha + 90);
1285 z1 = (width / 2, height) - overshoot * se;
1286 z2 = 2 [z4, (width / 2, height / 2)];
1288 x4 = 2/8 staff_space;
1291 z5 = 2 [z1, (width / 2, height / 2)];
1292 z6 = z2l + 1/2 rthin * sw;
1293 z7 = z4l + 1/2 rthin * sw + 1/2 rthin * se;
1294 z8 = 2 [z6, (width / 2, height / 2)];
1295 z9 = 2 [z7, (width / 2, height / 2)];
1311 fet_beginchar ("Arpeggio", "arpeggio");
1312 save height, overshoot, width;
1313 height# = staff_space#;
1314 width# = 0.8 height#;
1315 overshoot# = 0.25 staff_space#;
1316 define_pixels (height, overshoot, width);
1318 set_char_box (0, width#, 0, height#);
1320 penlabels (range 1 thru 9);
1322 draw_staff (-2, 2, 0.0);
1327 % Extendable Trill symbol.
1329 % Rename me to Trill, rename Trill to Tr?
1332 fet_beginchar ("Trill_element", "trill_element");
1333 save height, overshoot;
1334 height# = staff_space#;
1335 width# = 0.8 height#;
1336 overshoot# = 0.25 staff_space#;
1337 define_pixels (height, overshoot, width);
1339 set_char_box (0, height#, 0, width#);
1342 currentpicture := currentpicture shifted -(width / 2, height / 2);
1343 currentpicture := currentpicture rotated 90;
1344 currentpicture := currentpicture shifted (height / 2, width / 2);
1349 % Arpeggio arrow by Chris Jackson <chris@fluffhouse.org.uk>
1352 def draw_arpeggio_arrow =
1353 save thinness, height, width, overshoot;
1354 save nw, ne, se, sw;
1356 save before_left, before_right, after_left, after_right;
1357 save u_left, v_left, u_right, v_right;
1358 pair nw, ne, se, sw;
1359 path before_left, before_right, after_left, after_right;
1361 height# = staff_space#;
1362 width# = 0.8 height#;
1363 overshoot# = 0.25 staff_space#;
1364 define_pixels (height, overshoot, width);
1366 set_char_box (0, width#, 0, height#);
1369 nw = dir (alpha + 180);
1370 ne = dir (alpha + 90);
1372 sw = dir (alpha - 90);
1374 penpos1 (rthin, alpha + 90);
1375 penpos2 (5/4 rthick, alpha);
1376 penpos3 (5/4 rthick, 0);
1378 z1 = (width / 2, height) - overshoot * se; % numbering is consistent
1379 % with the arpeggio symbol
1380 z2 = 2 [z4, (width / 2, height / 2)];
1381 z3 = (0.5 width, 0.5 height);
1382 z4 = (0.25 staff_space, rthin);
1383 z6 = z2l + 1/2 rthin * sw;
1384 z9 = (width / 2, height) + overshoot * se;
1386 pickup pencircle scaled vround (0.5 rthin);
1388 bot z10 = (0.5 w, 0);
1389 lft z11 = (0.5 w - hround (0.8 w), 0.8 h);
1390 rt z12 = (0.5 w + hround (0.8 w), 0.8 h);
1395 after_left := (z3 + (0, -0.25 rthin / cosd (angle (nw))))
1396 -- (z11 + 0.25 rthin * ne);
1397 (u_left, v_left) = before_left intersectiontimes after_left;
1399 before_right := (z12 + 0.25 rthin * nw)
1400 -- (z3 + (0, -0.25 rthin / cosd (angle (nw))));
1401 after_right := z3r{up}
1404 (u_right, v_right) = before_right intersectiontimes after_right;
1406 fill subpath (0, u_left) of before_left
1407 .. subpath (v_left, infinity) of after_left
1410 .. {dir -50}(z11 + 0.25 rthin * sw)
1411 .. (z10 + 0.25 rthin * sw){dir -70}
1413 .. {dir 70}(z10 + 0.25 rthin * se)
1414 .. (z12 + 0.25 rthin * se){dir 50}
1417 .. subpath (0, u_right) of before_right
1418 .. subpath (v_right, infinity) of after_right
1421 % mf doesn't handle pixel dropouts in outline objects, so we use
1422 % `draw' if not called by mpost
1423 if not known miterlimit:
1424 pickup pencircle scaled 0.7 rthin;
1426 -- (z9 + 0.5 rthin * dir (alpha - 90));
1431 fet_beginchar ("Arpeggio arrow down", "arpeggio.arrow.M1");
1432 draw_arpeggio_arrow;
1433 penlabels (range 1 thru 12);
1437 fet_beginchar ("Arpeggio arrow up", "arpeggio.arrow.1");
1438 draw_arpeggio_arrow;
1439 currentpicture := currentpicture scaled -1
1440 shifted (w - feta_eps, h - feta_eps);
1449 % Railroad tracks. We define two variants of these -- both as slightly
1450 % tapered, comma-shaped curves and as two straight parallel slashes.
1453 fet_beginchar ("Curved caesura", "caesura.curved");
1454 save slant, space_between, clearance;
1456 save botthick, topthick;
1460 botthick = 1.5 linethickness;
1461 topthick = 2.5 linethickness;
1463 pickup pencircle scaled botthick;
1466 space_between# = 0.6 staff_space#;
1467 clearance# = 0.2 staff_space#;
1468 height# = 1.2 staff_space#;
1470 set_char_box (0, 2.0 staff_space#,
1471 staff_space# - clearance#, height#);
1472 define_pixels (clearance, height);
1473 define_whole_pixels (space_between);
1479 x2 = (y2 - y1) / slant;
1483 alpha = angle (z2 - z1);
1484 penpos1 (botthick, alpha - krom);
1485 penpos3 (botthick, alpha - krom + 90);
1487 penpos2 (topthick, alpha + krom);
1488 penpos4 (topthick, alpha + krom + 90);
1493 penlabels (1, 2, 3, 4);
1495 pat := z3r{(z1r - z1l)}
1503 fill pat shifted (space_between, 0);
1507 fet_beginchar ("Straight caesura", "caesura.straight");
1508 save slant, space_between, clearance;
1509 save thick, ne, pat;
1514 thick = 2.88 linethickness;
1516 space_between# = 0.56 staff_space#;
1517 clearance# = 0.2 staff_space#;
1519 set_char_box (0, 2.0 staff_space#,
1520 staff_space# - clearance#, 1.2 staff_space#);
1521 define_whole_pixels (space_between);
1528 x4 = x1 + (h + d) / slant;
1531 ne = unitvector (z4 - z1);
1533 z1a = z1 + blot_diameter * ne;
1534 z1b = z1 + blot_diameter * right;
1535 z2a = z2 + blot_diameter * ne;
1536 z2b = z2 + blot_diameter * left;
1538 z3a = z3 - blot_diameter * ne;
1539 z3b = z3 + blot_diameter * left;
1540 z4a = z4 - blot_diameter * ne;
1541 z4b = z4 + blot_diameter * right;
1554 fill pat shifted (space_between, 0);
1556 labels(range 1 thru 4);
1557 labels(1a, 1b, 2a, 2b, 3a, 3b, 4a, 4b);
1560 fet_endgroup ("scripts");