2 % feta-schrift.mf -- implement scripts
4 % source file of the Feta (Font-En-Tja) music font
6 % (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
10 fet_begingroup("scripts")
14 save alpha, radius, crook_thinness, crook_fatness, dot_diam;
16 % [Wanske] and some Baerenreiter editions
17 % suggest ca 80 degrees iso half-circle
20 radius# = 1.25 interline#;
21 crook_thinness# = 1.5stafflinethickness#;
22 crook_fatness# = 4 stafflinethickness#;
24 radius# + crook_fatness#/2 = h#;
25 radius# + crook_thinness#/2 = w#;
26 set_char_box(w#, w#, crook_thinness#/2, h#);
28 define_pixels(radius, crook_thinness, crook_fatness);
29 dot_diam = 4/3 crook_fatness;
32 penpos1(crook_thinness, 0);
33 penpos2(crook_fatness, -90);
37 fill z1l{dir (-alpha-90)}..{dir (90-alpha)}z1r..
38 {right}z2r -- z2l{left} .. cycle;
40 addto currentpicture also
41 currentpicture xscaled -1;
43 pickup pencircle scaled dot_diam;
45 bot y4 = - crook_thinness/2;
49 fet_beginchar("fermata up", "ufermata", "ufermata")
54 fet_beginchar("fermata down", "dfermata", "dfermata")
61 % FIXME: rounded endings
63 % `\accent' is TeX reserved.
64 fet_beginchar("> accent", "sforzato", "sforzatoaccent")
65 set_char_box(.9 interline#, .9 interline#, .5 interline#, .5 interline#);
66 save thickness, diminish;
68 thickness = 2 stafflinethickness;
69 pickup pencircle scaled thickness;
71 % prevent blobs at crossing lines
77 y2 = .25 thickness* diminish;
81 z3 = whatever [z1, z4];
83 penpos2(thickness*(2 - diminish)/2 , 90);
84 penpos1(thickness, 90);
85 penpos3(thickness, 90);
88 draw (z1 .. z3) yscaled -1;
91 penstroke (z3e .. z2e) yscaled -1;
97 fet_beginchar("staccato dot", "staccato", "staccato")
99 radius# = 1.5 stafflinethickness#;
100 define_pixels(radius);
101 pickup pencircle scaled 2 radius;
103 set_char_box(radius#, radius#, radius#, radius#);
106 def draw_staccatissimo =
108 height# = .8 interline#;
109 radius# = 2 stafflinethickness#;
110 define_pixels(radius, height);
112 draw_brush((0,0), stafflinethickness, (0, height),2 radius);
113 set_char_box(radius#,radius#, blot_diameter#/2, height# + radius#);
116 fet_beginchar("staccatissimo/martellato up", "ustaccatissimo",
122 % FIXEM: scale labels too.
124 fet_beginchar("staccatissimo/martellato down", "dstaccatissimo", "dstaccatissimo")
129 fet_beginchar("portato/single tenuto", "tenuto", "tenuto")
131 thick# = 1.2 stafflinethickness#;
132 define_pixels(thick);
134 set_char_box(.9 interline#, .9 interline#, thick#/2,thick#/2);
135 pickup pencircle scaled thick;
144 save fat_factor, thinness;
145 set_char_box(interline#/2, interline#/2, 0, 1.1 interline#);
148 thinness = stafflinethickness;
150 pickup pencircle scaled thinness;
158 z1 - z4 = whatever * (charwd, -charht);
159 z4 = fat_factor [z3, z5];
161 filldraw z1 -- z2 -- z3 -- z4 -- cycle;
165 fet_beginchar("marcato up", "umarcato", "umarcato")
172 % The down marcato char (not very much used).
173 % Contrary to what some MF/TeX `gurus' believe
174 % it is *point*-symmetric with the "up" version; (at least [Chlapik] and
175 % and [Wanske] agree with us)
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.
284 fet_beginchar("Turn","turn","turn")
285 save thin, thick, ball_diam, darkness;
286 save wd, ht, thick_nibangle, ball_nib_thick;
290 wd# = 35/16 interline#;
291 ht# = 18/17 interline#;
292 darkness = 1.20 stafflinethickness;
294 set_char_box(wd#/2, wd#/2, ht#/2, ht#/2);
299 ball_nib_thick = 2.7 darkness;
300 ball_diam = ball_nib_thick + (h - ball_nib_thick) / 10;
311 penpos1(1.1 thick, thick_nibangle);
312 penpos2(thick, thick_nibangle);
314 penpos4(ball_nib_thick, -90);
317 swoosh := z1l{curl 0} .. z2l .. z3l{up} .. {left}z4l
318 -- z4r .. z3r{down} .. z2r{left} ;
319 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;
341 % Inspired by a (by now) PD edition of Durand & C'ie edition of
342 % Saint-Saens' Celloconcerto no. 1
344 % FIXME take out hardcoded vars.
345 % FIXME the two loops on the `t' should be smoother (and the left one bigger).
346 % FIXME generic macros for serifs: top of the t and bottom of r
350 fet_beginchar("Trill (`tr')","trill","trill")
352 save start_nib_angle, ascender_extra, ex, hair_thick, fatness,
353 slant_angle, slant, t_fatness, r_fatness, kerning, t_overshoot,
354 uitschieter, bulb_size;
358 ascender_extra# = 1/2 ex#;
359 ascender# = ascender_extra# + ex#;
360 ex# = 1.5 interline#;
362 start_nib_angle = 20;
364 define_pixels(ex, ascender_extra, ascender, kerning);
366 t_overshoot = 0.03 ex;
368 t_fatness = 8/10 fatness;
369 r_fatness = .75 fatness;
370 uitschieter = 21/40 ex;
371 hair_thick = blot_diameter;
375 local_copy(transform)(currenttransform);
376 currenttransform := currenttransform slanted slant;
381 penpos1(start_nib_wid, start_nib_angle);
384 penpos2(start_nib_wid, start_nib_angle);
386 z3l = (11/10 t_fatness, - t_overshoot);
388 z4l = (13/6 t_fatness, 5/16 ex);
389 penpos4(hair_thick, 180);
391 1.9 [z3l, z3r] = z4r;
395 path t_p, krul_p, r_p;
398 t_p := z1l -- z2l{down} .. tension (1 + .5 slant)
401 .. z4l{up} -- z4r{down}
402 .. z3r{left} .. z2r{up} .. z1r -- cycle;
407 pickup pencircle scaled hair_thick;
409 z5 = (t_fatness/2, 2/3 ex);
411 lft x6 = - uitschieter;
414 z7 = z5 + whatever*dir krul_ang;
417 x7 = 5/10 kerning + x5;
419 penpos7(hair_thick, up_angle + 90);
424 penpos8(2 hair_thick, (up_angle +90)/2);
428 penpos9(r_fatness, 0);
432 penpos10(r_fatness, 0);
434 krul_p := z4{up} .. tension 1.1 .. z5
435 .. tension 1 and .75 .. {down}z6
436 .. tension .85 and 1.1 .. z5 --- z7;
438 r_p := z7l{z7-z5} .. z8l{right} .. z9l{down} --- z10l -- z10r
440 .. z8r{left} .. z7r{z5-z7} -- cycle;
442 set_char_box(0,2 interline#, 0,ascender#);
445 penpos11(1/4 r_fatness, -20);
448 z13 = (x9 + 2 r_fatness, y11 );
449 penpos13(r_fatness, 180);
450 fill z11r{dir 70} .. z13r{down} -- z13l{up} .. z11l{dir 250} -- cycle;
451 penlabels(range 1 thru 15);
454 draw_bulb(-1, z13r, z13l, bulb_size * r_fatness, 1.5);
457 fet_beginchar("organ-heel", "pedalheel", "pedalheel")
458 save radius, thickness, wall;
460 radius# := .5 interline#;
462 define_pixels(radius);
463 set_char_box(radius#, radius#, radius#, 2/3 interline#);
465 thickness := 1.5 stafflinethickness;
466 pickup pencircle scaled thickness;
476 draw z1{down} .. z2{down} .. z3{left};
477 addto currentpicture also currentpicture xscaled -1;
481 fet_beginchar("organ-toe", "pedaltoe", "pedaltoe")
484 thickness := 1.5 stafflinethickness;
485 ht# := 1.5 interline#;
487 define_pixels(ht,wd);
490 set_char_box(wd#, wd#, 0, ht#);
492 pickup pencircle scaled thickness;
507 fet_endgroup("scripts");