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 Han-Wen Nienhuys <hanwen@cs.uu.nl>
8 % Jan Nieuwenhuizen <janneke@gnu.org>
12 fet_begingroup("scripts")
15 save alpha, radius, crook_thinness, crook_fatness, dot_diam;
17 % [Wanske] and some Baerenreiter editions
18 % suggest ca 80 degrees iso half-circle
21 radius# = 1.25 staff_space#;
22 crook_thinness# = 1.5stafflinethickness#;
23 crook_fatness# = 4 stafflinethickness#;
25 radius# + crook_fatness#/2 = h#;
26 radius# + crook_thinness#/2 = w#;
27 set_char_box(w#, w#, crook_thinness#/2, h#);
29 define_pixels(radius, crook_thinness, crook_fatness);
30 dot_diam = 4/3 crook_fatness;
33 penpos1(crook_thinness, 0);
34 penpos2(crook_fatness, -90);
38 fill z1l{dir (-alpha-90)}..{dir (90-alpha)}z1r..
39 {right}z2r -- z2l{left} .. cycle;
41 addto currentpicture also
42 currentpicture xscaled -1;
44 pickup pencircle scaled dot_diam;
46 bot y4 = - crook_thinness/2;
50 fet_beginchar("fermata up", "ufermata", "ufermata")
55 fet_beginchar("fermata down", "dfermata", "dfermata")
61 % Thumbs are used in cello music.
62 % TODO : thumbs should look like the finger-font and should be placed in
63 % the same way in the score.
66 fet_beginchar("Thumb", "thumb", "thumb")
67 save thin, height, width, thick;
69 height# = staff_space#;
70 thin = 1.2 stafflinethickness;
72 set_char_box(width#/2, width#/2, height#/2, height#/2);
79 penstroke z1e{up} .. {left}z2e;
80 addto currentpicture also currentpicture xscaled -1;
81 addto currentpicture also currentpicture yscaled -1;
86 draw_brush(z3,1.4*thin, z4,0.9*thick);
90 % FIXME: rounded endings
92 % `\accent' is TeX reserved.
93 fet_beginchar("> accent", "sforzato", "sforzatoaccent")
94 set_char_box(.9 staff_space#, .9 staff_space#, .5 staff_space#, .5 staff_space#);
95 save thickness, diminish;
97 thickness = 3/2 stafflinethickness;
98 pickup pencircle scaled thickness;
100 % prevent blobs at crossing lines
106 y2 = .25 thickness* diminish;
110 z3 = whatever [z1, z4];
112 penpos2(thickness*(2 - diminish)/2 , 90);
113 penpos1(thickness, 90);
114 penpos3(thickness, 90);
117 draw (z1 .. z3) yscaled -1;
119 penstroke z3e .. z2e;
120 penstroke (z3e .. z2e) yscaled -1;
126 % Hmm, changed 1.5 to 1.4 to avoid problems with "random" placement of
127 % the dots because of quantization effects for almost integer values. /MB
131 % Hmm. Should not meddle with darkness of font. Check out the
132 % correct value for radius. Maybe we'd better change padding --hwn
134 fet_beginchar("staccato dot", "staccato", "staccato")
136 radius# = 1.4 stafflinethickness#;
137 define_pixels(radius);
138 pickup pencircle scaled 2 radius;
140 set_char_box(radius#, radius#, radius#, radius#);
143 def draw_staccatissimo =
145 height# = .8 staff_space#;
146 radius# = 2 stafflinethickness#;
147 define_pixels(radius, height);
149 draw_brush((0,0), stafflinethickness, (0, height),2 radius);
150 set_char_box(radius#,radius#, blot_diameter#/2, height# + radius#);
153 fet_beginchar("staccatissimo/martellato up", "ustaccatissimo",
159 % FIXEM: scale labels too.
161 fet_beginchar("staccatissimo/martellato down", "dstaccatissimo", "dstaccatissimo")
166 fet_beginchar("portato/single tenuto", "tenuto", "tenuto")
168 thick# = 1.4 stafflinethickness#;
169 define_pixels(thick);
171 set_char_box(.6 staff_space#, .6 staff_space#, thick#/2,thick#/2);
172 pickup pencircle scaled thick;
181 save fat_factor, thinness;
182 set_char_box(staff_space#/2, staff_space#/2, 0, 1.1 staff_space#);
185 thinness = stafflinethickness;
187 pickup pencircle scaled thinness;
195 z1 - z4 = whatever * (charwd, -charht);
196 z4 = fat_factor [z3, z5];
198 filldraw z1 -- z2 -- z3 -- z4 -- cycle;
202 fet_beginchar("marcato up", "umarcato", "umarcato")
209 % The down marcato char (not very much used).
210 % Contrary to what some MF/TeX `gurus' believe
211 % it is *point*-symmetric with the "up" version
212 fet_beginchar("marcato down", "dmarcato", "dmarcato")
219 % used in french horn music todo
221 % TODO: too light at 20pt
222 fet_beginchar("open (unstopped)", "open", "ouvert")
223 save thin, height, width, thick;
224 height# = 5/4 width#;
225 height# = staff_space#;
226 thin = 1.2 stafflinethickness;
228 set_char_box(width#/2, width#/2, height#/2, height#/2);
235 penstroke z1e{up} .. {left}z2e;
236 addto currentpicture also currentpicture xscaled -1;
237 addto currentpicture also currentpicture yscaled -1;
241 fet_beginchar("plus (stopped)", "stopped", "plusstop")
243 thick = 2 stafflinethickness;
244 size# = 1.1 staff_space#;
246 set_char_box(size#/2, size#/2, size#/2, size#/2);
247 pickup pencircle scaled thick;
254 draw (z1 .. z2) rotated 90;
260 fet_beginchar("Upbow", "upbow", "upbow")
263 thick = 1.4 stafflinethickness;
264 wd# = 1.3 staff_space#;
268 set_char_box(wd#/2, wd#/2, 0, ht#);
269 pickup pencircle scaled thick;
277 draw z2 -- z1 -- (z2 xscaled -1);
281 fet_beginchar("Downbow", "downbow", "downbow")
282 save stemthick, beamheight;
286 wd# = 1.5 staff_space#;
287 stemthick = 1.2 stafflinethickness;
289 set_char_box(wd#/2, wd#/2, 0, 4/3 staff_space#);
294 pickup pencircle scaled blot_diameter;
295 top y2 - bot y1 = beamheight;
305 filldraw z1 -- z2 -- z3 -- z4 --cycle;
307 pickup pencircle scaled stemthick;
313 labels(1, 2,3,4,5,6);
314 addto currentpicture also currentpicture xscaled -1;
318 % Inspired by a computer-set version of Auf dem Strom by Baerenreiter.
322 save thin, thick, ball_diam, darkness;
323 save wd, ht, thick_nibangle, ball_nib_thick;
327 wd# = 35/16 staff_space#;
328 ht# = 18/17 staff_space#;
329 darkness = 1.20 stafflinethickness;
331 set_char_box(wd#/2, wd#/2, ht#/2, ht#/2);
336 ball_nib_thick = 2.7 darkness;
337 ball_diam = ball_nib_thick + (h - ball_nib_thick) / 10;
348 penpos1(1.1 thick, thick_nibangle);
349 penpos2(thick, thick_nibangle);
351 penpos4(ball_nib_thick, -90);
354 swoosh := z1l{curl 0} .. z2l .. z3l{up} .. {left}z4l
355 -- z4r .. z3r{down} .. z2r{left} ;
356 fill swoosh .. (swoosh scaled -1) .. cycle;
359 y5r = y4l - ball_diam /2;
362 penpos5(1.6 ball_diam/2, 10);
363 penpos6(ball_diam/2, 150);
365 ploop := z4l{left} .. z5l .. z6l -- cycle;
367 fill ploop scaled -1;
372 fet_beginchar("Reverse turn","reverseturn","reverseturn")
374 currentpicture := currentpicture yscaled -1;
380 fet_beginchar("Turn","turn","turn")
390 % Inspired by a (by now) PD edition of Durand & C'ie edition of
391 % Saint-Saens' Celloconcerto no. 1
393 % FIXME take out hardcoded vars.
394 % FIXME the two loops on the `t' should be smoother (and the left one bigger).
395 % FIXME generic macros for serifs: top of the t and bottom of r
399 fet_beginchar("Trill (`tr')","trill","trill")
401 save start_nib_angle, ascender_extra, ex, hair_thick, fatness,
402 slant_angle, slant, t_fatness, r_fatness, kerning, t_overshoot,
403 uitschieter, bulb_size;
407 ascender_extra# = 1/2 ex#;
408 ascender# = ascender_extra# + ex#;
409 ex# = 1.5 staff_space#;
411 start_nib_angle = 20;
413 define_pixels(ex, ascender_extra, ascender, kerning);
415 t_overshoot = 0.03 ex;
417 t_fatness = 8/10 fatness;
418 r_fatness = .75 fatness;
419 uitschieter = 21/40 ex;
420 hair_thick = blot_diameter;
424 local_copy(transform)(currenttransform);
425 currenttransform := currenttransform slanted slant shifted (- staff_space, 0) ;
430 penpos1(start_nib_wid, start_nib_angle);
433 penpos2(start_nib_wid, start_nib_angle);
435 z3l = (11/10 t_fatness, - t_overshoot);
437 z4l = (13/6 t_fatness, 5/16 ex);
438 penpos4(hair_thick, 180);
440 1.9 [z3l, z3r] = z4r;
444 path t_p, krul_p, r_p;
447 t_p := z1l -- z2l{down} .. tension (1 + .5 slant)
450 .. z4l{up} -- z4r{down}
451 .. z3r{left} .. z2r{up} .. z1r -- cycle;
456 pickup pencircle scaled hair_thick;
458 z5 = (t_fatness/2, 2/3 ex);
460 lft x6 = - uitschieter;
463 z7 = z5 + whatever*dir krul_ang;
466 x7 = 5/10 kerning + x5;
468 penpos7(hair_thick, up_angle + 90);
473 penpos8(2 hair_thick, (up_angle +90)/2);
477 penpos9(r_fatness, 0);
481 penpos10(r_fatness, 0);
483 krul_p := z4{up} .. tension 1.1 .. z5
484 .. tension 1 and .75 .. {down}z6
485 .. tension .85 and 1.1 .. z5 --- z7;
487 r_p := z7l{z7-z5} .. z8l{right} .. z9l{down} --- z10l -- z10r
489 .. z8r{left} .. z7r{z5-z7} -- cycle;
491 set_char_box(staff_space# , staff_space#, 0,ascender#);
494 penpos11(1/4 r_fatness, -20);
497 z13 = (x9 + 2 r_fatness, y11 );
498 penpos13(r_fatness, 180);
499 fill z11r{dir 70} .. z13r{down} -- z13l{up} .. z11l{dir 250} -- cycle;
500 penlabels(range 1 thru 15);
503 draw_bulb(-1, z13r, z13l, bulb_size * r_fatness, 1.5);
508 save radius, thickness, wall;
510 radius# := .5 staff_space#;
512 define_pixels(radius);
513 set_char_box(radius#, radius#, radius#, 2/3 staff_space#);
515 thickness := 1.5 stafflinethickness;
516 pickup pencircle scaled thickness;
526 draw z1{down} .. z2{down} .. z3{left};
527 addto currentpicture also currentpicture xscaled -1;
532 fet_beginchar("left heel", "upedalheel", "upedalheel")
537 fet_beginchar("right heel", "dpedalheel", "dpedalheel")
545 thickness := 1.5 stafflinethickness;
546 ht# := 1.5 staff_space#;
548 define_pixels(ht,wd);
551 set_char_box(wd#, wd#, 0, ht#);
553 pickup pencircle scaled thickness;
565 fet_beginchar("left toe", "upedaltoe", "upedaltoe")
569 fet_beginchar("right toe", "dpedaltoe", "dpedaltoe")
574 fet_beginchar("Flageolet", "flageolet", "flageolet")
575 save height,width,thickness;
576 height#=4/15 staffsize#;
578 thickness#=blot_diameter#;
579 define_pixels(height,width,thickness);
580 set_char_box(width#/2,width#/2,height#/2,height#/2);
582 pickup pencircle scaled thickness;
586 rt x4 - lft x2 =width;
593 draw z1..z2..z3..z4..cycle;
596 fet_beginchar("Segno", "segno", "segno")
597 save thin, thick, ball_diam, darkness, pointheight;
598 save wd, ht, thick_nibangle, ball_nib_thick;
602 ht# = 3 staff_space#;
603 wd# = 2 staff_space#;
604 darkness = 1.20 stafflinethickness;
606 set_char_box(wd#/2, wd#/2, ht#/2, ht#/2);
611 ball_nib_thick = 2.7 darkness;
612 ball_diam = ball_nib_thick + (w - ball_nib_thick) / 10;
613 pointheight = 2 stafflinethickness;
623 penpos1(thick, 2 thick_nibangle);
624 penpos2(thick, thick_nibangle);
626 penpos4(ball_nib_thick, 180-thick_nibangle);
629 swoosh := z1l{curl 0} .. z2l .. z3l{right} .. {down}z4l
630 -- z4r .. z3r{left} .. z2r{down} ;
631 fill swoosh .. (swoosh scaled -1) .. cycle;
635 x5r = x4l - ball_diam /2;
638 penpos5(1.6 ball_diam/2, 100);
639 penpos6(ball_diam/2, 240);
641 ploop := z4l{down} .. z5l .. z6l -- cycle;
643 fill ploop scaled -1;
650 filldraw z7l--z8l{right}--z8r{down}--z7r{right}--cycle;
651 pickup pencircle scaled 2 thin;
652 draw (-x2r,pointheight);
653 draw (x2r,-pointheight);
656 fet_beginchar("Coda", "coda", "coda")
657 save thin, thick, codawidth, codaheight;
658 thin# = 1.2 stafflinethickness#;
659 thick# = 3.5 stafflinethickness#;
660 codawidth# = 2/3 staff_space#;
661 codaheight# = 1 staff_space#;
662 define_pixels(thin, thick, codawidth, codaheight);
664 set_char_box(codawidth#+thick#, codawidth#+thick#,
665 codaheight#+thick#, codaheight#+thick#);
678 halfcoda := z1l{up} .. z2l{right} .. z3l{down} --
679 z3r{up} .. z2r{left} .. z1r{down} .. cycle;
681 fill (halfcoda scaled -1);
683 pickup pencircle scaled thin;
684 draw (0,-h) -- (0,h);
685 draw (-w,0) -- (w,0);
690 save alpha, thick, thin, ht;
692 thin# = 1.2 stafflinethickness#;
693 thick# = 3 stafflinethickness#;
694 ht# = .6staff_space#;
695 define_pixels(thin, thick,ht);
696 set_char_box(0, .5staff_space#, ht#, ht#);
698 penpos1(thick, alpha);
699 penpos2(thick, alpha+90);
700 penpos3(thin, 180-alpha);
701 penpos4(thin, 90-alpha);
708 fill z1l{dir (alpha+90)} .. z2r{dir alpha} .. z1r{dir (alpha-90)} ..
709 z3l{dir (270-alpha)} .. z4l{dir (alpha+180)} ..
710 z3r{dir (90-alpha)} .. cycle;
713 fet_beginchar("Right Comma","rcomma","rcomma");
717 fet_beginchar("Left Comma","lcomma","lcomma");
722 thick#:=1/24designsize;
723 define_blacker_pixels(thick);
725 rthin:=1/8*staff_space;
726 rthick:=2thick+rthin;
731 save ne,nw,se,sw; pair ne,nw,se,sw;
734 se=dir alpha; nw=dir (alpha+180);
735 ne=dir (alpha+90); sw=dir (alpha-90);
736 penpos1(rthin,alpha+90);
737 penpos2(5/4rthick,alpha);
738 penpos4(5/4rthick,alpha);
739 penpos5(rthin,alpha+90);
740 penpos3(3/4rthick,alpha);
742 z1=(width/2, height) - overshoot*se;
743 z2=2[z4,(width/2,height/2)];
748 z5=2[z1,(width/2,height/2)];
750 z7=z4l+1/2rthin*sw+1/2rthin*se;
751 z8=2[z6,(width/2,height/2)];
752 z9=2[z7,(width/2,height/2)];
754 fill z1l{se}..{se}z6..z3l..z7{se}..{se}z5l..z5r{nw}..{nw}z8..z3r..z9{nw}..{nw}z1r.. cycle;
755 penlabels(1,2,3,4,5,6,7,8,9);
758 fet_beginchar("Arpeggio","arpeggio","arpeggio");
759 %draw_staff (-2, 2, 0.0);
760 save height, overshoot, width;
761 height# = staff_space#;
763 overshoot# = 0.25 staff_space#;
764 define_pixels (height,overshoot,width);
765 set_char_box(0, width#, 0, height#);
769 % Extendable Trill symbol.
771 % Rename me to Trill, rename Trill to Tr?
772 fet_beginchar("Trill-element","trill-element","trill-element");
773 save height, overshoot;
774 height# = staff_space#;
776 overshoot# = 0.25 staff_space#;
777 define_pixels (height,overshoot,width);
778 set_char_box(0, height#, 0, width#);
780 currentpicture := currentpicture shifted -(width/2, height/2);
781 currentpicture := currentpicture rotated 90;
782 currentpicture := currentpicture shifted (height/2, width/2);
788 fet_endgroup("scripts");