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@stack.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 interline#;
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")
63 % FIXME: rounded endings
65 % `\accent' is TeX reserved.
66 fet_beginchar("> accent", "sforzato", "sforzatoaccent")
67 set_char_box(.9 interline#, .9 interline#, .5 interline#, .5 interline#);
68 save thickness, diminish;
70 thickness = 3/2 stafflinethickness;
71 pickup pencircle scaled thickness;
73 % prevent blobs at crossing lines
79 y2 = .25 thickness* diminish;
83 z3 = whatever [z1, z4];
85 penpos2(thickness*(2 - diminish)/2 , 90);
86 penpos1(thickness, 90);
87 penpos3(thickness, 90);
90 draw (z1 .. z3) yscaled -1;
93 penstroke (z3e .. z2e) yscaled -1;
99 fet_beginchar("staccato dot", "staccato", "staccato")
101 radius# = 1.5 stafflinethickness#;
102 define_pixels(radius);
103 pickup pencircle scaled 2 radius;
105 set_char_box(radius#, radius#, radius#, radius#);
108 def draw_staccatissimo =
110 height# = .8 interline#;
111 radius# = 2 stafflinethickness#;
112 define_pixels(radius, height);
114 draw_brush((0,0), stafflinethickness, (0, height),2 radius);
115 set_char_box(radius#,radius#, blot_diameter#/2, height# + radius#);
118 fet_beginchar("staccatissimo/martellato up", "ustaccatissimo",
124 % FIXEM: scale labels too.
126 fet_beginchar("staccatissimo/martellato down", "dstaccatissimo", "dstaccatissimo")
131 fet_beginchar("portato/single tenuto", "tenuto", "tenuto")
133 thick# = 1.4 stafflinethickness#;
134 define_pixels(thick);
136 set_char_box(.6 interline#, .6 interline#, thick#/2,thick#/2);
137 pickup pencircle scaled thick;
146 save fat_factor, thinness;
147 set_char_box(interline#/2, interline#/2, 0, 1.1 interline#);
150 thinness = stafflinethickness;
152 pickup pencircle scaled thinness;
160 z1 - z4 = whatever * (charwd, -charht);
161 z4 = fat_factor [z3, z5];
163 filldraw z1 -- z2 -- z3 -- z4 -- cycle;
167 fet_beginchar("marcato up", "umarcato", "umarcato")
174 % The down marcato char (not very much used).
175 % Contrary to what some MF/TeX `gurus' believe
176 % it is *point*-symmetric with the "up" version
177 fet_beginchar("marcato down", "dmarcato", "dmarcato")
183 % used in french horn music todo
185 % TODO: too light at 20pt
186 fet_beginchar("open (unstopped)", "open", "ouvert")
187 save thin, height, width, thick;
188 height# = 5/4 width#;
189 height# = interline#;
190 thin = 1.2 stafflinethickness;
192 set_char_box(width#/2, width#/2, height#/2, height#/2);
199 penstroke z1e{up} .. {left}z2e;
200 addto currentpicture also currentpicture xscaled -1;
201 addto currentpicture also currentpicture yscaled -1;
205 fet_beginchar("plus (stopped)", "stopped", "plusstop")
207 thick = 2 stafflinethickness;
208 size# = 1.1 interline#;
210 set_char_box(size#/2, size#/2, size#/2, size#/2);
211 pickup pencircle scaled thick;
218 draw (z1 .. z2) rotated 90;
224 fet_beginchar("Upbow", "upbow", "upbow")
227 thick = 1.4 stafflinethickness;
228 wd# = 1.3 interline#;
232 set_char_box(wd#/2, wd#/2, 0, ht#);
233 pickup pencircle scaled thick;
241 draw z2 -- z1 -- (z2 xscaled -1);
245 fet_beginchar("Downbow", "downbow", "downbow")
246 save stemthick, beamheight;
250 wd# = 1.5 interline#;
251 stemthick = 1.2 stafflinethickness;
253 set_char_box(wd#/2, wd#/2, 0, 4/3 interline#);
258 pickup pencircle scaled blot_diameter;
259 top y2 - bot y1 = beamheight;
269 filldraw z1 -- z2 -- z3 -- z4 --cycle;
271 pickup pencircle scaled stemthick;
277 labels(1, 2,3,4,5,6);
278 addto currentpicture also currentpicture xscaled -1;
282 % Inspired by a computer-set version of Auf dem Strom by Baerenreiter.
286 save thin, thick, ball_diam, darkness;
287 save wd, ht, thick_nibangle, ball_nib_thick;
291 wd# = 35/16 interline#;
292 ht# = 18/17 interline#;
293 darkness = 1.20 stafflinethickness;
295 set_char_box(wd#/2, wd#/2, ht#/2, ht#/2);
300 ball_nib_thick = 2.7 darkness;
301 ball_diam = ball_nib_thick + (h - ball_nib_thick) / 10;
312 penpos1(1.1 thick, thick_nibangle);
313 penpos2(thick, thick_nibangle);
315 penpos4(ball_nib_thick, -90);
318 swoosh := z1l{curl 0} .. z2l .. z3l{up} .. {left}z4l
319 -- z4r .. z3r{down} .. z2r{left} ;
320 fill swoosh .. (swoosh scaled -1) .. cycle;
323 y5r = y4l - ball_diam /2;
326 penpos5(1.6 ball_diam/2, 10);
327 penpos6(ball_diam/2, 150);
329 ploop := z4l{left} .. z5l .. z6l -- cycle;
331 fill ploop scaled -1;
336 fet_beginchar("Reverse turn","reverseturn","reverseturn")
338 currentpicture := currentpicture yscaled -1;
344 fet_beginchar("Turn","turn","turn")
354 % Inspired by a (by now) PD edition of Durand & C'ie edition of
355 % Saint-Saens' Celloconcerto no. 1
357 % FIXME take out hardcoded vars.
358 % FIXME the two loops on the `t' should be smoother (and the left one bigger).
359 % FIXME generic macros for serifs: top of the t and bottom of r
363 fet_beginchar("Trill (`tr')","trill","trill")
365 save start_nib_angle, ascender_extra, ex, hair_thick, fatness,
366 slant_angle, slant, t_fatness, r_fatness, kerning, t_overshoot,
367 uitschieter, bulb_size;
371 ascender_extra# = 1/2 ex#;
372 ascender# = ascender_extra# + ex#;
373 ex# = 1.5 interline#;
375 start_nib_angle = 20;
377 define_pixels(ex, ascender_extra, ascender, kerning);
379 t_overshoot = 0.03 ex;
381 t_fatness = 8/10 fatness;
382 r_fatness = .75 fatness;
383 uitschieter = 21/40 ex;
384 hair_thick = blot_diameter;
388 local_copy(transform)(currenttransform);
389 currenttransform := currenttransform slanted slant shifted (- interline, 0) ;
394 penpos1(start_nib_wid, start_nib_angle);
397 penpos2(start_nib_wid, start_nib_angle);
399 z3l = (11/10 t_fatness, - t_overshoot);
401 z4l = (13/6 t_fatness, 5/16 ex);
402 penpos4(hair_thick, 180);
404 1.9 [z3l, z3r] = z4r;
408 path t_p, krul_p, r_p;
411 t_p := z1l -- z2l{down} .. tension (1 + .5 slant)
414 .. z4l{up} -- z4r{down}
415 .. z3r{left} .. z2r{up} .. z1r -- cycle;
420 pickup pencircle scaled hair_thick;
422 z5 = (t_fatness/2, 2/3 ex);
424 lft x6 = - uitschieter;
427 z7 = z5 + whatever*dir krul_ang;
430 x7 = 5/10 kerning + x5;
432 penpos7(hair_thick, up_angle + 90);
437 penpos8(2 hair_thick, (up_angle +90)/2);
441 penpos9(r_fatness, 0);
445 penpos10(r_fatness, 0);
447 krul_p := z4{up} .. tension 1.1 .. z5
448 .. tension 1 and .75 .. {down}z6
449 .. tension .85 and 1.1 .. z5 --- z7;
451 r_p := z7l{z7-z5} .. z8l{right} .. z9l{down} --- z10l -- z10r
453 .. z8r{left} .. z7r{z5-z7} -- cycle;
455 set_char_box(interline# , interline#, 0,ascender#);
458 penpos11(1/4 r_fatness, -20);
461 z13 = (x9 + 2 r_fatness, y11 );
462 penpos13(r_fatness, 180);
463 fill z11r{dir 70} .. z13r{down} -- z13l{up} .. z11l{dir 250} -- cycle;
464 penlabels(range 1 thru 15);
467 draw_bulb(-1, z13r, z13l, bulb_size * r_fatness, 1.5);
472 save radius, thickness, wall;
474 radius# := .5 interline#;
476 define_pixels(radius);
477 set_char_box(radius#, radius#, radius#, 2/3 interline#);
479 thickness := 1.5 stafflinethickness;
480 pickup pencircle scaled thickness;
490 draw z1{down} .. z2{down} .. z3{left};
491 addto currentpicture also currentpicture xscaled -1;
496 fet_beginchar("left heel", "upedalheel", "upedalheel")
501 fet_beginchar("right heel", "dpedalheel", "dpedalheel")
509 thickness := 1.5 stafflinethickness;
510 ht# := 1.5 interline#;
512 define_pixels(ht,wd);
515 set_char_box(wd#, wd#, 0, ht#);
517 pickup pencircle scaled thickness;
529 fet_beginchar("left toe", "upedaltoe", "upedaltoe")
533 fet_beginchar("right toe", "dpedaltoe", "dpedaltoe")
538 fet_beginchar("Flageolet", "flageolet", "flageolet")
539 save height,width,thickness;
540 height#=4/15 staffsize#;
542 thickness#=blot_diameter#;
543 define_pixels(height,width,thickness);
544 set_char_box(width#/2,width#/2,height#/2,height#/2);
546 pickup pencircle scaled thickness;
550 rt x4 - lft x2 =width;
557 draw z1..z2..z3..z4..cycle;
562 fet_endgroup("scripts");