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 fet_beginchar("staccato dot", "staccato", "staccato")
128 radius# = 1.5 stafflinethickness#;
129 define_pixels(radius);
130 pickup pencircle scaled 2 radius;
132 set_char_box(radius#, radius#, radius#, radius#);
135 def draw_staccatissimo =
137 height# = .8 staff_space#;
138 radius# = 2 stafflinethickness#;
139 define_pixels(radius, height);
141 draw_brush((0,0), stafflinethickness, (0, height),2 radius);
142 set_char_box(radius#,radius#, blot_diameter#/2, height# + radius#);
145 fet_beginchar("staccatissimo/martellato up", "ustaccatissimo",
151 % FIXEM: scale labels too.
153 fet_beginchar("staccatissimo/martellato down", "dstaccatissimo", "dstaccatissimo")
158 fet_beginchar("portato/single tenuto", "tenuto", "tenuto")
160 thick# = 1.4 stafflinethickness#;
161 define_pixels(thick);
163 set_char_box(.6 staff_space#, .6 staff_space#, thick#/2,thick#/2);
164 pickup pencircle scaled thick;
173 save fat_factor, thinness;
174 set_char_box(staff_space#/2, staff_space#/2, 0, 1.1 staff_space#);
177 thinness = stafflinethickness;
179 pickup pencircle scaled thinness;
187 z1 - z4 = whatever * (charwd, -charht);
188 z4 = fat_factor [z3, z5];
190 filldraw z1 -- z2 -- z3 -- z4 -- cycle;
194 fet_beginchar("marcato up", "umarcato", "umarcato")
201 % The down marcato char (not very much used).
202 % Contrary to what some MF/TeX `gurus' believe
203 % it is *point*-symmetric with the "up" version
204 fet_beginchar("marcato down", "dmarcato", "dmarcato")
211 % used in french horn music todo
213 % TODO: too light at 20pt
214 fet_beginchar("open (unstopped)", "open", "ouvert")
215 save thin, height, width, thick;
216 height# = 5/4 width#;
217 height# = staff_space#;
218 thin = 1.2 stafflinethickness;
220 set_char_box(width#/2, width#/2, height#/2, height#/2);
227 penstroke z1e{up} .. {left}z2e;
228 addto currentpicture also currentpicture xscaled -1;
229 addto currentpicture also currentpicture yscaled -1;
233 fet_beginchar("plus (stopped)", "stopped", "plusstop")
235 thick = 2 stafflinethickness;
236 size# = 1.1 staff_space#;
238 set_char_box(size#/2, size#/2, size#/2, size#/2);
239 pickup pencircle scaled thick;
246 draw (z1 .. z2) rotated 90;
252 fet_beginchar("Upbow", "upbow", "upbow")
255 thick = 1.4 stafflinethickness;
256 wd# = 1.3 staff_space#;
260 set_char_box(wd#/2, wd#/2, 0, ht#);
261 pickup pencircle scaled thick;
269 draw z2 -- z1 -- (z2 xscaled -1);
273 fet_beginchar("Downbow", "downbow", "downbow")
274 save stemthick, beamheight;
278 wd# = 1.5 staff_space#;
279 stemthick = 1.2 stafflinethickness;
281 set_char_box(wd#/2, wd#/2, 0, 4/3 staff_space#);
286 pickup pencircle scaled blot_diameter;
287 top y2 - bot y1 = beamheight;
297 filldraw z1 -- z2 -- z3 -- z4 --cycle;
299 pickup pencircle scaled stemthick;
305 labels(1, 2,3,4,5,6);
306 addto currentpicture also currentpicture xscaled -1;
310 % Inspired by a computer-set version of Auf dem Strom by Baerenreiter.
314 save thin, thick, ball_diam, darkness;
315 save wd, ht, thick_nibangle, ball_nib_thick;
319 wd# = 35/16 staff_space#;
320 ht# = 18/17 staff_space#;
321 darkness = 1.20 stafflinethickness;
323 set_char_box(wd#/2, wd#/2, ht#/2, ht#/2);
328 ball_nib_thick = 2.7 darkness;
329 ball_diam = ball_nib_thick + (h - ball_nib_thick) / 10;
340 penpos1(1.1 thick, thick_nibangle);
341 penpos2(thick, thick_nibangle);
343 penpos4(ball_nib_thick, -90);
346 swoosh := z1l{curl 0} .. z2l .. z3l{up} .. {left}z4l
347 -- z4r .. z3r{down} .. z2r{left} ;
348 fill swoosh .. (swoosh scaled -1) .. cycle;
351 y5r = y4l - ball_diam /2;
354 penpos5(1.6 ball_diam/2, 10);
355 penpos6(ball_diam/2, 150);
357 ploop := z4l{left} .. z5l .. z6l -- cycle;
359 fill ploop scaled -1;
364 fet_beginchar("Reverse turn","reverseturn","reverseturn")
366 currentpicture := currentpicture yscaled -1;
372 fet_beginchar("Turn","turn","turn")
382 % Inspired by a (by now) PD edition of Durand & C'ie edition of
383 % Saint-Saens' Celloconcerto no. 1
385 % FIXME take out hardcoded vars.
386 % FIXME the two loops on the `t' should be smoother (and the left one bigger).
387 % FIXME generic macros for serifs: top of the t and bottom of r
391 fet_beginchar("Trill (`tr')","trill","trill")
393 save start_nib_angle, ascender_extra, ex, hair_thick, fatness,
394 slant_angle, slant, t_fatness, r_fatness, kerning, t_overshoot,
395 uitschieter, bulb_size;
399 ascender_extra# = 1/2 ex#;
400 ascender# = ascender_extra# + ex#;
401 ex# = 1.5 staff_space#;
403 start_nib_angle = 20;
405 define_pixels(ex, ascender_extra, ascender, kerning);
407 t_overshoot = 0.03 ex;
409 t_fatness = 8/10 fatness;
410 r_fatness = .75 fatness;
411 uitschieter = 21/40 ex;
412 hair_thick = blot_diameter;
416 local_copy(transform)(currenttransform);
417 currenttransform := currenttransform slanted slant shifted (- staff_space, 0) ;
422 penpos1(start_nib_wid, start_nib_angle);
425 penpos2(start_nib_wid, start_nib_angle);
427 z3l = (11/10 t_fatness, - t_overshoot);
429 z4l = (13/6 t_fatness, 5/16 ex);
430 penpos4(hair_thick, 180);
432 1.9 [z3l, z3r] = z4r;
436 path t_p, krul_p, r_p;
439 t_p := z1l -- z2l{down} .. tension (1 + .5 slant)
442 .. z4l{up} -- z4r{down}
443 .. z3r{left} .. z2r{up} .. z1r -- cycle;
448 pickup pencircle scaled hair_thick;
450 z5 = (t_fatness/2, 2/3 ex);
452 lft x6 = - uitschieter;
455 z7 = z5 + whatever*dir krul_ang;
458 x7 = 5/10 kerning + x5;
460 penpos7(hair_thick, up_angle + 90);
465 penpos8(2 hair_thick, (up_angle +90)/2);
469 penpos9(r_fatness, 0);
473 penpos10(r_fatness, 0);
475 krul_p := z4{up} .. tension 1.1 .. z5
476 .. tension 1 and .75 .. {down}z6
477 .. tension .85 and 1.1 .. z5 --- z7;
479 r_p := z7l{z7-z5} .. z8l{right} .. z9l{down} --- z10l -- z10r
481 .. z8r{left} .. z7r{z5-z7} -- cycle;
483 set_char_box(staff_space# , staff_space#, 0,ascender#);
486 penpos11(1/4 r_fatness, -20);
489 z13 = (x9 + 2 r_fatness, y11 );
490 penpos13(r_fatness, 180);
491 fill z11r{dir 70} .. z13r{down} -- z13l{up} .. z11l{dir 250} -- cycle;
492 penlabels(range 1 thru 15);
495 draw_bulb(-1, z13r, z13l, bulb_size * r_fatness, 1.5);
500 save radius, thickness, wall;
502 radius# := .5 staff_space#;
504 define_pixels(radius);
505 set_char_box(radius#, radius#, radius#, 2/3 staff_space#);
507 thickness := 1.5 stafflinethickness;
508 pickup pencircle scaled thickness;
518 draw z1{down} .. z2{down} .. z3{left};
519 addto currentpicture also currentpicture xscaled -1;
524 fet_beginchar("left heel", "upedalheel", "upedalheel")
529 fet_beginchar("right heel", "dpedalheel", "dpedalheel")
537 thickness := 1.5 stafflinethickness;
538 ht# := 1.5 staff_space#;
540 define_pixels(ht,wd);
543 set_char_box(wd#, wd#, 0, ht#);
545 pickup pencircle scaled thickness;
557 fet_beginchar("left toe", "upedaltoe", "upedaltoe")
561 fet_beginchar("right toe", "dpedaltoe", "dpedaltoe")
566 fet_beginchar("Flageolet", "flageolet", "flageolet")
567 save height,width,thickness;
568 height#=4/15 staffsize#;
570 thickness#=blot_diameter#;
571 define_pixels(height,width,thickness);
572 set_char_box(width#/2,width#/2,height#/2,height#/2);
574 pickup pencircle scaled thickness;
578 rt x4 - lft x2 =width;
585 draw z1..z2..z3..z4..cycle;
588 fet_beginchar("Repeatsign", "repeatsign", "repeatsign")
589 set_char_box(staff_space#, staff_space#, staff_space#, staff_space#);
592 2 dot_diam# = staff_space# - stafflinethickness#;
593 define_pixels(dot_diam);
599 filldraw z1l--z2l{right}--z2r{down}--z1r{right}--cycle;
602 pickup pencircle scaled dot_diam;
603 draw (-staff_space/2, staff_space/2);
604 draw (staff_space/2, -staff_space/2);
607 fet_beginchar("Segno", "segno", "segno")
608 save thin, thick, ball_diam, darkness, pointheight;
609 save wd, ht, thick_nibangle, ball_nib_thick;
613 ht# = 3 staff_space#;
614 wd# = 2 staff_space#;
615 darkness = 1.20 stafflinethickness;
617 set_char_box(wd#/2, wd#/2, ht#/2, ht#/2);
622 ball_nib_thick = 2.7 darkness;
623 ball_diam = ball_nib_thick + (w - ball_nib_thick) / 10;
624 pointheight = 2 stafflinethickness;
634 penpos1(thick, 2 thick_nibangle);
635 penpos2(thick, thick_nibangle);
637 penpos4(ball_nib_thick, 180-thick_nibangle);
640 swoosh := z1l{curl 0} .. z2l .. z3l{right} .. {down}z4l
641 -- z4r .. z3r{left} .. z2r{down} ;
642 fill swoosh .. (swoosh scaled -1) .. cycle;
646 x5r = x4l - ball_diam /2;
649 penpos5(1.6 ball_diam/2, 100);
650 penpos6(ball_diam/2, 240);
652 ploop := z4l{down} .. z5l .. z6l -- cycle;
654 fill ploop scaled -1;
661 filldraw z7l--z8l{right}--z8r{down}--z7r{right}--cycle;
662 pickup pencircle scaled 2 thin;
663 draw (-x2r,pointheight);
664 draw (x2r,-pointheight);
667 fet_beginchar("Coda", "coda", "coda")
668 save thin, thick, codawidth, codaheight;
669 thin# = 1.2 stafflinethickness#;
670 thick# = 3.5 stafflinethickness#;
671 codawidth# = 2/3 staff_space#;
672 codaheight# = 1 staff_space#;
673 define_pixels(thin, thick, codawidth, codaheight);
675 set_char_box(codawidth#+thick#, codawidth#+thick#,
676 codaheight#+thick#, codaheight#+thick#);
689 halfcoda := z1l{up} .. z2l{right} .. z3l{down} --
690 z3r{up} .. z2r{left} .. z1r{down} .. cycle;
692 fill (halfcoda scaled -1);
694 pickup pencircle scaled thin;
695 draw (0,-h) -- (0,h);
696 draw (-w,0) -- (w,0);
700 thick#:=1/24designsize;
701 define_blacker_pixels(thick);
703 rthin:=1/8*staff_space;
704 rthick:=2thick+rthin;
709 save ne,nw,se,sw; pair ne,nw,se,sw;
712 se=dir alpha; nw=dir (alpha+180);
713 ne=dir (alpha+90); sw=dir (alpha-90);
714 penpos1(rthin,alpha+90);
715 penpos2(5/4rthick,alpha);
716 penpos4(5/4rthick,alpha);
717 penpos5(rthin,alpha+90);
718 penpos3(3/4rthick,alpha);
720 z1=(width/2, height) - overshoot*se;
721 z2=2[z4,(width/2,height/2)];
726 z5=2[z1,(width/2,height/2)];
728 z7=z4l+1/2rthin*sw+1/2rthin*se;
729 z8=2[z6,(width/2,height/2)];
730 z9=2[z7,(width/2,height/2)];
732 fill z1l{se}..{se}z6..z3l..z7{se}..{se}z5l..z5r{nw}..{nw}z8..z3r..z9{nw}..{nw}z1r.. cycle;
733 penlabels(1,2,3,4,5,6,7,8,9);
736 fet_beginchar("Arpeggio","arpeggio","arpeggio");
737 %draw_staff (-2, 2, 0.0);
738 save height, overshoot, width;
739 height# = staff_space#;
741 overshoot# = 0.25 staff_space#;
742 define_pixels (height,overshoot,width);
743 set_char_box(0, width#, 0, height#);
747 % Extendable Trill symbol.
749 % Rename me to Trill, rename Trill to Tr?
750 fet_beginchar("Trill-element","trill-element","trill-element");
751 save height, overshoot;
752 height# = staff_space#;
754 overshoot# = 0.25 staff_space#;
755 define_pixels (height,overshoot,width);
756 set_char_box(0, height#, 0, width#);
758 currentpicture := currentpicture shifted -(width/2, height/2);
759 currentpicture := currentpicture rotated 90;
760 currentpicture := currentpicture shifted (height/2, width/2);
766 fet_endgroup("scripts");