]> git.donarmstrong.com Git - lilypond.git/blob - mf/feta-schrift.mf
*** empty log message ***
[lilypond.git] / mf / feta-schrift.mf
1 % -*- Fundamental -*-  (emacs-20 mf mode mucks
2 % feta-schrift.mf --  implement scripts
3
4 % source file of the Feta (defintively not an abbreviation for Font-En-Tja)
5 % music font
6
7 % (c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
8 %       Jan Nieuwenhuizen <janneke@gnu.org>
9
10
11
12 fet_begingroup("scripts")
13
14 def draw_fermata =
15   save alpha, radius, crook_thinness, crook_fatness, dot_radius;
16   
17         % [Wanske] and some  Baerenreiter editions
18         % suggest ca 80 degrees iso half-circle
19   alpha := 10;
20
21   radius# = 1.25 staff_space#;
22   crook_thinness# = 1.5linethickness#;
23   crook_fatness# = 0.25 staff_space# +  1.5 linethickness#;
24
25   radius# + crook_fatness#/2 = h#;
26   radius# + crook_thinness#/2 = w#;
27   set_char_box(w#, w#, crook_thinness#/2, h#);
28   
29   define_pixels(radius, crook_thinness, crook_fatness);
30   dot_radius = round (4/6 crook_fatness);
31
32
33   penpos1(crook_thinness, 0);
34   penpos2(crook_fatness, -90);
35   z1 = (-radius,0);
36   z2 = (0, radius);
37
38   fill z1l{dir (-alpha-90)}..{dir (90-alpha)}z1r..
39   {right}z2r -- z2l{left} .. cycle;
40
41   addto currentpicture also 
42   currentpicture xscaled -1;
43
44   pickup pencircle scaled 2dot_radius;
45   x4 =0;
46   bot y4 = - crook_thinness/2;
47   drawdot z4;
48 enddef;
49
50 fet_beginchar("fermata up", "ufermata", "ufermata")
51         draw_fermata;   
52         penlabels(1,2,4);
53 fet_endchar;
54
55 fet_beginchar("fermata down", "dfermata", "dfermata")
56         draw_fermata;
57         y_mirror_char;
58 fet_endchar;
59
60 def draw_short_fermata =
61         save fat_factor, thinness, dot_radius;
62         set_char_box(staff_space#, staff_space#, 0, 2.2 staff_space#);
63
64         dot_radius# = 0.133 staff_space# + 1.33 linethickness#;
65         define_pixels(dot_radius)
66
67         fat_factor = .11;
68         thinness = 1.5 linethickness;
69
70         pickup pencircle scaled thinness;
71         rt x2 = w;
72         lft x5 = -b;
73         bot y5 = 0;
74         top y3 = h;
75         y1 = y2 = y5;
76
77         x3 = 0;
78         z1 - z4 = whatever * (charwd, -charht);
79         z4 = fat_factor [z3, z5];
80
81         filldraw z1 -- z2 -- z3 -- z4 -- cycle;
82         draw z3 .. z5;
83
84         pickup pencircle scaled 2dot_radius;
85         x1 - 2x6 = x2;
86         bot y6 = -d;
87         drawdot z6;
88 enddef;
89
90 fet_beginchar("short fermata up", "ushortfermata", "ushortfermata")
91         draw_short_fermata;     
92 fet_endchar;
93
94 fet_beginchar("short fermata down", "dshortfermata", "dshortfermata")
95         draw_short_fermata;
96         xy_mirror_char;
97 fet_endchar;
98
99 def draw_long_fermata =
100         save stemthick, beamheight, dot_radius, wd;
101         define_pixels(wd, dot_radius)
102
103         wd# = 2.5 staff_space#;
104         stemthick = 1.5 linethickness;
105         beamheight = 0.3 staff_space+  linethickness;
106         dot_radius# = 0.133 staff_space#+ + 1.333 *linethickness#;
107         set_char_box(wd#/2, wd#/2, 0, 3/2 staff_space#);
108
109         draw_rounded_block((-b, h-beamheight), (w, h), blot_diameter);
110         draw_rounded_block((-b, -d),(-b+stemthick, h-stemthick), stemthick);
111         addto currentpicture also currentpicture xscaled -1;
112
113         pickup pencircle scaled 2dot_radius;
114         x4 = 0;
115         bot y4 = -d;
116         drawdot z4;
117 enddef;
118
119 fet_beginchar("long fermata up", "ulongfermata", "ulongfermata")
120         draw_long_fermata;      
121 fet_endchar;
122
123 fet_beginchar("long fermata down", "dlongfermata", "dlongfermata")
124         draw_long_fermata;
125         y_mirror_char;
126 fet_endchar;
127
128 def draw_very_long_fermata =
129         save ibeamheight, obeamheight;
130         save ihwd, ohwd, iht, oht; % inner/outer half_width/height
131         save stemthick, dot_radius;
132         define_pixels(ihwd, ohwd, iht, oht)
133
134         ihwd# = 1.0 staff_space#;
135         ohwd# = 1.5 staff_space#;
136         iht# = 0.9 staff_space#;
137         oht# = 1.6 staff_space#;
138
139         stemthick = 1.5 linethickness;
140         ibeamheight = 0.3 staff_space;
141         obeamheight = 0.5 staff_space;
142         dot_radius = ((iht - ibeamheight) * 4/10)  ;
143
144         set_char_box(ohwd#, ohwd#, 0, oht#);
145
146         draw_rounded_block((-ohwd, oht-obeamheight), (ohwd, oht), blot_diameter);
147         draw_rounded_block((-ohwd, 0),(-ohwd+stemthick, ohwd-stemthick), stemthick);
148         draw_rounded_block((-ihwd, iht-ibeamheight), (ihwd, iht), blot_diameter);
149         draw_rounded_block((-ihwd, 0),(-ihwd+stemthick, ihwd-stemthick), stemthick);
150         addto currentpicture also currentpicture xscaled -1;
151
152         pickup pencircle scaled 2dot_radius;
153         x4 = 0;
154         bot y4 = -d;
155         drawdot z4;
156 enddef;
157
158 fet_beginchar("very long fermata up", "uverylongfermata", "uverylongfermata")
159         draw_very_long_fermata; 
160 fet_endchar;
161
162 fet_beginchar("very long fermata down", "dverylongfermata", "dverylongfermata")
163         draw_very_long_fermata;
164         y_mirror_char;
165 fet_endchar;
166
167 %
168 % Thumbs are used in cello music.
169 % TODO : thumbs should look like the finger-font and should be placed in
170 % the same way in the score.
171 %
172
173 fet_beginchar("Thumb", "thumb", "thumb")
174         save thin, height, width, thick, depth;
175         height# = 5/4 width#;
176         height# = staff_space#;
177         depth# = 1.6 (height# / 2); 
178         set_char_box(width#/2, width#/2, depth#, height#/2);
179         define_pixels (height, width)
180
181         thin = .6  linethickness + 0.06 staff_space;
182         2 thick + 0.5 (height - 2 thin) = width;
183
184         penpos1(thick, 0);
185         penpos2(thin, 90);
186         z1r = (w, 0);
187         z2r = (0, h);
188         penlabels(1,2);
189         penstroke z1e{up} .. {left}z2e;
190         addto currentpicture also currentpicture xscaled -1;
191         addto currentpicture also currentpicture yscaled -1;
192
193         z3 = (0, -h);
194         save brush_thick;
195         y4 = - d + brush_thick / 2;
196         brush_thick = 0.9*thick;
197         x4 = 0;
198         penlabels(3,4);
199         draw_brush(z3,1.4*thin, z4, brush_thick);
200 fet_endchar;
201
202 %
203 % FIXME: rounded endings
204 %
205 % `\accent' is TeX reserved.
206 fet_beginchar("> accent", "sforzato", "sforzatoaccent")
207         set_char_box(.9 staff_space#, .9 staff_space#, .5 staff_space#, .5 staff_space#);
208         save thickness, diminish;
209
210         thickness = 0.05 staff_space + linethickness;
211         pickup pencircle scaled thickness;
212
213         % prevent blobs at crossing lines
214         diminish = .75;
215
216         top y1 = h;
217         lft x1 = -b;
218         rt x2 = w;
219         y2 = .25 thickness* diminish;
220
221         rt z4 = (w,0);
222         x3 = - linethickness + 0.1 staff_space;
223         z3 = whatever [z1, z4];
224
225         penpos2(thickness*(2 - diminish)/2 , 90);
226         penpos1(thickness, 90);
227         penpos3(thickness, 90);
228
229         draw z1 .. z3;
230         draw (z1 .. z3) yscaled -1;
231         draw z4;
232         penstroke z3e .. z2e;
233         penstroke (z3e .. z2e) yscaled -1;
234
235         penlabels(1,2,3);
236         labels(4);
237 fet_endchar;
238
239 fet_beginchar("espr", "espr", "espressivo")
240         set_char_box(1.9 staff_space#, 1.9 staff_space#, .5 staff_space#, .5 staff_space#);
241         save thickness, diminish;
242         thickness = 0.05 staff_space + linethickness;
243         pickup pencircle scaled thickness;
244         t = thickness;
245         diminish = .75;
246         top z1 =(0.2 staff_space,h);
247         rt z3 =(w,0);
248         x4 = x3;
249         y4 = y3 + .25 t * diminish;
250         x2 = .5[x1,x3];
251         z2 = whatever[z1,z3];
252         penpos1(t,90);
253         penpos2(t,90);
254         penpos4((2-diminish)*t*.5,90);
255         draw z1 .. z2;
256         penstroke z2e .. z4e;
257         penlabels(1,2,4);
258         labels(3);
259         draw z3;
260         addto currentpicture also currentpicture xscaled -1;
261         addto currentpicture also currentpicture yscaled -1;
262
263 fet_endchar;
264
265 fet_beginchar("staccato dot", "staccato", "staccato")
266         save radius;
267         radius# =   0.20 * staff_space#;
268         define_whole_pixels(radius);
269         pickup pencircle scaled 2 radius;
270         drawdot (0,0);
271         set_char_box(radius#, radius#, radius#, radius#);
272 fet_endchar;
273
274 def draw_staccatissimo =
275         save radius, height;
276         height# = .8 staff_space#;
277         radius# = linethickness# + .1 staff_space#;
278         define_whole_pixels(radius);
279         define_pixels(height);
280
281         draw_brush((0,0), linethickness, (0, height),2 radius);
282         set_char_box(radius#,radius#, blot_diameter#/2, height# + radius#);
283 enddef;
284
285 fet_beginchar("staccatissimo/martellato up", "ustaccatissimo", 
286                 "ustaccatissimo")
287         draw_staccatissimo;
288 fet_endchar;
289
290 fet_beginchar("staccatissimo/martellato down", "dstaccatissimo", "dstaccatissimo")
291         draw_staccatissimo;
292         y_mirror_char;
293 fet_endchar;
294
295 fet_beginchar("portato/single tenuto", "tenuto", "tenuto")
296         save thick;
297         thick# = 1.6 linethickness#;
298         define_whole_pixels(thick);
299
300         set_char_box(.6 staff_space#, .6 staff_space#, thick#/2,thick#/2);
301         pickup pencircle scaled thick;
302         draw_rounded_block((-b,-thick/2),(w,thick/2),thick);
303 fet_endchar;
304
305 def draw_portato = 
306         save thick, radius;
307         thick# = 1.4 linethickness#;
308         radius# = 1.2 linethickness# + 0.04 staff_space#;
309         define_whole_pixels(thick,radius);
310         
311         set_char_box(.6 staff_space#, .6 staff_space#, thick#/2,.5 staff_space#+ radius#);
312         draw_rounded_block((-b,-thick/2),(w,thick/2),thick);
313
314         pickup pencircle scaled 2 radius;
315         drawdot (0,h);
316 enddef;
317
318
319 fet_beginchar("portato/tenuto with staccato", "uportato", 
320                 "uportato")
321         draw_portato;
322 fet_endchar;
323
324
325 fet_beginchar("portato/tenuto with staccato", "dportato", 
326                 "dportato")
327         draw_portato;
328         y_mirror_char
329 fet_endchar;
330
331
332 def draw_marcato = 
333         save fat_factor, thinness;
334         set_char_box(staff_space#/2, staff_space#/2, 0, 1.1 staff_space#);
335
336         fat_factor = .3;
337         thinness =  linethickness;
338
339         pickup pencircle scaled thinness;
340         rt x2 = w;
341         lft x5 = -b;
342         bot y5 = 0;
343         top y3 = h;
344         y1 = y2 = y5;
345
346         x3 =0;
347         z1 - z4 = whatever * (charwd, -charht);
348         z4 = fat_factor [z3, z5];
349
350         filldraw z1 -- z2 -- z3 -- z4 -- cycle;
351         draw z3 .. z5;
352 enddef;
353
354 fet_beginchar("marcato up", "umarcato", "umarcato")
355         draw_marcato;
356         labels(1,2,3,4,5);
357 fet_endchar;
358
359
360 %
361 % The down marcato char (not very much used). 
362 % Contrary to what some MF/TeX `gurus' believe
363 % it is *point*-symmetric with the "up" version
364 %
365 fet_beginchar("marcato down", "dmarcato", "dmarcato")
366         draw_marcato;
367         xy_mirror_char;
368 fet_endchar;
369  
370
371 %
372 % used in french horn music todo
373 %
374 % TODO: too light at 20pt
375 fet_beginchar("open (unstopped)", "open", "ouvert")
376         save thin, height, width, thick;
377         height# = 5/4 width#;
378         height# = staff_space#;
379         thin = .6  linethickness + 0.06 staff_space;
380         set_char_box(width#/2, width#/2, height#/2, height#/2);
381         define_pixels (width,height);
382         2 thick + 0.6 (height - 2 thin) = width;
383         
384         penpos1(thick, 0);
385         penpos2(thin, 90);
386         z1r = (w, 0);
387         z2r = (0, h);
388         penlabels(1,2);
389         penstroke z1e{up} .. {left}z2e;
390         addto currentpicture also currentpicture xscaled -1;
391         addto currentpicture also currentpicture yscaled -1;
392 fet_endchar;
393
394
395 fet_beginchar("plus (stopped)", "stopped", "plusstop")
396         save thick, size;
397         thick = 2 linethickness;
398         size# = 1.1 staff_space#;
399
400         set_char_box(size#/2, size#/2, size#/2, size#/2);
401         draw_rounded_block((-b,-thick/2),(w,thick/2),thick);
402         addto currentpicture also currentpicture rotated 90;
403 fet_endchar;
404
405
406 %
407 % A vee with tapered insides to prevent visual blotting
408 %
409
410 def draw_vee (expr width, height, thickness) =
411 begingroup
412         save diminish;
413
414         diminish = 0.75;
415
416         pickup pencircle scaled thickness;
417         
418         x1 = 0;
419         bot y1 = 0;
420         rt x2 =  w;
421         top y2 = h;
422
423         z3 = whatever [z2, z1];
424         y3 = 0.6 [y2, y1] + thickness;
425
426         penpos3(thickness, 0);
427         penpos4(thickness * diminish, 0);
428         x4r = thickness/2;
429         y4 = thickness/2;
430         labels(1,2);
431         penlabels(3,4);
432
433         draw z1;
434         draw z3 -- z2;
435         penstroke z3e .. z4e;
436         addto currentpicture also currentpicture xscaled -1;
437 endgroup;
438 enddef;
439
440 fet_beginchar("Upbow", "upbow", "upbow")
441         save ht, wd, thick, diminish;
442         
443         thick = 1.4 linethickness;
444         wd# = 1.3 staff_space#;
445         ht# = 1.6 wd#; 
446         set_char_box(wd#/2, wd#/2, 0, ht#);
447         draw_vee (wd, ht, thick);
448 fet_endchar;
449
450
451 fet_beginchar("Downbow", "downbow", "downbow")
452         save stemthick, beamheight;
453         save wd,round;
454         define_pixels(wd)
455
456         wd# = 1.5 staff_space#;
457         stemthick = 1.2 linethickness;
458         set_char_box(wd#/2, wd#/2, 0, 4/3 staff_space#);
459
460         beamheight = 4/10 h;
461
462         draw_rounded_block((-b,h-beamheight),(w,h),blot_diameter);
463         draw_rounded_block((-b,-d),(-b+stemthick,h-stemthick),stemthick);
464         addto currentpicture also currentpicture xscaled -1;
465 fet_endchar;
466
467 %
468 % Inspired by a computer-set version of Auf dem Strom by Baerenreiter. 
469 %
470
471 def draw_turn =
472         save thin, thick, ball_diam, darkness;
473         save wd, ht, thick_nibangle, ball_nib_thick;
474         save turndir;
475         pair turndir;
476
477         wd# = 35/16 staff_space#;
478         ht# = 18/17 staff_space#;
479         darkness = 0.3 linethickness + 0.09 staff_space;
480
481         set_char_box(wd#/2, wd#/2, ht#/2, ht#/2);       
482
483         thick_nibangle = 60;
484         thick = 3 darkness;
485         thin = darkness;
486         ball_nib_thick = 2.7 darkness;
487         ball_diam = ball_nib_thick + (h - ball_nib_thick) / 10;
488
489         
490         x3l = w;
491         y3 = 0;
492         y4l = h;
493         x4 = x2;
494         x2l = w/2;
495         y2l = -d;
496         z1 = (0,0);
497
498         penpos1(1.1 thick, thick_nibangle);
499         penpos2(thick, thick_nibangle);
500         penpos3(thin, 180);
501         penpos4(ball_nib_thick, -90);
502
503         path swoosh, ploop;
504         swoosh :=  z1l{curl 0} .. z2l .. z3l{up} .. {left}z4l 
505           -- z4r .. z3r{down} .. z2r{left} ;
506         fill swoosh .. (swoosh scaled -1) .. cycle;
507
508         x5r = x4;
509         y5r = y4l - ball_diam /2;
510         z6r = z5r;
511
512         penpos5(1.6 ball_diam/2, 10);
513         penpos6(ball_diam/2, 150);
514
515         ploop := z4l{left} .. z5l .. z6l -- cycle;
516         fill ploop;
517         fill ploop scaled -1;
518
519
520 enddef;
521
522 fet_beginchar("Reverse turn","reverseturn","reverseturn")
523         draw_turn;
524         currentpicture := currentpicture yscaled -1;
525 fet_endchar;
526
527
528 fet_beginchar("Turn","turn","turn")
529         draw_turn;
530         penlabels(1,2,3,4,5,6,7);
531 fet_endchar;
532
533
534
535 %
536 % Inspired by a (by now) PD edition of Durand & C'ie edition of 
537 % Saint-Saens' Celloconcerto no. 1 
538 %
539 % FIXME take out hardcoded vars.
540 % FIXME the two loops on the `t' should be smoother (and the left one bigger).
541 % FIXME generic macros for serifs: top of the t and bottom of r
542 %
543
544
545 fet_beginchar("Trill (`tr')","trill","trill")
546         
547         save start_nib_angle,  ascender_extra, ex, hair_thick, fatness,
548           slant_angle, slant, t_fatness, r_fatness, kerning, t_overshoot, 
549           uitschieter, bulb_size;
550         ;
551         pair slant_vec;
552
553         ascender_extra# = 1/2 ex#;
554         ascender# = ascender_extra# + ex#;
555         ex# = 1.4 staff_space#;
556         kerning# = .60 ex#;
557         start_nib_angle = 20;
558         bulb_size = 0.80;
559         define_pixels(ex, ascender_extra, ascender, kerning);
560
561         t_overshoot = 0.03 ex;
562         fatness = 12/40 ex;
563         t_fatness = 0.78 fatness;
564         t_width =  1.9 t_fatness;
565         r_fatness = 0.78 fatness;
566         uitschieter = 0.48 ex;
567         hair_thick =  linethickness;
568         r_flare = .5 hair_thick + 0.25 r_fatness;
569         r_width =  2 r_fatness + 0.25 kerning;
570         slant = .2;
571
572 %       slant = .0;
573
574         local_copy(transform)(currenttransform);
575         currenttransform := currenttransform slanted slant shifted (- staff_space, 0)  ;
576
577         y1 = ascender;
578
579         % try to position in such a way that the center is the visual
580         % center
581
582         x1l = 0.2 staff_space;
583         x1r - x1l = t_fatness;
584         penpos1(start_nib_wid, start_nib_angle);
585         
586         z2 = (x1, 7/18 ex);
587         penpos2(start_nib_wid, start_nib_angle);
588
589         z3l = (x2l + 0.5 t_width, - t_overshoot);
590
591         z4l = (x2l + t_width, 0.23 ex);
592         penpos4(whatever, 200);
593         x4l - x4r = hair_thick;
594
595         x3r = 0.5 [x4r, x2r];
596 %       1.7 [x3l, x3r] = x4r;
597         y3r - y3l = 0.6 t_fatness;
598
599         
600         save t_p, krul_p;
601         path t_p, krul_p, r_p;
602
603         z5 = (x2l + t_fatness/2, 2/3 ex);
604 %       penpos5(hair_thick, ); 
605
606         t_p := z1r{dir (angle(z1l-z1r) + 30)} .. z1l{-dir (angle(z1r-z1l) - 45)}
607                 -- z2l {down}
608                 .. tension (1 + .5 slant)
609                 .. z3l{right} 
610                 
611                 .. z4l{up} -- z4r{down} 
612                 .. z3r{left}
613                 .. tension (1.5 + .7 slant)
614                 .. z2r{up} .. z1r -- cycle;
615         fill t_p ;
616
617         krul_ang = 32;
618
619         pickup pencircle scaled hair_thick;
620         
621         lft x6 = x2l - uitschieter;
622         y6 =  y5 ; % - 1/20 ex;
623
624         z7 = z5 + whatever*dir krul_ang;
625         up_angle = krul_ang;
626         % angle (z7-z5)
627         x7 = 5/10 kerning + x5;
628         
629         penpos7(hair_thick, up_angle + 90);
630
631         
632         y9 = 3/4 ex;
633         x9 = x1 + kerning;
634         penpos9(r_fatness, 0);
635
636         x10 = x9;
637         y10 =  -0.3 linethickness;
638         penpos10(r_fatness, 0);
639
640         krul_p := z4{up}
641                 .. tension 0.98
642                 .. z5
643                 .. z6
644                 .. z5 --- z7;
645         draw krul_p;
646         r_p := z7l{z7-z5} .. z9l{down} --- simple_serif (z10l, z10r, -30)
647                 --- z9r{up} 
648                  ..  z7r{z5-z7} -- cycle;
649         fill r_p;
650
651         set_char_box(.85 staff_space# , .85 staff_space#, 0,ascender#);
652
653
654         penpos11(hair_thick, -4);
655         z11r = z9r;
656         
657         z13l = (x9l + r_width, y11 -  linethickness );
658         penpos13(r_flare, 180);
659
660         z15 = z13r  - ( bulb_size * r_fatness,0);
661         z14 = 0.5 [z13l, z15] - (0,bulb_size* r_fatness);
662         z16 = 0.5 [z13l, z15] + (0,bulb_size* r_fatness);
663
664
665         fill z11r{up} .. tension 0.94 .. z13r{down} -- z15{down}
666                 .. tension 1.0 .. z13l{up}
667                 .. z11l{down} -- cycle;
668
669         fill z15{up} .. tension 1.06 .. z13l{down} .. z14 .. cycle;
670
671
672
673         penlabels(range 1 thru 15);
674
675 fet_endchar;
676
677
678 def draw_heel =
679         save radius, thickness, wall;
680
681         radius# := .5 staff_space#;
682
683         define_pixels(radius);
684         set_char_box(radius#, radius#, radius#, 2/3 staff_space#);
685
686         thickness := 1.5 linethickness; 
687         pickup pencircle scaled thickness;
688         rt x1 = b;
689         top y1 = h;
690         
691         x2 =x1;
692         y2 = 0;
693
694         x3 = 0;
695         bot y3 = -d;
696
697         draw z1{down} .. z2{down} .. z3{left};
698         addto currentpicture also currentpicture xscaled -1;
699         
700 enddef;
701
702
703 fet_beginchar("left heel", "upedalheel", "upedalheel")
704         draw_heel;
705         labels(1,2,3);
706 fet_endchar;
707
708 fet_beginchar("right heel", "dpedalheel", "dpedalheel")
709         draw_heel;
710         y_mirror_char;
711 fet_endchar;
712
713 def draw_toe =
714         save ht,wd;
715
716         thickness := 1.5 linethickness;
717         ht# := 1.5 staff_space#;
718         wd# := 1/3 ht#;
719         define_pixels(ht,wd);
720
721
722         set_char_box(wd#, wd#, 0, ht#);
723         draw_vee (wd, ht, thickness);
724 enddef;
725         
726 fet_beginchar("left toe", "upedaltoe", "upedaltoe")
727         draw_toe;
728         labels(1,2,3);
729 fet_endchar;
730 fet_beginchar("right toe", "dpedaltoe", "dpedaltoe")
731         draw_toe;
732         y_mirror_char;
733 fet_endchar;
734
735 fet_beginchar("Flageolet", "flageolet", "flageolet")
736         save height,width,thickness;
737         height#=4/15 staffsize#;
738         width#=height#;
739         thickness#=blot_diameter#;
740         define_pixels(height,width,thickness);
741         set_char_box(width#/2,width#/2,height#/2,height#/2);
742         
743         pickup pencircle scaled thickness;
744         x1= .5 [x2, x4];
745         x1 = 0;
746         top y1=height/2;
747         rt x4  - lft x2 =width; 
748         y2 = 0;
749         y4=y2;
750         x3=x1;
751         bot y3=-height/2;
752
753         penlabels(1,2,3,4);
754         draw z1..z2..z3..z4..cycle;
755 fet_endchar;
756
757 %%
758 %
759 %TODO:  ARGRGHGH code dup.
760 %
761 %
762
763 fet_beginchar("Segno", "segno", "segno")
764         save thin, thick, ball_diam, darkness, pointheight;
765         save wd, ht, thick_nibangle, ball_nib_thick;
766         save turndir;
767         pair turndir;
768
769         ht# = 3 staff_space#;
770         wd# = 2 staff_space#;
771         darkness = .08 staff_space + 0.4  linethickness;
772
773         set_char_box(wd#/2, wd#/2, ht#/2, ht#/2);       
774
775         thick_nibangle = 30;
776         thick = 3 darkness;
777         thin = darkness;
778         ball_nib_thick = 2.7 darkness;
779         ball_diam = ball_nib_thick + (w - ball_nib_thick) / 10;
780         pointheight = 2 linethickness;
781         
782         y3l = h;
783         2 x3 = x2 + x4;
784         x4 = 0;
785         y4 = y2;
786         y2l = .6 h;
787         x2l = -b;
788         z1 = (0,0);
789
790         penpos1(thick, 2 thick_nibangle);
791         penpos2(thick, thick_nibangle);
792         penpos3(thin, -90);
793         penpos4(ball_nib_thick, 180-thick_nibangle);
794
795         path swoosh, ploop;
796         swoosh :=  z1l{curl 0} .. z2l .. z3l{right} .. {down}z4l 
797           -- z4r .. z3r{left} .. z2r{down} ;
798         fill swoosh .. (swoosh scaled -1) .. cycle;
799         penlabels(1,2,3,4);
800
801         y5r = y4;
802         x5r = x4l - ball_diam /2;
803         z6r = z5r;
804
805         penpos5(1.6 ball_diam/2, 100);
806         penpos6(ball_diam/2, 240);
807
808         ploop := z4l{down} .. z5l .. z6l -- cycle;
809         fill ploop;
810         fill ploop scaled -1;
811         penlabels(4,5,6);
812
813         penpos7(2 thin,0);
814         z7l=(-b,-d);
815         penpos8(2 thin,0);
816         z8r=(w,h);
817         filldraw z7l--z8l{right}--z8r{down}--z7r{right}--cycle;
818         pickup pencircle scaled 2 thin;
819         draw (-x2r,pointheight);
820         draw (x2r,-pointheight);
821 fet_endchar;
822
823 fet_beginchar("Coda", "coda", "coda")
824         save stickout, thin, thick, codawidth, codaheight;
825
826         stickout# = 0.35 staff_space#;
827         codawidth# = 2/3 staff_space#;
828         codaheight# = 1 staff_space#;
829
830         set_char_box(codawidth#+stickout#, codawidth#+stickout#,
831                 codaheight#+stickout#, codaheight#+stickout#);
832
833         define_pixels(codawidth, codaheight);
834         thin = 1.2 linethickness;
835         0.1 (codaheight - 2 thin)  = (codawidth - 2 thick);
836
837         penpos1(thick,0);
838         penpos2(thin,-90);
839         penpos3(thick,180);
840         x1l=-codawidth;
841         y2l=codaheight;
842         y1=0;
843         x2=0;
844         z3 = - z1;
845         penlabels(1,2,3);
846
847         path halfcoda;
848         halfcoda := z1l{up} .. z2l{right} .. z3l{down} -- 
849                 z3r{up} .. z2r{left} .. z1r{down} .. cycle;
850         fill halfcoda;
851         fill (halfcoda scaled -1);
852
853         draw_gridline((0,-h),(0,h),thin);
854         draw_gridline((-w,0),(w,0),thin);
855
856 fet_endchar;
857
858 fet_beginchar("Varied Coda", "varcoda", "varcoda")
859         save thin, thick, codawidth, codaheight;
860         thin# = 1.2 linethickness#;
861         thick# = 1.0 linethickness# + 0.25 staff_space#;
862         codawidth# = 2/3 staff_space#;
863         codaheight# = 1 staff_space#;
864         define_pixels(thin, thick, codawidth, codaheight);
865
866         set_char_box(codawidth#+thick#, codawidth#+thick#,
867                 codaheight#+thick#, codaheight#+thick#);
868
869         x1 = -codawidth;
870         y1 = y2 - thin;
871         x2 = 0;
872         y2 = codaheight;
873         draw_rounded_block(z1, z2, blot_diameter);
874
875         x3 = x1;
876         y3 = -blot_diameter;
877         x4 = x1 + thick;
878         y4 = y2;
879         draw_rounded_block(z3, z4, blot_diameter);
880         labels(1,2,3,4);
881
882         addto currentpicture also currentpicture xscaled -1;
883         addto currentpicture also currentpicture yscaled -1;
884
885         draw_gridline((0,-h),(0,h),thin);
886         draw_gridline((-w,0),(w,0),thin);
887 fet_endchar;
888
889 def draw_comma = 
890         save alpha, thick, thin, ht;
891         alpha:=35;
892         thin# = 1.2 linethickness#;
893         thick# = 3 linethickness#;
894         ht# = .6staff_space#;
895         define_pixels(thin, thick,ht);
896         set_char_box(0, .5staff_space#, ht#, ht#);
897
898         penpos1(thick, alpha);
899         penpos2(thick, alpha+90);
900         penpos3(thin, 180-alpha);
901         penpos4(thin, 90-alpha);
902         x3r=0;
903         x1l=x3l;
904         y2r=-y4l=h;
905         z1=z2;
906         z3=z4;
907         penlabels(1,2,3,4);
908         fill z1l{dir (alpha+90)} .. z2r{dir alpha} .. z1r{dir (alpha-90)} .. 
909         z3l{dir (270-alpha)} .. z4l{dir (alpha+180)} .. 
910         z3r{dir (90-alpha)} .. cycle;
911 enddef;
912
913 fet_beginchar("Right Comma","rcomma","rcomma");
914         draw_comma;
915 fet_endchar;
916
917 fet_beginchar("Left Comma","lcomma","lcomma");
918         draw_comma;
919         xy_mirror_char;
920 fet_endchar;
921
922 def draw_varcomma = 
923         save thick, thin, ht, wd, alpha;
924         alpha:=35;
925         thin# = 1.2 linethickness#;
926         thick# = 3 linethickness#;
927         ht# = .6 staff_space#;
928         wd# = .25 staff_space#;
929         define_pixels(thin, thick, ht, alpha);
930         set_char_box(wd#, wd#, ht#, ht#);
931         z1 = (-b, -d);
932         z2 = (w, h);
933         draw_brush(z1, thin, z2, thick);
934 enddef;
935
936 fet_beginchar("Right Varied Comma","rvarcomma","rvarcomma");
937         draw_varcomma;
938 fet_endchar;
939
940 fet_beginchar("Left Varied Comma","lvarcomma","lvarcomma");
941         draw_varcomma;
942         xy_mirror_char;
943 fet_endchar;
944
945 thick#:=1/24designsize;
946 define_blacker_pixels(thick);
947
948 rthin:= 0.075 *staff_space + 0.5 linethickness;
949 rthick:=2thick+rthin;
950
951 def draw_arpeggio =
952         save alpha;
953         alpha:=-40;
954         save ne,nw,se,sw; pair ne,nw,se,sw;
955         save x,y;
956         
957         se=dir alpha; nw=dir (alpha+180);
958         ne=dir (alpha+90); sw=dir (alpha-90);
959         penpos1(rthin,alpha+90);
960         penpos2(5/4rthick,alpha);
961         penpos4(5/4rthick,alpha);
962         penpos5(rthin,alpha+90);
963         penpos3(3/4rthick,alpha);
964
965         z1=(width/2, height) - overshoot*se;
966         z2=2[z4,(width/2,height/2)];
967         z3=1/2[z2,z4];
968         x4=2/8staff_space;
969         y4=rthin;
970
971         z5=2[z1,(width/2,height/2)];
972         z6=z2l+1/2rthin*sw;
973         z7=z4l+1/2rthin*sw+1/2rthin*se;
974         z8=2[z6,(width/2,height/2)];
975         z9=2[z7,(width/2,height/2)];
976         
977         fill z1l{se}..{se}z6..z3l..z7{se}..{se}z5l..z5r{nw}..{nw}z8..z3r..z9{nw}..{nw}z1r.. cycle;
978         penlabels(1,2,3,4,5,6,7,8,9);
979         enddef;
980
981 fet_beginchar("Arpeggio","arpeggio","arpeggio");
982         %draw_staff (-2, 2, 0.0);       
983         save height, overshoot, width;
984         height# = staff_space#;
985         width# = 0.8height#;
986         overshoot# = 0.25 staff_space#;
987         define_pixels (height,overshoot,width);
988         set_char_box(0, width#, 0, height#);
989         draw_arpeggio;
990         fet_endchar;
991
992 % Extendable Trill symbol.
993 % Not yet used
994 % Rename me to Trill, rename Trill to Tr?
995 fet_beginchar("Trill-element","trill-element","trillelement");
996         save height, overshoot;
997         height# = staff_space#;
998         width# = 0.8height#;
999         overshoot# = 0.25 staff_space#;
1000         define_pixels (height,overshoot,width);
1001         set_char_box(0, height#, 0, width#);
1002         draw_arpeggio;
1003         currentpicture := currentpicture shifted -(width/2, height/2);
1004         currentpicture := currentpicture rotated 90;
1005         currentpicture := currentpicture shifted (height/2, width/2);
1006         fet_endchar;
1007
1008
1009
1010 %
1011 % Arpeggio arrow by Chris Jackson <chris@fluffhouse.org.uk>
1012 %
1013
1014 def draw_arpeggio_arrow =
1015         save thinness, height, width, overshoot, se, sw, ne, nw, alpha;
1016         pair ne, nw, se, sw;
1017         height# = staff_space#;
1018         width# = 0.8height#;
1019         overshoot# = 0.25 staff_space#;
1020         define_pixels (height,overshoot,width);
1021         set_char_box(0, width#, 0, height#);
1022         alpha := -40;
1023         nw = dir (alpha+180);
1024         sw = dir (alpha-90); se = dir alpha;
1025
1026         penpos1(rthin,     alpha+90);
1027         penpos2(5/4 rthick, alpha);
1028         penpos3(5/4 rthick,     0);
1029
1030         z1 = (width/2, height) - overshoot*se; % numbering is consistent with the arpeggio symbol
1031         z2 = 2[z4,(width/2,height/2)];
1032         z3 = (0.5 width, 0.5 height);
1033         z4 = (0.25 staff_space, rthin);
1034         z6 = z2l + 1/2rthin*sw;
1035         z9 = (width/2, height) + overshoot*se;
1036         fill z1l {se}..{se} z6 .. z3l .. z3r.. z9{nw} ..{nw} z1r.. cycle;
1037
1038         bot z10 = ( 0.5w,  0   );
1039         lft z11 = (-0.3w,  0.8h);
1040         rt z12  = ( 1.3w,  0.8h);
1041         pickup pencircle scaled 0.5 rthin;
1042         filldraw z3 -- z12 {dir -130} ..  {dir -110} z10 {dir 110} ..  {dir 130} z11 -- cycle;
1043 enddef;
1044
1045 fet_beginchar("Arpeggio arrow down", "arpeggio-arrow--1", "arpeggioarrowdown");
1046         draw_arpeggio_arrow;
1047 fet_endchar;
1048
1049
1050 fet_beginchar("Arpeggio arrow up", "arpeggio-arrow-1", "arpeggioarrowup");
1051         draw_arpeggio_arrow;
1052         currentpicture := currentpicture scaled -1 shifted (0.8staff_space, staff_space);
1053 fet_endchar;
1054
1055
1056
1057
1058 % Hmm
1059 input feta-slag;
1060
1061 % railroad tracks.
1062 %
1063 % I actually have no clue how they should look, so we use a slightly curvy  
1064 % and tapered shape. 
1065 %
1066 fet_beginchar("Caesura", "caesura", "caesura");
1067   save slant, space_between, clearance;
1068   save alpha, p;
1069   save botthick, topthick;
1070   save krom ;
1071
1072   path p;
1073
1074   botthick = 1.5 linethickness;
1075   topthick = 2.5 linethickness;
1076   pickup pencircle scaled botthick;
1077
1078
1079   slant = 3.5 ;
1080   space_between# = 0.6 staff_space#;
1081   clearance# = 0.2 staff_space#;
1082   height# = 1.2 staff_space#;
1083
1084   set_char_box(0, 2.0 staff_space#, staff_space# - clearance#, height#);
1085   define_pixels (space_between, clearance, height);
1086
1087   bot y1 = -d;
1088   top y2 = h;
1089  
1090   lft x1 = 0;
1091   x2 = (y2 - y1) / slant;
1092
1093   krom = 10;
1094
1095   alpha = angle (z2 - z1);
1096   penpos1 (botthick, alpha - krom);
1097   penpos3 (botthick, alpha - krom + 90);
1098
1099   penpos2 (topthick, alpha + krom );
1100   penpos4 (topthick, alpha + krom + 90);
1101   z3 = z1; z4 = z2; 
1102   penlabels (1,2,3,4);
1103
1104   p  := z3r{(z1r - z1l)} .. z4r{z2r-z2l} .. z2r{z4l-z4r} .. z4l{z2l-z2r} .. z3l{z1l-z1r} .. z1l{z3r-z3l} .. cycle;
1105   fill p;
1106   fill p shifted (space_between , 0);
1107
1108 fet_endchar; 
1109
1110
1111 fet_endgroup("scripts");
1112