6 fet_begingroup("scripts")
10 save alpha, radius, crook_thinness, crook_fatness, dot_diam;
12 % [Wanske] and some Baerenreiter editions
13 % suggest ca 80 degrees iso half-circle
16 radius# = 1.25 interline#;
17 crook_thinness# = 1.5stafflinethickness#;
18 crook_fatness# = 4 stafflinethickness#;
20 radius# + crook_fatness#/2 = h#;
21 radius# + crook_thinness#/2 = w#;
22 set_char_box(w#, w#, crook_thinness#/2, h#);
24 define_pixels(radius, crook_thinness, crook_fatness);
25 dot_diam = 4/3 crook_fatness;
28 penpos1(crook_thinness, 0);
29 penpos2(crook_fatness, -90);
33 fill z1l{dir (-alpha-90)}..{dir (90-alpha)}z1r..
34 {right}z2r -- z2l{left} .. cycle;
36 addto currentpicture also
37 currentpicture xscaled -1;
39 pickup pencircle scaled dot_diam;
41 bot y4 = - crook_thinness/2;
45 fet_beginchar("fermata up", "ufermata", "ufermata")
50 fet_beginchar("fermata down", "dfermata", "dfermata")
52 currentpicture:=currentpicture yscaled -1 ;
53 set_char_box(w#, w#, h#, 0);
59 % FIXME: rounded endings
61 % `\accent' is TeX reserved.
62 fet_beginchar("> accent", "sforzato", "sforzatoaccent")
63 set_char_box(.9 interline#, .9 interline#, .5 interline#, .5 interline#);
64 save thickness, diminish;
66 thickness = 2 stafflinethickness;
68 % prevent blobs at crossing lines
74 y2 = .25 thickness* diminish;
78 z3 = whatever [z1, z4];
80 penpos2(thickness*(2 - diminish)/2 , 90);
81 penpos1(thickness, 90);
82 penpos3(thickness, 90);
84 penstroke z1e .. z3e .. z2e;
85 penstroke (z1e .. z3e .. z2e) yscaled -1;
90 fet_beginchar("staccato dot", "staccato", "staccato")
92 radius# = 1.5 stafflinethickness#;
93 define_pixels(radius);
94 pickup pencircle scaled 2 radius;
96 set_char_box(radius#, radius#, radius#, radius#);
99 def draw_staccatissimo =
101 height# = .8 interline#;
102 radius# = 2 stafflinethickness#;
103 define_pixels(radius, height);
105 draw_brush((0,0), blot_diameter, (0, height),2 radius);
106 set_char_box(radius#,radius#, blot_diameter#/2, height# + radius#);
109 fet_beginchar("staccatissimo/martellato up", "ustaccatissimo",
115 % FIXEM: scale labels too.
117 fet_beginchar("staccatissimo/martellato down", "dstaccatissimo", "dstaccatissimo")
122 fet_beginchar("portato/single tenuto", "tenuto", "tenuto")
124 thick# = 1.2 stafflinethickness#;
125 define_pixels(thick);
127 set_char_box(.9 interline#, .9 interline#, thick#/2,thick#/2);
128 pickup pencircle scaled thick;
137 save fatness, thinness;
138 set_char_box(interline#/2, interline#/2, 0, 1.1 interline#);
140 fatness = 3 stafflinethickness;
141 thinness = .8 stafflinethickness;
142 x2 - x1 + blot_diameter = fatness;
147 z2 - z3 = whatever * (charwd, -charht);
148 z1 - z4 = whatever * (charwd, -charht);
149 z3 - z4 = whatever * (charwd, charht);
151 draw_rounded_path(z1 -- z2 -- z3 -- z4 -- cycle, thinness);
153 pickup pencircle scaled thinness;
154 z3 - z5 = whatever* (z3 - z4);
159 fet_beginchar("marcato up", "umarcato", "umarcato")
166 % The down marcato char (not very much used).
167 % Contrary to what some MF/TeX `gurus' believe
168 % it is *point*-symmetric with the "up" version; (at least [Chlapik]
171 fet_beginchar("marcato down", "dmarcato", "dmarcato")
176 fet_beginchar("open (unstopped)", "open", "ouvert")
177 save thin, height, width, thick;
178 height# = 5/4 width#;
179 height# = interline#;
180 thin = 1.2 stafflinethickness;
182 set_char_box(width#/2, width#/2, height#/2, height#/2);
189 penstroke z1e{up} .. {left}z2e;
190 addto currentpicture also currentpicture xscaled -1;
191 addto currentpicture also currentpicture yscaled -1;
195 fet_beginchar("plus (stopped)", "stopped", "plusstop")
197 thick = 2 stafflinethickness;
198 size# = 1.1 interline#;
200 set_char_box(size#/2, size#/2, size#/2, size#/2);
201 pickup pencircle scaled thick;
208 draw (z1 .. z2) rotated 90;
214 fet_beginchar("Upbow", "upbow", "upbow")
217 thick = 1.4 stafflinethickness;
218 wd# = 1.3 interline#;
222 set_char_box(wd#/2, wd#/2, 0, ht#);
223 pickup pencircle scaled thick;
231 draw z2 -- z1 -- (z2 xscaled -1);
235 fet_beginchar("Downbow", "downbow", "downbow")
236 save stemthick, beamheight;
240 wd# = 1.5 interline#;
241 stemthick = 1.2 stafflinethickness;
243 set_char_box(wd#/2, wd#/2, 0, 4/3 interline#);
248 pickup pencircle scaled blot_diameter;
249 top y2 - bot y1 = beamheight;
259 p := z1 -- z2 -- z3 -- z4 --cycle;
260 draw_rounded_path(p, blot_diameter);
261 pickup pencircle scaled stemthick;
267 labels(1, 2,3,4,5,6);
268 addto currentpicture also currentpicture xscaled -1;
272 % Inspired by a computer-set version of auf dem Strom by Baerenreiter.
274 fet_beginchar("Turn","turn","turn")
275 save thin, thick, ball_diam, darkness;
276 save wd, ht, thick_nibangle, ball_nib_thick;
280 wd# = 35/16 interline#;
281 ht# = 18/17 interline#;
282 darkness = 1.20 stafflinethickness;
284 set_char_box(wd#/2, wd#/2, ht#/2, ht#/2);
289 ball_nib_thick = 2.7 darkness;
290 ball_diam = ball_nib_thick + (h - ball_nib_thick) / 10;
301 penpos1(1.1 thick, thick_nibangle);
302 penpos2(thick, thick_nibangle);
304 penpos4(ball_nib_thick, -90);
307 swoosh := z1l{curl 0} .. z2l .. z3l{up} .. {left}z4l
308 -- z4r .. z3r{down} .. z2r{left} ;
309 fill swoosh .. (swoosh scaled -1) .. cycle;
313 y5r = y4l - ball_diam /2;
316 penpos5(1.6 ball_diam/2, 10);
317 penpos6(ball_diam/2, 150);
319 ploop := z4l{left} .. z5l .. z6l -- cycle;
321 fill ploop scaled -1;
331 def draw_bulb(expr zl, zr, center_factor, radius_factor)=
337 z0 = center_factor [zr, zl];
338 rad = center_factor * length(zr-zl);
340 z1 = z0 + radius_factor* rad * dir(ang - 100);
341 z2 = z0 + rad * dir(ang - 270);
343 fill zr{dir (ang - 90)} .. z1 .. z2 -- cycle;
349 % Inspired by a (by now) PD edition of Durand & C'ie edition of
350 % Saint-Saens' Celloconcerto no. 1
352 % FIXME take out hardcoded vars.
353 % FIXME the two loops on the `t' should be smoother (and the left one bigger).
354 % FIXME generic macros for serifs: top of the t and bottom of r
358 fet_beginchar("Trill (`tr')","trill","trill")
360 save start_angle, ascender_extra, ex, hair_thick, fatness,
361 slant_angle, slant, t_fatness, r_fatness, kerning, t_overshoot,
362 uitschieter, bulb_size;
366 ascender_extra# = 1/2 ex#;
367 ascender# = ascender_extra# + ex#;
368 ex# = 1.5 interline#;
371 define_pixels(ex, ascender_extra, ascender, kerning);
372 t_overshoot = 0.03 ex;
374 t_fatness = 8/10 fatness;
375 r_fatness = .75 fatness;
376 uitschieter = 21/40 ex;
377 hair_thick = blot_diameter;
381 local_copy(transform)(currenttransform);
382 currenttransform := currenttransform slanted slant;
387 penpos1(start_nib_wid, 25);
390 penpos2(start_nib_wid, 25);
392 z3l = (11/10 t_fatness, - t_overshoot);
394 z4l = (13/6 t_fatness, 5/16 ex);
395 penpos4(hair_thick, 180);
397 1.9 [z3l, z3r] = z4r;
401 path t_p, krul_p, r_p;
404 t_p := z1l -- z2l{down} .. tension (1 + .5 slant)
407 .. z4l{up} -- z4r{down}
408 .. z3r{left} .. z2r{up} .. z1r -- cycle;
413 pickup pencircle scaled hair_thick;
415 z5 = (t_fatness/2, 2/3 ex);
417 lft x6 = - uitschieter;
420 z7 = z5 + whatever*dir krul_ang;
423 x7 = 5/10 kerning + x5;
425 penpos7(hair_thick, up_angle + 90);
430 penpos8(2 hair_thick, (up_angle +90)/2);
434 penpos9(r_fatness, 0);
438 penpos10(r_fatness, 0);
440 krul_p := z4{up} .. tension 1.1 .. z5
441 .. tension 1 and .75 .. {down}z6
442 .. tension .85 and 1.1 .. z5 --- z7;
444 r_p := z7l{z7-z5} .. z8l{right} .. z9l{down} --- z10l -- z10r
446 .. z8r{left} .. z7r{z5-z7} -- cycle;
448 set_char_box(0,2 interline#, 0,ascender#);
451 penpos11(1/4 r_fatness, -20);
454 z13 = (x9 + 2 r_fatness, y11 );
455 penpos13(r_fatness, 180);
456 fill z11r{dir 70} .. z13r{down} -- z13l{up} .. z11l{dir 250} -- cycle;
457 penlabels(range 1 thru 15);
459 draw_bulb(z13r, z13l, bulb_size, 1.5);
462 fet_beginchar("organ-heel", "pedalheel", "pedalheel")
463 save radius, thickness, wall;
465 radius# := .5 interline#;
467 define_pixels(radius);
468 set_char_box(radius#, radius#, radius#, 2/3 interline#);
470 thickness := 1.5 stafflinethickness;
471 pickup pencircle scaled thickness;
481 draw z1{down} .. z2{down} .. z3{left};
482 addto currentpicture also currentpicture xscaled -1;
486 fet_beginchar("organ-toe", "pedaltoe", "pedaltoe")
489 thickness := 1.5 stafflinethickness;
490 ht# := 1.5 interline#;
492 define_pixels(ht,wd);
495 set_char_box(wd#, wd#, 0, ht#);
497 pickup pencircle scaled thickness;
512 fet_endgroup("scripts");