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")
16 save alpha, radius, crook_thinness, crook_fatness, dot_diam;
18 % [Wanske] and some Baerenreiter editions
19 % suggest ca 80 degrees iso half-circle
22 radius# = 1.25 staff_space#;
23 crook_thinness# = 1.5stafflinethickness#;
24 crook_fatness# = 4 stafflinethickness#;
26 radius# + crook_fatness#/2 = h#;
27 radius# + crook_thinness#/2 = w#;
28 set_char_box(w#, w#, crook_thinness#/2, h#);
30 define_pixels(radius, crook_thinness, crook_fatness);
31 dot_diam = 4/3 crook_fatness;
34 penpos1(crook_thinness, 0);
35 penpos2(crook_fatness, -90);
39 fill z1l{dir (-alpha-90)}..{dir (90-alpha)}z1r..
40 {right}z2r -- z2l{left} .. cycle;
42 addto currentpicture also
43 currentpicture xscaled -1;
45 pickup pencircle scaled dot_diam;
47 bot y4 = - crook_thinness/2;
51 fet_beginchar("fermata up", "ufermata", "ufermata")
56 fet_beginchar("fermata down", "dfermata", "dfermata")
62 % Thumbs are used in cello music.
63 % TODO : thumbs should look like the finger-font and should be placed in
64 % the same way in the score.
67 fet_beginchar("Thumb", "thumb", "thumb")
68 save thin, height, width, thick;
70 height# = staff_space#;
71 thin = 1.2 stafflinethickness;
73 set_char_box(width#/2, width#/2, height#/2, height#/2);
80 penstroke z1e{up} .. {left}z2e;
81 addto currentpicture also currentpicture xscaled -1;
82 addto currentpicture also currentpicture yscaled -1;
87 draw_brush(z3,1.4*thin, z4,0.9*thick);
91 % FIXME: rounded endings
93 % `\accent' is TeX reserved.
94 fet_beginchar("> accent", "sforzato", "sforzatoaccent")
95 set_char_box(.9 staff_space#, .9 staff_space#, .5 staff_space#, .5 staff_space#);
96 save thickness, diminish;
98 thickness = 3/2 stafflinethickness;
99 pickup pencircle scaled thickness;
101 % prevent blobs at crossing lines
107 y2 = .25 thickness* diminish;
111 z3 = whatever [z1, z4];
113 penpos2(thickness*(2 - diminish)/2 , 90);
114 penpos1(thickness, 90);
115 penpos3(thickness, 90);
118 draw (z1 .. z3) yscaled -1;
120 penstroke z3e .. z2e;
121 penstroke (z3e .. z2e) yscaled -1;
127 fet_beginchar("staccato dot", "staccato", "staccato")
129 radius# = 1.5 stafflinethickness#;
130 define_pixels(radius);
131 pickup pencircle scaled 2 radius;
133 set_char_box(radius#, radius#, radius#, radius#);
136 def draw_staccatissimo =
138 height# = .8 staff_space#;
139 radius# = 2 stafflinethickness#;
140 define_pixels(radius, height);
142 draw_brush((0,0), stafflinethickness, (0, height),2 radius);
143 set_char_box(radius#,radius#, blot_diameter#/2, height# + radius#);
146 fet_beginchar("staccatissimo/martellato up", "ustaccatissimo",
152 % FIXEM: scale labels too.
154 fet_beginchar("staccatissimo/martellato down", "dstaccatissimo", "dstaccatissimo")
159 fet_beginchar("portato/single tenuto", "tenuto", "tenuto")
161 thick# = 1.4 stafflinethickness#;
162 define_pixels(thick);
164 set_char_box(.6 staff_space#, .6 staff_space#, thick#/2,thick#/2);
165 pickup pencircle scaled thick;
174 save fat_factor, thinness;
175 set_char_box(staff_space#/2, staff_space#/2, 0, 1.1 staff_space#);
178 thinness = stafflinethickness;
180 pickup pencircle scaled thinness;
188 z1 - z4 = whatever * (charwd, -charht);
189 z4 = fat_factor [z3, z5];
191 filldraw z1 -- z2 -- z3 -- z4 -- cycle;
195 fet_beginchar("marcato up", "umarcato", "umarcato")
202 % The down marcato char (not very much used).
203 % Contrary to what some MF/TeX `gurus' believe
204 % it is *point*-symmetric with the "up" version
205 fet_beginchar("marcato down", "dmarcato", "dmarcato")
212 % used in french horn music todo
214 % TODO: too light at 20pt
215 fet_beginchar("open (unstopped)", "open", "ouvert")
216 save thin, height, width, thick;
217 height# = 5/4 width#;
218 height# = staff_space#;
219 thin = 1.2 stafflinethickness;
221 set_char_box(width#/2, width#/2, height#/2, height#/2);
228 penstroke z1e{up} .. {left}z2e;
229 addto currentpicture also currentpicture xscaled -1;
230 addto currentpicture also currentpicture yscaled -1;
234 fet_beginchar("plus (stopped)", "stopped", "plusstop")
236 thick = 2 stafflinethickness;
237 size# = 1.1 staff_space#;
239 set_char_box(size#/2, size#/2, size#/2, size#/2);
240 pickup pencircle scaled thick;
247 draw (z1 .. z2) rotated 90;
253 fet_beginchar("Upbow", "upbow", "upbow")
256 thick = 1.4 stafflinethickness;
257 wd# = 1.3 staff_space#;
261 set_char_box(wd#/2, wd#/2, 0, ht#);
262 pickup pencircle scaled thick;
270 draw z2 -- z1 -- (z2 xscaled -1);
274 fet_beginchar("Downbow", "downbow", "downbow")
275 save stemthick, beamheight;
279 wd# = 1.5 staff_space#;
280 stemthick = 1.2 stafflinethickness;
282 set_char_box(wd#/2, wd#/2, 0, 4/3 staff_space#);
287 pickup pencircle scaled blot_diameter;
288 top y2 - bot y1 = beamheight;
298 filldraw z1 -- z2 -- z3 -- z4 --cycle;
300 pickup pencircle scaled stemthick;
306 labels(1, 2,3,4,5,6);
307 addto currentpicture also currentpicture xscaled -1;
311 % Inspired by a computer-set version of Auf dem Strom by Baerenreiter.
315 save thin, thick, ball_diam, darkness;
316 save wd, ht, thick_nibangle, ball_nib_thick;
320 wd# = 35/16 staff_space#;
321 ht# = 18/17 staff_space#;
322 darkness = 1.20 stafflinethickness;
324 set_char_box(wd#/2, wd#/2, ht#/2, ht#/2);
329 ball_nib_thick = 2.7 darkness;
330 ball_diam = ball_nib_thick + (h - ball_nib_thick) / 10;
341 penpos1(1.1 thick, thick_nibangle);
342 penpos2(thick, thick_nibangle);
344 penpos4(ball_nib_thick, -90);
347 swoosh := z1l{curl 0} .. z2l .. z3l{up} .. {left}z4l
348 -- z4r .. z3r{down} .. z2r{left} ;
349 fill swoosh .. (swoosh scaled -1) .. cycle;
352 y5r = y4l - ball_diam /2;
355 penpos5(1.6 ball_diam/2, 10);
356 penpos6(ball_diam/2, 150);
358 ploop := z4l{left} .. z5l .. z6l -- cycle;
360 fill ploop scaled -1;
365 fet_beginchar("Reverse turn","reverseturn","reverseturn")
367 currentpicture := currentpicture yscaled -1;
373 fet_beginchar("Turn","turn","turn")
383 % Inspired by a (by now) PD edition of Durand & C'ie edition of
384 % Saint-Saens' Celloconcerto no. 1
386 % FIXME take out hardcoded vars.
387 % FIXME the two loops on the `t' should be smoother (and the left one bigger).
388 % FIXME generic macros for serifs: top of the t and bottom of r
392 fet_beginchar("Trill (`tr')","trill","trill")
394 save start_nib_angle, ascender_extra, ex, hair_thick, fatness,
395 slant_angle, slant, t_fatness, r_fatness, kerning, t_overshoot,
396 uitschieter, bulb_size;
400 ascender_extra# = 1/2 ex#;
401 ascender# = ascender_extra# + ex#;
402 ex# = 1.5 staff_space#;
404 start_nib_angle = 20;
406 define_pixels(ex, ascender_extra, ascender, kerning);
408 t_overshoot = 0.03 ex;
410 t_fatness = 8/10 fatness;
411 r_fatness = .75 fatness;
412 uitschieter = 21/40 ex;
413 hair_thick = blot_diameter;
417 local_copy(transform)(currenttransform);
418 currenttransform := currenttransform slanted slant shifted (- staff_space, 0) ;
423 penpos1(start_nib_wid, start_nib_angle);
426 penpos2(start_nib_wid, start_nib_angle);
428 z3l = (11/10 t_fatness, - t_overshoot);
430 z4l = (13/6 t_fatness, 5/16 ex);
431 penpos4(hair_thick, 180);
433 1.9 [z3l, z3r] = z4r;
437 path t_p, krul_p, r_p;
440 t_p := z1l -- z2l{down} .. tension (1 + .5 slant)
443 .. z4l{up} -- z4r{down}
444 .. z3r{left} .. z2r{up} .. z1r -- cycle;
449 pickup pencircle scaled hair_thick;
451 z5 = (t_fatness/2, 2/3 ex);
453 lft x6 = - uitschieter;
456 z7 = z5 + whatever*dir krul_ang;
459 x7 = 5/10 kerning + x5;
461 penpos7(hair_thick, up_angle + 90);
466 penpos8(2 hair_thick, (up_angle +90)/2);
470 penpos9(r_fatness, 0);
474 penpos10(r_fatness, 0);
476 krul_p := z4{up} .. tension 1.1 .. z5
477 .. tension 1 and .75 .. {down}z6
478 .. tension .85 and 1.1 .. z5 --- z7;
480 r_p := z7l{z7-z5} .. z8l{right} .. z9l{down} --- z10l -- z10r
482 .. z8r{left} .. z7r{z5-z7} -- cycle;
484 set_char_box(staff_space# , staff_space#, 0,ascender#);
487 penpos11(1/4 r_fatness, -20);
490 z13 = (x9 + 2 r_fatness, y11 );
491 penpos13(r_fatness, 180);
492 fill z11r{dir 70} .. z13r{down} -- z13l{up} .. z11l{dir 250} -- cycle;
493 penlabels(range 1 thru 15);
496 draw_bulb(-1, z13r, z13l, bulb_size * r_fatness, 1.5);
501 save radius, thickness, wall;
503 radius# := .5 staff_space#;
505 define_pixels(radius);
506 set_char_box(radius#, radius#, radius#, 2/3 staff_space#);
508 thickness := 1.5 stafflinethickness;
509 pickup pencircle scaled thickness;
519 draw z1{down} .. z2{down} .. z3{left};
520 addto currentpicture also currentpicture xscaled -1;
525 fet_beginchar("left heel", "upedalheel", "upedalheel")
530 fet_beginchar("right heel", "dpedalheel", "dpedalheel")
538 thickness := 1.5 stafflinethickness;
539 ht# := 1.5 staff_space#;
541 define_pixels(ht,wd);
544 set_char_box(wd#, wd#, 0, ht#);
546 pickup pencircle scaled thickness;
558 fet_beginchar("left toe", "upedaltoe", "upedaltoe")
562 fet_beginchar("right toe", "dpedaltoe", "dpedaltoe")
567 fet_beginchar("Flageolet", "flageolet", "flageolet")
568 save height,width,thickness;
569 height#=4/15 staffsize#;
571 thickness#=blot_diameter#;
572 define_pixels(height,width,thickness);
573 set_char_box(width#/2,width#/2,height#/2,height#/2);
575 pickup pencircle scaled thickness;
579 rt x4 - lft x2 =width;
586 draw z1..z2..z3..z4..cycle;
589 fet_beginchar("Repeatsign", "repeatsign", "repeatsign")
590 set_char_box(staff_space#, staff_space#, staff_space#, staff_space#);
593 2 dot_diam# = staff_space# - stafflinethickness#;
594 define_pixels(dot_diam);
600 filldraw z1l--z2l{right}--z2r{down}--z1r{right}--cycle;
603 pickup pencircle scaled dot_diam;
604 draw (-staff_space/2, staff_space/2);
605 draw (staff_space/2, -staff_space/2);
608 fet_beginchar("Segno", "segno", "segno")
609 save thin, thick, ball_diam, darkness, pointheight;
610 save wd, ht, thick_nibangle, ball_nib_thick;
614 ht# = 3 staff_space#;
615 wd# = 2 staff_space#;
616 darkness = 1.20 stafflinethickness;
618 set_char_box(wd#/2, wd#/2, ht#/2, ht#/2);
623 ball_nib_thick = 2.7 darkness;
624 ball_diam = ball_nib_thick + (w - ball_nib_thick) / 10;
625 pointheight = 2 stafflinethickness;
635 penpos1(thick, 2 thick_nibangle);
636 penpos2(thick, thick_nibangle);
638 penpos4(ball_nib_thick, 180-thick_nibangle);
641 swoosh := z1l{curl 0} .. z2l .. z3l{right} .. {down}z4l
642 -- z4r .. z3r{left} .. z2r{down} ;
643 fill swoosh .. (swoosh scaled -1) .. cycle;
647 x5r = x4l - ball_diam /2;
650 penpos5(1.6 ball_diam/2, 100);
651 penpos6(ball_diam/2, 240);
653 ploop := z4l{down} .. z5l .. z6l -- cycle;
655 fill ploop scaled -1;
662 filldraw z7l--z8l{right}--z8r{down}--z7r{right}--cycle;
663 pickup pencircle scaled 2 thin;
664 draw (-x2r,pointheight);
665 draw (x2r,-pointheight);
668 fet_beginchar("Coda", "coda", "coda")
669 save thin, thick, codawidth, codaheight;
670 thin# = 1.2 stafflinethickness#;
671 thick# = 3.5 stafflinethickness#;
672 codawidth# = 2/3 staff_space#;
673 codaheight# = 1 staff_space#;
674 define_pixels(thin, thick, codawidth, codaheight);
676 set_char_box(codawidth#+thick#, codawidth#+thick#,
677 codaheight#+thick#, codaheight#+thick#);
690 halfcoda := z1l{up} .. z2l{right} .. z3l{down} --
691 z3r{up} .. z2r{left} .. z1r{down} .. cycle;
693 fill (halfcoda scaled -1);
695 pickup pencircle scaled thin;
696 draw (0,-h) -- (0,h);
697 draw (-w,0) -- (w,0);
702 input feta-accordion;
704 fet_endgroup("scripts");