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--2005 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;
123 fet_beginchar ("short fermata up", "ushortfermata");
125 labels (1, 2, 3, 4, 5, 6);
129 fet_beginchar ("short fermata down", "dshortfermata");
135 def draw_long_fermata =
136 save stemthick, beamheight, dot_size, wd;
140 wd# = 2.5 staff_space#;
141 stemthick = hround (1.5 linethickness);
142 beamheight = 0.3 staff_space + linethickness;
143 dot_size# = 0.266 staff_space# + 2.666 * linethickness#;
145 define_whole_blacker_pixels (dot_size);
147 set_char_box (wd# / 2, wd# / 2, 0, 3/2 staff_space#);
149 pickup pencircle scaled blot_diameter;
157 pickup pencircle scaled stemthick;
170 -- reverse pat xscaled -1 shifted (-feta_eps, 0)
175 pickup pencircle scaled dot_size;
184 fet_beginchar ("long fermata up", "ulongfermata");
190 fet_beginchar ("long fermata down", "dlongfermata");
196 def draw_very_long_fermata =
197 save ibeamheight, obeamheight;
198 save ihwd, ohwd, iht, oht; % inner/outer half_width/height
199 save stemthick, dot_size;
203 ihwd# = 1.0 staff_space#;
204 ohwd# = 1.5 staff_space#;
205 iht# = 0.9 staff_space#;
206 oht# = 1.6 staff_space#;
207 define_pixels (ihwd, ohwd, iht, oht)
209 stemthick = hround (1.5 linethickness);
210 ibeamheight# = 0.3 staff_space#;
211 obeamheight# = 0.5 staff_space#;
212 define_pixels (ibeamheight, obeamheight);
214 dot_size# = (iht# - ibeamheight#) * 8/10;
215 define_whole_blacker_pixels (dot_size);
217 set_char_box (ohwd#, ohwd#, 0, oht#);
219 pickup pencircle scaled blot_diameter;
228 ipat := top z11{left}
231 pickup pencircle scaled stemthick;
233 x2 = -ohwd + stemthick;
234 y2 = oht - obeamheight;
237 x12 = -ihwd + stemthick;
238 y12 = iht - ibeamheight;
248 -- reverse opat xscaled -1 shifted (-feta_eps, 0)
256 -- reverse ipat xscaled -1 shifted (-feta_eps, 0)
262 pickup pencircle scaled dot_size;
271 fet_beginchar ("very long fermata up", "uverylongfermata");
272 draw_very_long_fermata;
273 labels (1, 2, 3, 11, 12, 13, 4);
277 fet_beginchar ("very long fermata down", "dverylongfermata");
278 draw_very_long_fermata;
284 % Thumbs are used in cello music.
285 % TODO : thumbs should look like the finger-font and should be placed in
286 % the same way in the score.
289 fet_beginchar ("Thumb", "thumb");
290 save thin, height, width, thick, depth;
291 height# = 5/4 width#;
292 height# = staff_space#;
293 depth# = 1.6 (height# / 2);
295 set_char_box (width# / 2, width# / 2, depth#, height# / 2);
297 define_pixels (height, width);
299 thin = .6 linethickness + 0.06 staff_space;
300 2 thick + 0.5 (height - 2 thin) = width;
304 penpos3 (thick, 180);
311 penlabels (1, 2, 3, 4);
320 y5 = -d + brush_thick / 2;
321 brush_thick = 0.9 thick;
326 draw_brush (z4r, 1.4 thin, z5, brush_thick);
331 % `\accent' is TeX reserved.
334 def draw_accent (expr bottom_left, top_right, thickness, diminish) =
336 thinning_start = 0.4;
337 pickup pencircle scaled thickness;
339 lft x1 = xpart bottom_left;
340 top y1 = ypart top_right;
341 lft x6 = xpart bottom_left;
342 bot y6 = ypart bottom_left;
344 rt z4 = (xpart top_right, (ypart top_right + ypart bottom_left) / 2);
345 x5 = x3 = thinning_start [xpart top_right, xpart bottom_left]
346 - linethickness + 0.1 staff_space;
347 z3 = whatever [z1, z4];
348 z5 = whatever [z6, z4];
350 penpos1 (thickness, angle (z3 - z1) + 90);
351 penpos3 (thickness, angle (z3 - z1) + 90);
352 penpos4 (thickness, 90);
353 penpos5 (thickness, angle (z6 - z5) + 90);
354 penpos6 (thickness, angle (z6 - z5) + 90);
356 x4 - x7 = diminish * thickness;
368 ..tension 0.8.. rt z4
377 fet_beginchar ("> accent", "sforzato");
378 set_char_box (.9 staff_space#, .9 staff_space#,
379 .5 staff_space#, .5 staff_space#);
381 draw_accent ((-w, -d), (w, h),
382 0.05 staff_space + linethickness, 0.7);
383 penlabels (1, 3, 4, 5, 6);
388 fet_beginchar ("espr", "espr");
389 set_char_box (1.9 staff_space#, 1.9 staff_space#,
390 .5 staff_space#, .5 staff_space#);
392 draw_accent ((w - 1.78 staff_space, -d), (w, h),
393 0.05 staff_space + linethickness, 0.6);
394 addto currentpicture also currentpicture xscaled -1;
398 fet_beginchar ("staccato dot", "staccato");
400 radius# = 0.20 * staff_space#;
401 define_whole_pixels (radius);
403 pickup pencircle scaled 2 radius;
406 set_char_box (radius#, radius#, radius#, radius#);
410 def draw_staccatissimo =
412 height# = .8 staff_space#;
413 radius# = linethickness# + .1 staff_space#;
414 define_whole_blacker_pixels (radius);
415 define_pixels (height);
417 draw_brush ((0, 0), linethickness, (0, height), 2 radius);
419 set_char_box (radius#, radius#,
420 blot_diameter# / 2, height# + radius#);
424 fet_beginchar ("staccatissimo/martellato up", "ustaccatissimo");
429 fet_beginchar ("staccatissimo/martellato down", "dstaccatissimo");
435 fet_beginchar ("portato/single tenuto", "tenuto");
437 thick# = 1.6 linethickness#;
438 define_whole_blacker_pixels (thick);
440 set_char_box (.6 staff_space#, .6 staff_space#,
441 thick# / 2, thick# / 2);
443 draw_rounded_block ((-b, -thick / 2), (w, thick / 2), thick);
448 save thick, dot_size;
449 thick# = 1.4 linethickness#;
450 dot_size# = 2.4 linethickness# + 0.08 staff_space#;
451 define_whole_blacker_pixels (thick, dot_size);
453 set_char_box (.6 staff_space#, .6 staff_space#,
454 thick# / 2, .5 staff_space# + .5 dot_size#);
456 draw_rounded_block ((-b, -thick / 2), (w, thick / 2), thick);
458 pickup pencircle scaled dot_size;
463 fet_beginchar ("portato/tenuto with staccato", "uportato");
468 fet_beginchar ("portato/tenuto with staccato", "dportato");
475 save fat_factor, thinness;
476 save left_dist, right_dist, ne, se;
477 pair left_dist, right_dist, ne, se;
479 set_char_box (staff_space# / 2, staff_space# / 2,
480 0, 1.1 staff_space#);
483 thinness = linethickness;
485 pickup pencircle scaled thinness;
494 z1 - z4 = whatever * (charwd, -charht);
495 z4 = fat_factor [z3, z5];
497 ne = unitvector (z3 - z5);
498 se = unitvector (z2 - z3);
500 left_dist = (ne rotated 90) * 0.5 thinness;
501 right_dist = (se rotated 90) * 0.5 thinness;
504 .. (z5 - left_dist){ne}
505 -- (((z5 - left_dist) -- (z3 - left_dist)) intersectionpoint
506 ((z1 - right_dist) -- (z4 - right_dist)))
507 -- (z1 - right_dist){se}
510 .. (z2 + right_dist){-se}
511 -- (z3 + right_dist){-se}
513 .. (z3 + left_dist){-ne}
514 -- (z5 + left_dist){-ne}
519 fet_beginchar ("marcato up", "umarcato");
521 labels (1, 2, 3, 4, 5);
526 % The down marcato char (not very much used).
527 % Contrary to what some MF/TeX `gurus' believe
528 % it is *point*-symmetric with the "up" version
531 fet_beginchar ("marcato down", "dmarcato");
538 % used in french horn music todo
540 % TODO: too light at 20pt
543 fet_beginchar ("open (unstopped)", "open");
544 save thin, height, width, thick;
546 height# = 5/4 width#;
547 height# = staff_space#;
548 thin = .6 linethickness + 0.06 staff_space;
550 set_char_box (width# / 2, width# / 2, height# / 2, height# / 2);
552 define_pixels (width, height);
554 2 thick + 0.6 (height - 2 thin) = width;
558 penpos3 (thick, 180);
565 penlabels (1, 2, 3, 4);
575 fet_beginchar ("plus (stopped)", "stopped");
576 save hthick, vthick, size, outer_hsize, outer_vsize;
578 hthick# = vthick# = 2 linethickness#;
579 size# = 1.1 staff_space#;
580 define_whole_blacker_pixels (vthick);
581 define_whole_vertical_blacker_pixels (hthick);
583 set_char_box (size# / 2, size# / 2, size# / 2, size# / 2);
585 outer_hsize = hround ((b + w - vthick) / 2);
586 outer_vsize = vround ((h + d - hthick) / 2);
587 w := b := (2 outer_hsize + vthick) / 2;
588 h := d := (2 outer_vsize + hthick) / 2;
590 draw_rounded_block ((-b, -d + outer_vsize),
591 (w, -d + outer_vsize + hthick), hthick);
592 draw_rounded_block ((-b + outer_hsize, -d),
593 (-b + outer_hsize + vthick, h), vthick);
597 fet_beginchar ("Upbow", "upbow");
600 thick = 1.4 linethickness;
601 wd# = 1.3 staff_space#;
604 set_char_box (wd# / 2, wd# / 2, 0, ht#);
606 draw_accent ((-h, -w), (0, w), thick, 0.9);
607 currentpicture := currentpicture rotated -90;
611 fet_beginchar ("Downbow", "downbow");
612 save stemthick, beamheight, wd;
616 wd# = 1.5 staff_space#;
619 stemthick = hround (1.2 linethickness);
621 set_char_box (wd# / 2, wd# / 2, 0, 4/3 staff_space#);
625 pickup pencircle scaled blot_diameter;
633 pickup pencircle scaled stemthick;
646 -- reverse pat xscaled -1 shifted (-feta_eps, 0)
655 % Inspired by a computer-set version of Auf dem Strom by Baerenreiter.
659 save thin, thick, ball_diam, darkness;
660 save wd, ht, thick_nibangle, ball_nib_thick;
664 wd# = 35/16 staff_space#;
665 ht# = 18/17 staff_space#;
666 darkness = 0.3 linethickness + 0.09 staff_space;
668 set_char_box (wd# / 2, wd# / 2, ht# / 2, ht# / 2);
673 ball_nib_thick = 2.7 darkness;
674 ball_diam = ball_nib_thick + (h - ball_nib_thick) / 10;
684 penpos1 (1.1 thick, thick_nibangle);
685 penpos2 (thick, thick_nibangle);
687 penpos4 (ball_nib_thick, -90);
690 swoosh := z1l{curl 0}
698 .. swoosh scaled -1 shifted (-feta_eps, -feta_eps)
702 y5r = y4l - ball_diam / 2;
705 penpos5 (1.6 ball_diam / 2, 10);
706 penpos6 (ball_diam / 2, 150);
713 fill ploop scaled -1 shifted (-feta_eps, -feta_eps);
717 fet_beginchar ("Reverse turn", "reverseturn");
719 currentpicture := currentpicture yscaled -1;
723 fet_beginchar ("Turn", "turn");
725 penlabels (1, 2, 3, 4, 5, 6, 7);
730 % Inspired by a (by now) PD edition of Durand & C'ie edition of
731 % Saint-Saens' Celloconcerto no. 1
733 % FIXME take out hardcoded vars.
734 % FIXME the two loops on the `t' should be smoother (and the left one bigger).
735 % FIXME generic macros for serifs: top of the t and bottom of r
738 fet_beginchar ("Trill (`tr')", "trill");
739 save start_nib_angle, ascender_extra, ex, hair_thick, fatness;
740 save slant, t_fatness, r_fatness, kerning, t_overshoot;
741 save uitschieter, bulb_size, krul_ang;
744 ascender_extra# = 1/2 ex#;
745 ascender# = ascender_extra# + ex#;
746 ex# = 1.4 staff_space#;
748 start_nib_angle = 20;
750 define_pixels (ex, ascender_extra, ascender, kerning);
752 t_overshoot = 0.03 ex;
754 t_fatness = 0.78 fatness;
755 t_width = 1.9 t_fatness;
756 r_fatness = 0.78 fatness;
757 uitschieter = 0.48 ex;
758 hair_thick = linethickness;
759 r_flare = .5 hair_thick + 0.25 r_fatness;
760 r_width = 2 r_fatness + 0.25 kerning;
763 local_copy (transform)(currenttransform);
764 currenttransform := currenttransform slanted slant
765 shifted (-staff_space, 0);
767 set_char_box (.85 staff_space#, .85 staff_space#, 0, ascender#);
771 % try to position in such a way that the center is the visual
774 x1l = 0.2 staff_space;
775 x1r - x1l = t_fatness;
776 penpos1 (start_nib_wid, start_nib_angle);
779 penpos2 (start_nib_wid, start_nib_angle);
781 z3l = (x2l + 0.5 t_width, - t_overshoot);
783 z4l = (x2l + t_width, 0.23 ex);
784 penpos4 (whatever, 180); % 200
785 x4l - x4r = hair_thick;
787 x3r = 0.5 [x4r, x2r];
788 % 1.7 [x3l, x3r] = x4r;
789 y3r - y3l = 0.6 t_fatness;
796 pickup pencircle scaled hair_thick;
798 z5 = (x2l + t_fatness / 2, 2/3 ex);
799 lft x6 = x2l - uitschieter;
800 y6 = y5; % - 1/20 ex;
801 z7 = z5 + whatever * dir krul_ang;
802 up_angle = krul_ang; % = angle (z7-z5)
803 x7 = 5/10 kerning + x5;
811 z4' = point 0.85 of krul_p;
812 penpos4' (hair_thick, angle (direction 0.85 of krul_p) + 90);
814 % the body of the `t' and the bottom loop
815 fill z1r{dir (angle (z1l - z1r) + 30)}
816 .. z1l{-dir (angle (z1r - z1l) - 45)}
818 ..tension (1 + .5 slant).. z3l{right}
820 .. z4'l{direction 0.85 of krul_p}
821 -- z4'r{-direction 0.85 of krul_p}
824 ..tension (1.5 + .7 slant).. z2r{up}
827 z5' = point 1.1 of krul_p;
828 penpos5' (hair_thick, angle (direction 1.1 of krul_p) + 90);
829 z5'' = point 1.5 of krul_p;
830 penpos5'' (hair_thick, angle (direction 1.5 of krul_p) + 90);
831 z5''' = point 1.8 of krul_p;
832 penpos5''' (hair_thick, angle (direction 1.8 of krul_p) + 90);
833 z6 = point 2 of krul_p;
834 penpos6 (hair_thick, angle (direction 2 of krul_p) + 90);
835 z6' = point 2.3 of krul_p;
836 penpos6' (hair_thick, angle (direction 2.3 of krul_p) + 90);
837 z6'' = point 2.6 of krul_p;
838 penpos6'' (hair_thick, angle (direction 2.6 of krul_p) + 90);
839 z6''' = point 2.9 of krul_p;
840 penpos6''' (hair_thick, angle (direction 2.9 of krul_p) + 90);
841 penpos7 (hair_thick, up_angle + 90);
842 z7' = point 3.2 of krul_p;
843 penpos7' (hair_thick, angle (direction 3.2 of krul_p) + 90);
846 penstroke z5'e{direction 1.1 of krul_p}
847 .. z5''e{direction 1.5 of krul_p}
848 .. z5'''e{direction 1.8 of krul_p}
849 .. z6e{direction 2 of krul_p}
850 .. z6'e{direction 2.3 of krul_p}
851 .. z6''e{direction 2.6 of krul_p}
852 .. {direction 2.9 of krul_p}z6'''e;
856 penpos9 (r_fatness, 0);
859 y10 = -0.3 linethickness;
860 penpos10 (r_fatness, 0);
862 penpos11 (hair_thick, -4);
865 z13l = (x9l + r_width, y11 - linethickness);
866 penpos13 (r_flare, 180);
868 z15 = z13r - (bulb_size * r_fatness, 0);
869 z14 = 0.5 [z13l, z15] - (0, bulb_size * r_fatness);
878 (u, v) = before intersectiontimes after;
880 save before_bulb, after_bulb;
881 path before_bulb, after_bulb;
882 before_bulb := z9r{up}
883 ..tension 0.94.. z13r{down};
884 after_bulb := z13l{up}
885 ..tension 1.06.. z15{down};
886 (u_bulb, v_bulb) = before_bulb intersectiontimes after_bulb;
888 % the connection between `t' and `r', the body of the `r',
893 -- simple_serif (z10l, z10r, -30)
895 .. subpath (0, u_bulb) of before_bulb
896 .. subpath (v_bulb, infinity) of after_bulb
899 .. subpath (0, u) of before
900 .. subpath (v, infinity) of after
903 penlabels (range 1 thru 15);
904 penlabels (4', 5', 5'', 5''', 6', 6'', 6''', 7');
909 save radius, thickness;
913 radius# := .5 staff_space#;
915 set_char_box (radius#, radius#, radius#, 2/3 staff_space#);
917 thickness := hround (1.5 linethickness);
919 pickup pencircle scaled thickness;
938 -- reverse pat xscaled -1 shifted (-feta_eps, 0)
944 fet_beginchar ("left heel", "upedalheel");
950 fet_beginchar ("right heel", "dpedalheel");
957 save ht, wd, thickness;
959 thickness := 1.5 linethickness;
960 ht# := 1.5 staff_space#;
962 define_pixels (ht, wd);
964 set_char_box (wd#, wd#, 0, ht#);
965 draw_accent ((-h, -w), (0, w), thickness, 0.9);
966 currentpicture := currentpicture rotated -90;
970 fet_beginchar ("left toe", "upedaltoe");
975 fet_beginchar ("right toe", "dpedaltoe");
981 fet_beginchar ("Flageolet", "flageolet");
982 save height, width, thickness, superness;
984 height# = 4/15 staffsize#;
986 thickness# = blot_diameter#;
987 define_pixels (height, width);
988 define_whole_blacker_pixels (thickness);
990 set_char_box (width# / 2, width# / 2, height# / 2, height# / 2);
992 penpos1 (thickness, 90);
993 penpos2 (thickness, 180);
994 penpos3 (thickness, 270);
995 penpos4 (thickness, 0);
1006 penlabels (1, 2, 3, 4);
1008 % mf doesn't handle pixel dropouts in outline objects, so we use
1009 % `draw' if not called by mpost
1010 if known miterlimit:
1017 pickup pencircle scaled thickness;
1028 % TODO: ARGRGHGH code dup.
1031 fet_beginchar ("Segno", "segno");
1032 save thin, thick, ball_diam, darkness, pointheight;
1033 save wd, ht, thick_nibangle, ball_nib_thick;
1037 ht# = 3 staff_space#;
1038 wd# = 2 staff_space#;
1039 darkness = .08 staff_space + 0.4 linethickness;
1041 set_char_box (wd# / 2, wd# / 2, ht# / 2, ht# / 2);
1043 thick_nibangle = 30;
1046 ball_nib_thick = 2.7 darkness;
1047 ball_diam = ball_nib_thick + (w - ball_nib_thick) / 10;
1048 pointheight = 2 linethickness;
1058 penpos1 (thick, 2 thick_nibangle);
1059 penpos2 (thick, thick_nibangle);
1060 penpos3 (thin, -90);
1061 penpos4 (ball_nib_thick, 180 - thick_nibangle);
1066 swoosh := z1l{curl 0}
1074 .. (swoosh scaled -1)
1078 x5r = x4l - ball_diam / 2;
1081 penpos5 (1.6 ball_diam / 2, 100);
1082 penpos6 (ball_diam / 2, 240);
1089 fill ploop scaled -1;
1091 penpos7 (2 thin, 0);
1093 penpos8 (2 thin, 0);
1099 pickup pencircle scaled 2 thin;
1100 drawdot (-x2r, pointheight);
1101 drawdot (x2r, -pointheight);
1103 penlabels (range 1 thru 8);
1107 fet_beginchar ("Coda", "coda");
1108 save stickout, thin, thick, codawidth, codaheight;
1110 stickout# = 0.35 staff_space#;
1111 codawidth# = 2/3 staff_space#;
1112 codaheight# = staff_space#;
1113 define_pixels (codawidth, codaheight);
1115 set_char_box (codawidth# + stickout#, codawidth# + stickout#,
1116 codaheight# + stickout#, codaheight# + stickout#);
1118 thin = 1.2 linethickness;
1119 0.1 (codaheight - 2 thin) = (codawidth - 2 thick);
1122 penpos2 (thin, -90);
1123 penpos3 (thick, -180);
1124 penpos4 (thin, -270);
1133 penlabels (1, 2, 3, 4);
1141 draw_gridline ((0, -h), (0, h), thin);
1142 draw_gridline ((-w, 0), (w, 0), thin);
1146 fet_beginchar ("Varied Coda", "varcoda");
1147 save thin, thick, codawidth, codaheight;
1148 thin# = 1.2 linethickness#;
1149 thick# = 1.0 linethickness# + 0.25 staff_space#;
1150 codawidth# = 2/3 staff_space#;
1151 codaheight# = staff_space#;
1152 define_pixels (thin, thick, codawidth, codaheight);
1154 set_char_box (codawidth# + thick#, codawidth# + thick#,
1155 codaheight# + thick#, codaheight# + thick#);
1157 x1 = -codawidth + .5 thick;
1159 x2 = codawidth - .5 thick;
1161 draw_block (z1, z2);
1167 draw_block (z3, z4);
1169 labels (1, 2, 3, 4);
1171 addto currentpicture also currentpicture scaled -1;
1173 draw_gridline ((0, -h), (0, h), thin);
1174 draw_gridline ((-w, 0), (w, 0), thin);
1179 save alpha, thick, thin, ht;
1182 thin# = 1.2 linethickness#;
1183 thick# = 3 linethickness#;
1184 ht# = .6 staff_space#;
1185 define_pixels (thin, thick, ht);
1187 set_char_box (0, .5 staff_space#, ht#, ht#);
1189 penpos1 (thick, alpha);
1190 penpos2 (thick, alpha + 90);
1191 penpos3 (thin, 180 - alpha);
1192 penpos4 (thin, 90 - alpha);
1200 fill z1l{dir (alpha + 90)}
1202 .. z1r{dir (alpha - 90)}
1203 .. z3l{dir (270 - alpha)}
1204 .. z4l{dir (180 - alpha)}
1205 .. z3r{dir (90-alpha)}
1210 fet_beginchar ("Right Comma", "rcomma");
1212 penlabels (1, 2, 3, 4);
1216 fet_beginchar ("Left Comma", "lcomma");
1223 save thick, thin, ht, wd, alpha;
1226 thin# = 1.2 linethickness#;
1227 thick# = 3 linethickness#;
1228 ht# = .6 staff_space#;
1229 wd# = .25 staff_space#;
1230 define_pixels (thin, thick, ht, alpha);
1232 set_char_box (wd#, wd#, ht#, ht#);
1237 draw_brush (z1, thin, z2, thick);
1241 fet_beginchar ("Right Varied Comma", "rvarcomma");
1247 fet_beginchar ("Left Varied Comma", "lvarcomma");
1253 thick# := 1/24 designsize;
1254 define_blacker_pixels (thick);
1256 rthin := 0.075 * staff_space + 0.5 linethickness;
1257 rthick := 2 thick + rthin;
1262 save ne, nw, se, sw;
1264 pair ne, nw, se, sw;
1268 nw = dir (alpha + 180);
1269 ne = dir (alpha + 90);
1271 sw = dir (alpha - 90);
1273 penpos1 (rthin, alpha + 90);
1274 penpos2 (5/4 rthick, alpha);
1275 penpos3 (3/4 rthick, alpha);
1276 penpos4 (5/4 rthick, alpha);
1277 penpos5 (rthin, alpha + 90);
1279 z1 = (width / 2, height) - overshoot * se;
1280 z2 = 2 [z4, (width / 2, height / 2)];
1282 x4 = 2/8 staff_space;
1285 z5 = 2 [z1, (width / 2, height / 2)];
1286 z6 = z2l + 1/2 rthin * sw;
1287 z7 = z4l + 1/2 rthin * sw + 1/2 rthin * se;
1288 z8 = 2 [z6, (width / 2, height / 2)];
1289 z9 = 2 [z7, (width / 2, height / 2)];
1305 fet_beginchar ("Arpeggio", "arpeggio");
1306 save height, overshoot, width;
1307 height# = staff_space#;
1308 width# = 0.8 height#;
1309 overshoot# = 0.25 staff_space#;
1310 define_pixels (height, overshoot, width);
1312 set_char_box (0, width#, 0, height#);
1314 penlabels (range 1 thru 9);
1316 draw_staff (-2, 2, 0.0);
1321 % Extendable Trill symbol.
1323 % Rename me to Trill, rename Trill to Tr?
1326 fet_beginchar ("Trill_element", "trill_element");
1327 save height, overshoot;
1328 height# = staff_space#;
1329 width# = 0.8 height#;
1330 overshoot# = 0.25 staff_space#;
1331 define_pixels (height, overshoot, width);
1333 set_char_box (0, height#, 0, width#);
1336 currentpicture := currentpicture shifted -(width / 2, height / 2);
1337 currentpicture := currentpicture rotated 90;
1338 currentpicture := currentpicture shifted (height / 2, width / 2);
1343 % Arpeggio arrow by Chris Jackson <chris@fluffhouse.org.uk>
1346 def draw_arpeggio_arrow =
1347 save thinness, height, width, overshoot;
1348 save nw, ne, se, sw;
1350 save before_left, before_right, after_left, after_right;
1351 save u_left, v_left, u_right, v_right;
1352 pair nw, ne, se, sw;
1353 path before_left, before_right, after_left, after_right;
1355 height# = staff_space#;
1356 width# = 0.8 height#;
1357 overshoot# = 0.25 staff_space#;
1358 define_pixels (height, overshoot, width);
1360 set_char_box (0, width#, 0, height#);
1363 nw = dir (alpha + 180);
1364 ne = dir (alpha + 90);
1366 sw = dir (alpha - 90);
1368 penpos1 (rthin, alpha + 90);
1369 penpos2 (5/4 rthick, alpha);
1370 penpos3 (5/4 rthick, 0);
1372 z1 = (width / 2, height) - overshoot * se; % numbering is consistent
1373 % with the arpeggio symbol
1374 z2 = 2 [z4, (width / 2, height / 2)];
1375 z3 = (0.5 width, 0.5 height);
1376 z4 = (0.25 staff_space, rthin);
1377 z6 = z2l + 1/2 rthin * sw;
1378 z9 = (width / 2, height) + overshoot * se;
1380 pickup pencircle scaled vround (0.5 rthin);
1382 bot z10 = (0.5 w, 0);
1383 lft z11 = (-0.3 w, 0.8 h);
1384 rt z12 = (1.3 w, 0.8 h);
1389 after_left := (z3 + (0, -0.25 rthin / cosd (angle (nw))))
1390 -- (z11 + 0.25 rthin * ne);
1391 (u_left, v_left) = before_left intersectiontimes after_left;
1393 before_right := (z12 + 0.25 rthin * nw)
1394 -- (z3 + (0, -0.25 rthin / cosd (angle (nw))));
1395 after_right := z3r{up}
1398 (u_right, v_right) = before_right intersectiontimes after_right;
1400 fill subpath (0, u_left) of before_left
1401 .. subpath (v_left, infinity) of after_left
1404 .. {dir -50}(z11 + 0.25 rthin * sw)
1405 .. (z10 + 0.25 rthin * sw){dir -70}
1407 .. {dir 70}(z10 + 0.25 rthin * se)
1408 .. (z12 + 0.25 rthin * se){dir 50}
1411 .. subpath (0, u_right) of before_right
1412 .. subpath (v_right, infinity) of after_right
1415 % mf doesn't handle pixel dropouts in outline objects, so we use
1416 % `draw' if not called by mpost
1417 if not known miterlimit:
1418 pickup pencircle scaled 0.7 rthin;
1420 -- (z9 + 0.5 rthin * dir (alpha - 90));
1425 fet_beginchar ("Arpeggio arrow down", "arpeggio.arrow.M1");
1426 draw_arpeggio_arrow;
1427 penlabels (range 1 thru 12);
1431 fet_beginchar ("Arpeggio arrow up", "arpeggio.arrow.1");
1432 draw_arpeggio_arrow;
1433 currentpicture := currentpicture scaled -1
1434 shifted (w - feta_eps, h - feta_eps);
1444 % I actually have no clue how they should look, so we use a slightly curvy
1445 % and tapered shape.
1448 fet_beginchar ("Caesura", "caesura");
1449 save slant, space_between, clearance;
1451 save botthick, topthick;
1455 botthick = 1.5 linethickness;
1456 topthick = 2.5 linethickness;
1458 pickup pencircle scaled botthick;
1461 space_between# = 0.6 staff_space#;
1462 clearance# = 0.2 staff_space#;
1463 height# = 1.2 staff_space#;
1465 set_char_box (0, 2.0 staff_space#,
1466 staff_space# - clearance#, height#);
1467 define_pixels (clearance, height);
1468 define_whole_pixels (space_between);
1474 x2 = (y2 - y1) / slant;
1478 alpha = angle (z2 - z1);
1479 penpos1 (botthick, alpha - krom);
1480 penpos3 (botthick, alpha - krom + 90);
1482 penpos2 (topthick, alpha + krom);
1483 penpos4 (topthick, alpha + krom + 90);
1488 penlabels (1, 2, 3, 4);
1490 pat := z3r{(z1r - z1l)}
1498 fill pat shifted (space_between, 0);
1502 fet_endgroup ("scripts");