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>
7 % Jan Nieuwenhuizen <jan@digicash.com>
11 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 interline#;
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")
62 % FIXME: rounded endings
64 % `\accent' is TeX reserved.
65 fet_beginchar("> accent", "sforzato", "sforzatoaccent")
66 set_char_box(.9 interline#, .9 interline#, .5 interline#, .5 interline#);
67 save thickness, diminish;
69 thickness = 3/2 stafflinethickness;
70 pickup pencircle scaled thickness;
72 % prevent blobs at crossing lines
78 y2 = .25 thickness* diminish;
82 z3 = whatever [z1, z4];
84 penpos2(thickness*(2 - diminish)/2 , 90);
85 penpos1(thickness, 90);
86 penpos3(thickness, 90);
89 draw (z1 .. z3) yscaled -1;
92 penstroke (z3e .. z2e) yscaled -1;
98 fet_beginchar("staccato dot", "staccato", "staccato")
100 radius# = 1.5 stafflinethickness#;
101 define_pixels(radius);
102 pickup pencircle scaled 2 radius;
104 set_char_box(radius#, radius#, radius#, radius#);
107 def draw_staccatissimo =
109 height# = .8 interline#;
110 radius# = 2 stafflinethickness#;
111 define_pixels(radius, height);
113 draw_brush((0,0), stafflinethickness, (0, height),2 radius);
114 set_char_box(radius#,radius#, blot_diameter#/2, height# + radius#);
117 fet_beginchar("staccatissimo/martellato up", "ustaccatissimo",
123 % FIXEM: scale labels too.
125 fet_beginchar("staccatissimo/martellato down", "dstaccatissimo", "dstaccatissimo")
130 fet_beginchar("portato/single tenuto", "tenuto", "tenuto")
132 thick# = 1.2 stafflinethickness#;
133 define_pixels(thick);
135 set_char_box(.9 interline#, .9 interline#, thick#/2,thick#/2);
136 pickup pencircle scaled thick;
145 save fat_factor, thinness;
146 set_char_box(interline#/2, interline#/2, 0, 1.1 interline#);
149 thinness = stafflinethickness;
151 pickup pencircle scaled thinness;
159 z1 - z4 = whatever * (charwd, -charht);
160 z4 = fat_factor [z3, z5];
162 filldraw z1 -- z2 -- z3 -- z4 -- cycle;
166 fet_beginchar("marcato up", "umarcato", "umarcato")
173 % The down marcato char (not very much used).
174 % Contrary to what some MF/TeX `gurus' believe
175 % it is *point*-symmetric with the "up" version
176 fet_beginchar("marcato down", "dmarcato", "dmarcato")
182 % used in french horn music todo
184 % TODO: too light at 20pt
185 fet_beginchar("open (unstopped)", "open", "ouvert")
186 save thin, height, width, thick;
187 height# = 5/4 width#;
188 height# = interline#;
189 thin = 1.2 stafflinethickness;
191 set_char_box(width#/2, width#/2, height#/2, height#/2);
198 penstroke z1e{up} .. {left}z2e;
199 addto currentpicture also currentpicture xscaled -1;
200 addto currentpicture also currentpicture yscaled -1;
204 fet_beginchar("plus (stopped)", "stopped", "plusstop")
206 thick = 2 stafflinethickness;
207 size# = 1.1 interline#;
209 set_char_box(size#/2, size#/2, size#/2, size#/2);
210 pickup pencircle scaled thick;
217 draw (z1 .. z2) rotated 90;
223 fet_beginchar("Upbow", "upbow", "upbow")
226 thick = 1.4 stafflinethickness;
227 wd# = 1.3 interline#;
231 set_char_box(wd#/2, wd#/2, 0, ht#);
232 pickup pencircle scaled thick;
240 draw z2 -- z1 -- (z2 xscaled -1);
244 fet_beginchar("Downbow", "downbow", "downbow")
245 save stemthick, beamheight;
249 wd# = 1.5 interline#;
250 stemthick = 1.2 stafflinethickness;
252 set_char_box(wd#/2, wd#/2, 0, 4/3 interline#);
257 pickup pencircle scaled blot_diameter;
258 top y2 - bot y1 = beamheight;
268 filldraw z1 -- z2 -- z3 -- z4 --cycle;
270 pickup pencircle scaled stemthick;
276 labels(1, 2,3,4,5,6);
277 addto currentpicture also currentpicture xscaled -1;
281 % Inspired by a computer-set version of Auf dem Strom by Baerenreiter.
283 fet_beginchar("Turn","turn","turn")
284 save thin, thick, ball_diam, darkness;
285 save wd, ht, thick_nibangle, ball_nib_thick;
289 wd# = 35/16 interline#;
290 ht# = 18/17 interline#;
291 darkness = 1.20 stafflinethickness;
293 set_char_box(wd#/2, wd#/2, ht#/2, ht#/2);
298 ball_nib_thick = 2.7 darkness;
299 ball_diam = ball_nib_thick + (h - ball_nib_thick) / 10;
310 penpos1(1.1 thick, thick_nibangle);
311 penpos2(thick, thick_nibangle);
313 penpos4(ball_nib_thick, -90);
316 swoosh := z1l{curl 0} .. z2l .. z3l{up} .. {left}z4l
317 -- z4r .. z3r{down} .. z2r{left} ;
318 fill swoosh .. (swoosh scaled -1) .. cycle;
322 y5r = y4l - ball_diam /2;
325 penpos5(1.6 ball_diam/2, 10);
326 penpos6(ball_diam/2, 150);
328 ploop := z4l{left} .. z5l .. z6l -- cycle;
330 fill ploop scaled -1;
340 % Inspired by a (by now) PD edition of Durand & C'ie edition of
341 % Saint-Saens' Celloconcerto no. 1
343 % FIXME take out hardcoded vars.
344 % FIXME the two loops on the `t' should be smoother (and the left one bigger).
345 % FIXME generic macros for serifs: top of the t and bottom of r
349 fet_beginchar("Trill (`tr')","trill","trill")
351 save start_nib_angle, ascender_extra, ex, hair_thick, fatness,
352 slant_angle, slant, t_fatness, r_fatness, kerning, t_overshoot,
353 uitschieter, bulb_size;
357 ascender_extra# = 1/2 ex#;
358 ascender# = ascender_extra# + ex#;
359 ex# = 1.5 interline#;
361 start_nib_angle = 20;
363 define_pixels(ex, ascender_extra, ascender, kerning);
365 t_overshoot = 0.03 ex;
367 t_fatness = 8/10 fatness;
368 r_fatness = .75 fatness;
369 uitschieter = 21/40 ex;
370 hair_thick = blot_diameter;
374 local_copy(transform)(currenttransform);
375 currenttransform := currenttransform slanted slant shifted (- interline, 0) ;
380 penpos1(start_nib_wid, start_nib_angle);
383 penpos2(start_nib_wid, start_nib_angle);
385 z3l = (11/10 t_fatness, - t_overshoot);
387 z4l = (13/6 t_fatness, 5/16 ex);
388 penpos4(hair_thick, 180);
390 1.9 [z3l, z3r] = z4r;
394 path t_p, krul_p, r_p;
397 t_p := z1l -- z2l{down} .. tension (1 + .5 slant)
400 .. z4l{up} -- z4r{down}
401 .. z3r{left} .. z2r{up} .. z1r -- cycle;
406 pickup pencircle scaled hair_thick;
408 z5 = (t_fatness/2, 2/3 ex);
410 lft x6 = - uitschieter;
413 z7 = z5 + whatever*dir krul_ang;
416 x7 = 5/10 kerning + x5;
418 penpos7(hair_thick, up_angle + 90);
423 penpos8(2 hair_thick, (up_angle +90)/2);
427 penpos9(r_fatness, 0);
431 penpos10(r_fatness, 0);
433 krul_p := z4{up} .. tension 1.1 .. z5
434 .. tension 1 and .75 .. {down}z6
435 .. tension .85 and 1.1 .. z5 --- z7;
437 r_p := z7l{z7-z5} .. z8l{right} .. z9l{down} --- z10l -- z10r
439 .. z8r{left} .. z7r{z5-z7} -- cycle;
441 set_char_box(interline# , interline#, 0,ascender#);
444 penpos11(1/4 r_fatness, -20);
447 z13 = (x9 + 2 r_fatness, y11 );
448 penpos13(r_fatness, 180);
449 fill z11r{dir 70} .. z13r{down} -- z13l{up} .. z11l{dir 250} -- cycle;
450 penlabels(range 1 thru 15);
453 draw_bulb(-1, z13r, z13l, bulb_size * r_fatness, 1.5);
456 fet_beginchar("organ-heel", "pedalheel", "pedalheel")
457 save radius, thickness, wall;
459 radius# := .5 interline#;
461 define_pixels(radius);
462 set_char_box(radius#, radius#, radius#, 2/3 interline#);
464 thickness := 1.5 stafflinethickness;
465 pickup pencircle scaled thickness;
475 draw z1{down} .. z2{down} .. z3{left};
476 addto currentpicture also currentpicture xscaled -1;
480 fet_beginchar("organ-toe", "pedaltoe", "pedaltoe")
483 thickness := 1.5 stafflinethickness;
484 ht# := 1.5 interline#;
486 define_pixels(ht,wd);
489 set_char_box(wd#, wd#, 0, ht#);
491 pickup pencircle scaled thickness;
503 fet_beginchar("Flageolet", "flageolet", "flageolet")
504 save height,width,thickness;
505 height#=4/15 staffsize#;
507 thickness#=blot_diameter#;
508 define_pixels(height,width,thickness);
509 set_char_box(width#/2,width#/2,height#/2,height#/2);
511 pickup pencircle scaled thickness;
515 rt x4 - lft x2 =width;
522 draw z1..z2..z3..z4..cycle;
525 fet_endgroup("scripts");