]> git.donarmstrong.com Git - lilypond.git/blob - mf/feta-schrift.mf
98ade6dbf9a15a2524c97d3b02947d880978c8e5
[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 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.5stafflinethickness#;
23   crook_fatness# = 4 stafflinethickness#;
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 %
61 % Thumbs are used in cello music.
62 % TODO : thumbs should look like the finger-font and should be placed in
63 % the same way in the score.
64 %
65
66 fet_beginchar("Thumb", "thumb", "thumb")
67         save thin, height, width, thick;
68         height# = 5/4 width#;
69         height# = staff_space#;
70         thin = 1.2 stafflinethickness;
71         thick =  2 thin;
72         set_char_box(width#/2, width#/2, height#/2, height#/2);
73         
74         penpos1(thick, 0);
75         penpos2(thin, 90);
76         z1r = (w, 0);
77         z2r = (0, h);
78         penlabels(1,2);
79         penstroke z1e{up} .. {left}z2e;
80         addto currentpicture also currentpicture xscaled -1;
81         addto currentpicture also currentpicture yscaled -1;
82
83         z3 = (0, -h);
84         z4 = (0, -1.5h);
85         penlabels(3,4);
86         draw_brush(z3,1.4*thin, z4,0.9*thick);
87 fet_endchar;
88
89 %
90 % FIXME: rounded endings
91 %
92 % `\accent' is TeX reserved.
93 fet_beginchar("> accent", "sforzato", "sforzatoaccent")
94         set_char_box(.9 staff_space#, .9 staff_space#, .5 staff_space#, .5 staff_space#);
95         save thickness, diminish;
96
97         thickness = 3/2 stafflinethickness;
98         pickup pencircle scaled thickness;
99
100         % prevent blobs at crossing lines
101         diminish = .75;
102
103         top y1 = h;
104         lft x1 = -b;
105         rt x2 = w;
106         y2 = .25 thickness* diminish;
107
108         rt z4 = (w,0);
109         x3 =0;
110         z3 = whatever [z1, z4];
111
112         penpos2(thickness*(2 - diminish)/2 , 90);
113         penpos1(thickness, 90);
114         penpos3(thickness, 90);
115
116         draw z1 .. z3;
117         draw (z1 .. z3) yscaled -1;
118         draw z4;
119         penstroke z3e .. z2e;
120         penstroke (z3e .. z2e) yscaled -1;
121
122         penlabels(1,2,3);
123         labels(4);
124 fet_endchar;
125
126 % Hmm, changed 1.5 to 1.4 to avoid problems with "random" placement of
127 % the dots because of quantization effects for almost integer values. /MB
128
129
130 %
131 % Hmm. Should not meddle with darkness of font. Check out the 
132 % correct value for radius. Maybe we'd better change padding --hwn
133 %
134 fet_beginchar("staccato dot", "staccato", "staccato")
135         save radius;
136         radius# = 1.4 stafflinethickness#;
137         define_whole_pixels(radius);
138         pickup pencircle scaled 2 radius;
139         drawdot (0,0);
140         set_char_box(radius#, radius#, radius#, radius#);
141 fet_endchar;
142
143 def draw_staccatissimo =
144         save radius, height;
145         height# = .8 staff_space#;
146         radius# = 2 stafflinethickness#;
147         define_whole_pixels(radius);
148         define_pixels(height);
149
150         draw_brush((0,0), stafflinethickness, (0, height),2 radius);
151         set_char_box(radius#,radius#, blot_diameter#/2, height# + radius#);
152 enddef;
153
154 fet_beginchar("staccatissimo/martellato up", "ustaccatissimo", 
155                 "ustaccatissimo")
156         draw_staccatissimo;
157 fet_endchar;
158
159 %
160 % FIXEM: scale labels too.
161 %
162 fet_beginchar("staccatissimo/martellato down", "dstaccatissimo", "dstaccatissimo")
163         draw_staccatissimo;
164         y_mirror_char;
165 fet_endchar;
166
167 fet_beginchar("portato/single tenuto", "tenuto", "tenuto")
168         save thick;
169         thick# = 1.4 stafflinethickness#;
170         define_whole_pixels(thick);
171
172         set_char_box(.6 staff_space#, .6 staff_space#, thick#/2,thick#/2);
173         pickup pencircle scaled thick;
174         draw_rounded_block((-b,-thick/2),(w,thick/2),thick);
175 fet_endchar;
176
177
178 %
179 % Portato by Heikki Junes <heikki.junes@hut.fi>
180 %
181
182 def draw_portato = 
183         save thick, radius;
184         thick# = 1.4 stafflinethickness#;
185         radius# = 1.4 stafflinethickness#;
186         define_whole_pixels(thick,radius);
187         
188         set_char_box(.6 staff_space#, .6 staff_space#, thick#/2,.5 staff_space#+ radius#);
189         draw_rounded_block((-b,-thick/2),(w,thick/2),thick);
190
191         pickup pencircle scaled 2 radius;
192         drawdot (0,h);
193 enddef;
194
195
196 fet_beginchar("portato/tenuto with staccato", "uportato", 
197                 "uportato")
198         draw_portato;
199 fet_endchar;
200
201
202 fet_beginchar("portato/tenuto with staccato", "dportato", 
203                 "dportato")
204         draw_portato;
205         y_mirror_char
206 fet_endchar;
207
208
209 def draw_marcato = 
210         save fat_factor, thinness;
211         set_char_box(staff_space#/2, staff_space#/2, 0, 1.1 staff_space#);
212
213         fat_factor = .3;
214         thinness =  stafflinethickness;
215
216         pickup pencircle scaled thinness;
217         rt x2 = w;
218         lft x5 = -b;
219         bot y5 = 0;
220         top y3 = h;
221         y1 = y2 = y5;
222
223         x3 =0;
224         z1 - z4 = whatever * (charwd, -charht);
225         z4 = fat_factor [z3, z5];
226
227         filldraw z1 -- z2 -- z3 -- z4 -- cycle;
228         draw z3 .. z5;
229 enddef;
230
231 fet_beginchar("marcato up", "umarcato", "umarcato")
232         draw_marcato;
233         labels(1,2,3,4,5);
234 fet_endchar;
235
236
237 %
238 % The down marcato char (not very much used). 
239 % Contrary to what some MF/TeX `gurus' believe
240 % it is *point*-symmetric with the "up" version
241 fet_beginchar("marcato down", "dmarcato", "dmarcato")
242         draw_marcato;
243         xy_mirror_char;
244 fet_endchar;
245  
246
247 %
248 % used in french horn music todo
249 %
250 % TODO: too light at 20pt
251 fet_beginchar("open (unstopped)", "open", "ouvert")
252         save thin, height, width, thick;
253         height# = 5/4 width#;
254         height# = staff_space#;
255         thin = 1.2 stafflinethickness;
256         thick =  1.4 thin;
257         set_char_box(width#/2, width#/2, height#/2, height#/2);
258         
259         penpos1(thick, 0);
260         penpos2(thin, 90);
261         z1r = (w, 0);
262         z2r = (0, h);
263         penlabels(1,2);
264         penstroke z1e{up} .. {left}z2e;
265         addto currentpicture also currentpicture xscaled -1;
266         addto currentpicture also currentpicture yscaled -1;
267 fet_endchar;
268
269
270 fet_beginchar("plus (stopped)", "stopped", "plusstop")
271         save thick, size;
272         thick = 2 stafflinethickness;
273         size# = 1.1 staff_space#;
274
275         set_char_box(size#/2, size#/2, size#/2, size#/2);
276         draw_rounded_block((-b,-thick/2),(w,thick/2),thick);
277         addto currentpicture also currentpicture rotated 90;
278 fet_endchar;
279
280
281 %
282 % A vee with tapered insides to prevent visual blotting
283 %
284
285 def draw_vee (expr width, height, thickness) =
286 begingroup
287         save diminish;
288
289         diminish = 0.75;
290
291         pickup pencircle scaled thickness;
292         
293         x1 = 0;
294         bot y1 = 0;
295         rt x2 =  w;
296         top y2 = h;
297
298         z3 = 0.6 [z2, z1];
299         penpos3(thickness, 0);
300         penpos4(thickness * diminish, 0);
301         x4r = thickness/2;
302         y4 = thickness/2;
303         labels(1,2);
304         penlabels(3,4);
305
306         draw z1;
307         draw z3 -- z2;
308         penstroke z3e .. z4e;
309         addto currentpicture also currentpicture xscaled -1;
310 endgroup;
311 enddef;
312
313 fet_beginchar("Upbow", "upbow", "upbow")
314         save ht, wd, thick, diminish;
315         
316         thick = 1.4 stafflinethickness;
317         wd# = 1.3 staff_space#;
318         ht# = 1.6 wd#; 
319         set_char_box(wd#/2, wd#/2, 0, ht#);
320         draw_vee (wd, ht, thick);
321 fet_endchar;
322
323
324 fet_beginchar("Downbow", "downbow", "downbow")
325         save stemthick, beamheight;
326         save wd,round;
327         define_pixels(wd)
328
329         wd# = 1.5 staff_space#;
330         stemthick = 1.2 stafflinethickness;
331         set_char_box(wd#/2, wd#/2, 0, 4/3 staff_space#);
332
333         beamheight = 4/10 h;
334
335         draw_rounded_block((-b,h-beamheight),(w,h),blot_diameter);
336         draw_rounded_block((-b,-d),(-b+stemthick,h-stemthick),stemthick);
337         addto currentpicture also currentpicture xscaled -1;
338 fet_endchar;
339
340 %
341 % Inspired by a computer-set version of Auf dem Strom by Baerenreiter. 
342 %
343
344 def draw_turn =
345         save thin, thick, ball_diam, darkness;
346         save wd, ht, thick_nibangle, ball_nib_thick;
347         save turndir;
348         pair turndir;
349
350         wd# = 35/16 staff_space#;
351         ht# = 18/17 staff_space#;
352         darkness = 1.20 stafflinethickness;
353
354         set_char_box(wd#/2, wd#/2, ht#/2, ht#/2);       
355
356         thick_nibangle = 60;
357         thick = 3 darkness;
358         thin = darkness;
359         ball_nib_thick = 2.7 darkness;
360         ball_diam = ball_nib_thick + (h - ball_nib_thick) / 10;
361
362         
363         x3l = w;
364         y3 = 0;
365         y4l = h;
366         x4 = x2;
367         x2l = w/2;
368         y2l = -d;
369         z1 = (0,0);
370
371         penpos1(1.1 thick, thick_nibangle);
372         penpos2(thick, thick_nibangle);
373         penpos3(thin, 180);
374         penpos4(ball_nib_thick, -90);
375
376         path swoosh, ploop;
377         swoosh :=  z1l{curl 0} .. z2l .. z3l{up} .. {left}z4l 
378           -- z4r .. z3r{down} .. z2r{left} ;
379         fill swoosh .. (swoosh scaled -1) .. cycle;
380
381         x5r = x4;
382         y5r = y4l - ball_diam /2;
383         z6r = z5r;
384
385         penpos5(1.6 ball_diam/2, 10);
386         penpos6(ball_diam/2, 150);
387
388         ploop := z4l{left} .. z5l .. z6l -- cycle;
389         fill ploop;
390         fill ploop scaled -1;
391
392
393 enddef;
394
395 fet_beginchar("Reverse turn","reverseturn","reverseturn")
396         draw_turn;
397         currentpicture := currentpicture yscaled -1;
398         penlabels(5,6,7);
399         penlabels(2,3,4);
400 fet_endchar;
401
402
403 fet_beginchar("Turn","turn","turn")
404         draw_turn;
405                 
406         penlabels(5,6,7);
407         penlabels(1,2,3,4);
408 fet_endchar;
409
410
411
412 %
413 % Inspired by a (by now) PD edition of Durand & C'ie edition of 
414 % Saint-Saens' Celloconcerto no. 1 
415 %
416 % FIXME take out hardcoded vars.
417 % FIXME the two loops on the `t' should be smoother (and the left one bigger).
418 % FIXME generic macros for serifs: top of the t and bottom of r
419 %
420
421
422 fet_beginchar("Trill (`tr')","trill","trill")
423         
424         save start_nib_angle,  ascender_extra, ex, hair_thick, fatness,
425           slant_angle, slant, t_fatness, r_fatness, kerning, t_overshoot, 
426           uitschieter, bulb_size;
427         ;
428         pair slant_vec;
429
430         ascender_extra# = 1/2 ex#;
431         ascender# = ascender_extra# + ex#;
432         ex# = 1.4 staff_space#;
433         kerning# = .60 ex#;
434         start_nib_angle = 20;
435         bulb_size = 0.70;
436         define_pixels(ex, ascender_extra, ascender, kerning);
437
438         t_overshoot = 0.03 ex;
439         fatness = 12/40 ex;
440         t_fatness = 0.78 fatness;
441         t_width =  1.9 t_fatness;
442         r_fatness = 0.78 fatness;
443         uitschieter = 0.48 ex;
444         hair_thick =  blot_diameter;
445         r_flare = 0.45  r_fatness;
446         r_width =  2 r_fatness + 0.25 kerning;
447         slant = .2;
448
449 %       slant = .0;
450
451         local_copy(transform)(currenttransform);
452         currenttransform := currenttransform slanted slant shifted (- staff_space, 0)  ;
453
454         y1 = ascender;
455         x1l = 0;
456         x1r = t_fatness;
457         penpos1(start_nib_wid, start_nib_angle);
458         
459         z2 = (x1, 7/18 ex);
460         penpos2(start_nib_wid, start_nib_angle);
461
462         z3l = (0.5 t_width, - t_overshoot);
463
464         z4l = (t_width, 0.23 ex);
465         penpos4(whatever, 200);
466         x4l - x4r = hair_thick;
467
468         x3r = 0.5 [x4r, x2r];
469 %       1.7 [x3l, x3r] = x4r;
470         y3r - y3l = 0.6 t_fatness;
471
472         
473         save t_p, krul_p;
474         path t_p, krul_p, r_p;
475
476         z5 = (t_fatness/2, 2/3 ex);
477 %       penpos5(hair_thick, ); 
478
479         t_p := z1r{dir (angle(z1l-z1r) + 30)} .. z1l{-dir (angle(z1r-z1l) - 45)}
480                 -- z2l {down}
481                 .. tension (1 + .5 slant)
482                 .. z3l{right} 
483                 
484                 .. z4l{up} -- z4r{down} 
485                 .. z3r{left}
486                 .. tension (1.5 + .7 slant)
487                 .. z2r{up} .. z1r -- cycle;
488         fill t_p ;
489
490         krul_ang = 32;
491
492         pickup pencircle scaled hair_thick;
493         
494         lft x6 = - uitschieter;
495         y6 =  y5 ; % - 1/20 ex;
496
497         z7 = z5 + whatever*dir krul_ang;
498         up_angle = krul_ang;
499         % angle (z7-z5)
500         x7 = 5/10 kerning + x5;
501         
502         penpos7(hair_thick, up_angle + 90);
503
504         
505         y9 = 3/4 ex;
506         x9 = x1 + kerning;
507         penpos9(r_fatness, 0);
508
509         x10 = x9;
510         y10 =  -0.3 stafflinethickness;
511         penpos10(r_fatness, 0);
512
513         krul_p := z4{up}
514                 .. tension 0.98
515                 .. z5
516                 .. z6
517                 .. z5 --- z7;
518         draw krul_p;
519         r_p := z7l{z7-z5} .. z9l{down} --- simple_serif (z10l, z10r, -30)
520                 --- z9r{up} 
521                  ..  z7r{z5-z7} -- cycle;
522         fill r_p;
523
524         set_char_box(.85 staff_space# , .85 staff_space#, 0,ascender#);
525
526
527         penpos11(1/4 r_fatness, -4);
528         z11r = z9r;
529         
530         z13l = (x9l + r_width, y11 -  stafflinethickness );
531         penpos13(r_flare, 180);
532
533         z15 = z13r  - (bulb_size * r_fatness,0);
534         z14 = 0.5 [z13l, z15] - (0,bulb_size* r_fatness);
535         z16 = 0.5 [z13l, z15] + (0,bulb_size* r_fatness);
536
537
538         fill z11r{up} .. tension 0.94 .. z13r{down} -- z15{down}
539                 .. tension 1.0 .. z13l{up}
540                 .. z11l{down} -- cycle;
541
542         fill z15{up} .. tension 1.06 .. z13l{down} .. z14 .. cycle;
543
544
545
546         penlabels(range 1 thru 15);
547
548 fet_endchar;
549
550
551 def draw_heel =
552         save radius, thickness, wall;
553
554         radius# := .5 staff_space#;
555
556         define_pixels(radius);
557         set_char_box(radius#, radius#, radius#, 2/3 staff_space#);
558
559         thickness := 1.5 stafflinethickness;    
560         pickup pencircle scaled thickness;
561         rt x1 = b;
562         top y1 = h;
563         
564         x2 =x1;
565         y2 = 0;
566
567         x3 = 0;
568         bot y3 = -d;
569
570         draw z1{down} .. z2{down} .. z3{left};
571         addto currentpicture also currentpicture xscaled -1;
572         
573 enddef;
574
575
576 fet_beginchar("left heel", "upedalheel", "upedalheel")
577         draw_heel;
578         labels(1,2,3);
579 fet_endchar;
580
581 fet_beginchar("right heel", "dpedalheel", "dpedalheel")
582         draw_heel;
583         y_mirror_char;
584 fet_endchar;
585
586 def draw_toe =
587         save ht,wd;
588
589         thickness := 1.5 stafflinethickness;
590         ht# := 1.5 staff_space#;
591         wd# := 1/3 ht#;
592         define_pixels(ht,wd);
593
594
595         set_char_box(wd#, wd#, 0, ht#);
596         draw_vee (wd, ht, thickness);
597 enddef;
598         
599 fet_beginchar("left toe", "upedaltoe", "upedaltoe")
600         draw_toe;
601         labels(1,2,3);
602 fet_endchar;
603 fet_beginchar("right toe", "dpedaltoe", "dpedaltoe")
604         draw_toe;
605         y_mirror_char;
606 fet_endchar;
607
608 fet_beginchar("Flageolet", "flageolet", "flageolet")
609         save height,width,thickness;
610         height#=4/15 staffsize#;
611         width#=height#;
612         thickness#=blot_diameter#;
613         define_pixels(height,width,thickness);
614         set_char_box(width#/2,width#/2,height#/2,height#/2);
615         
616         pickup pencircle scaled thickness;
617         x1= .5 [x2, x4];
618         x1 = 0;
619         top y1=height/2;
620         rt x4  - lft x2 =width; 
621         y2 = 0;
622         y4=y2;
623         x3=x1;
624         bot y3=-height/2;
625
626         penlabels(1,2,3,4);
627         draw z1..z2..z3..z4..cycle;
628 fet_endchar;
629
630 fet_beginchar("Segno", "segno", "segno")
631         save thin, thick, ball_diam, darkness, pointheight;
632         save wd, ht, thick_nibangle, ball_nib_thick;
633         save turndir;
634         pair turndir;
635
636         ht# = 3 staff_space#;
637         wd# = 2 staff_space#;
638         darkness = 1.20 stafflinethickness;
639
640         set_char_box(wd#/2, wd#/2, ht#/2, ht#/2);       
641
642         thick_nibangle = 30;
643         thick = 3 darkness;
644         thin = darkness;
645         ball_nib_thick = 2.7 darkness;
646         ball_diam = ball_nib_thick + (w - ball_nib_thick) / 10;
647         pointheight = 2 stafflinethickness;
648         
649         y3l = h;
650         2 x3 = x2 + x4;
651         x4 = 0;
652         y4 = y2;
653         y2l = .6 h;
654         x2l = -b;
655         z1 = (0,0);
656
657         penpos1(thick, 2 thick_nibangle);
658         penpos2(thick, thick_nibangle);
659         penpos3(thin, -90);
660         penpos4(ball_nib_thick, 180-thick_nibangle);
661
662         path swoosh, ploop;
663         swoosh :=  z1l{curl 0} .. z2l .. z3l{right} .. {down}z4l 
664           -- z4r .. z3r{left} .. z2r{down} ;
665         fill swoosh .. (swoosh scaled -1) .. cycle;
666         penlabels(1,2,3,4);
667
668         y5r = y4;
669         x5r = x4l - ball_diam /2;
670         z6r = z5r;
671
672         penpos5(1.6 ball_diam/2, 100);
673         penpos6(ball_diam/2, 240);
674
675         ploop := z4l{down} .. z5l .. z6l -- cycle;
676         fill ploop;
677         fill ploop scaled -1;
678         penlabels(4,5,6);
679
680         penpos7(2 thin,0);
681         z7l=(-b,-d);
682         penpos8(2 thin,0);
683         z8r=(w,h);
684         filldraw z7l--z8l{right}--z8r{down}--z7r{right}--cycle;
685         pickup pencircle scaled 2 thin;
686         draw (-x2r,pointheight);
687         draw (x2r,-pointheight);
688 fet_endchar;
689
690 fet_beginchar("Coda", "coda", "coda")
691         save thin, thick, codawidth, codaheight;
692         thin# = 1.2 stafflinethickness#;
693         thick# = 3.5 stafflinethickness#;
694         codawidth# = 2/3 staff_space#;
695         codaheight# = 1 staff_space#;
696         define_pixels(thin, thick, codawidth, codaheight);
697
698         set_char_box(codawidth#+thick#, codawidth#+thick#,
699                 codaheight#+thick#, codaheight#+thick#);
700
701         penpos1(thick,0);
702         penpos2(thin,-90);
703         penpos3(thick,180);
704         x1l=-codawidth;
705         y2l=codaheight;
706         y1=0;
707         x2=0;
708         z3 = - z1;
709         penlabels(1,2,3);
710
711         path halfcoda;
712         halfcoda := z1l{up} .. z2l{right} .. z3l{down} -- 
713                 z3r{up} .. z2r{left} .. z1r{down} .. cycle;
714         fill halfcoda;
715         fill (halfcoda scaled -1);
716
717         draw_gridline((0,-h),(0,h),thin);
718         draw_gridline((-w,0),(w,0),thin);
719
720 fet_endchar;
721
722 def draw_comma = 
723         save alpha, thick, thin, ht;
724         alpha:=35;
725         thin# = 1.2 stafflinethickness#;
726         thick# = 3 stafflinethickness#;
727         ht# = .6staff_space#;
728         define_pixels(thin, thick,ht);
729         set_char_box(0, .5staff_space#, ht#, ht#);
730
731         penpos1(thick, alpha);
732         penpos2(thick, alpha+90);
733         penpos3(thin, 180-alpha);
734         penpos4(thin, 90-alpha);
735         x3r=0;
736         x1l=x3l;
737         y2r=-y4l=h;
738         z1=z2;
739         z3=z4;
740         penlabels(1,2,3,4);
741         fill z1l{dir (alpha+90)} .. z2r{dir alpha} .. z1r{dir (alpha-90)} .. 
742         z3l{dir (270-alpha)} .. z4l{dir (alpha+180)} .. 
743         z3r{dir (90-alpha)} .. cycle;
744 enddef;
745
746 fet_beginchar("Right Comma","rcomma","rcomma");
747         draw_comma;
748 fet_endchar;
749
750 fet_beginchar("Left Comma","lcomma","lcomma");
751         draw_comma;
752         xy_mirror_char;
753 fet_endchar;
754
755 thick#:=1/24designsize;
756 define_blacker_pixels(thick);
757
758 rthin:=1/8*staff_space;
759 rthick:=2thick+rthin;
760
761 def draw_arpeggio =
762         save alpha;
763         alpha:=-40;
764         save ne,nw,se,sw; pair ne,nw,se,sw;
765         save x,y;
766         
767         se=dir alpha; nw=dir (alpha+180);
768         ne=dir (alpha+90); sw=dir (alpha-90);
769         penpos1(rthin,alpha+90);
770         penpos2(5/4rthick,alpha);
771         penpos4(5/4rthick,alpha);
772         penpos5(rthin,alpha+90);
773         penpos3(3/4rthick,alpha);
774
775         z1=(width/2, height) - overshoot*se;
776         z2=2[z4,(width/2,height/2)];
777         z3=1/2[z2,z4];
778         x4=2/8staff_space;
779         y4=rthin;
780
781         z5=2[z1,(width/2,height/2)];
782         z6=z2l+1/2rthin*sw;
783         z7=z4l+1/2rthin*sw+1/2rthin*se;
784         z8=2[z6,(width/2,height/2)];
785         z9=2[z7,(width/2,height/2)];
786         
787         fill z1l{se}..{se}z6..z3l..z7{se}..{se}z5l..z5r{nw}..{nw}z8..z3r..z9{nw}..{nw}z1r.. cycle;
788         penlabels(1,2,3,4,5,6,7,8,9);
789         enddef;
790
791 fet_beginchar("Arpeggio","arpeggio","arpeggio");
792         %draw_staff (-2, 2, 0.0);       
793         save height, overshoot, width;
794         height# = staff_space#;
795         width# = 0.8height#;
796         overshoot# = 0.25 staff_space#;
797         define_pixels (height,overshoot,width);
798         set_char_box(0, width#, 0, height#);
799         draw_arpeggio;
800         fet_endchar;
801
802 % Extendable Trill symbol.
803 % Not yet used
804 % Rename me to Trill, rename Trill to Tr?
805 fet_beginchar("Trill-element","trill-element","trillelement");
806         save height, overshoot;
807         height# = staff_space#;
808         width# = 0.8height#;
809         overshoot# = 0.25 staff_space#;
810         define_pixels (height,overshoot,width);
811         set_char_box(0, height#, 0, width#);
812         draw_arpeggio;
813         currentpicture := currentpicture shifted -(width/2, height/2);
814         currentpicture := currentpicture rotated 90;
815         currentpicture := currentpicture shifted (height/2, width/2);
816         fet_endchar;
817
818
819
820 %
821 % Arpeggio arrow by Chris Jackson <chris@fluffhouse.org.uk>
822 %
823
824 def draw_arpeggio_arrow =
825         save thinness, height, width, overshoot, se, sw, ne, nw, alpha;
826         pair ne, nw, se, sw;
827         height# = staff_space#;
828         width# = 0.8height#;
829         overshoot# = 0.25 staff_space#;
830         define_pixels (height,overshoot,width);
831         set_char_box(0, width#, 0, height#);
832         alpha := -40;
833         nw = dir (alpha+180);
834         sw = dir (alpha-90); se = dir alpha;
835
836         penpos1(rthin,     alpha+90);
837         penpos2(5/4 rthick, alpha);
838         penpos3(5/4 rthick,     0);
839
840         z1 = (width/2, height) - overshoot*se; % numbering is consistent with the arpeggio symbol
841         z2 = 2[z4,(width/2,height/2)];
842         z3 = (0.5 width, 0.5 height);
843         z4 = (0.25 staff_space, rthin);
844         z6 = z2l + 1/2rthin*sw;
845         z9 = (width/2, height) + overshoot*se;
846         fill z1l {se}..{se} z6 .. z3l .. z3r.. z9{nw} ..{nw} z1r.. cycle;
847
848         bot z10 = ( 0.5w,  0   );
849         lft z11 = (-0.3w,  0.8h);
850         rt z12  = ( 1.3w,  0.8h);
851         pickup pencircle scaled 0.5 rthin;
852         filldraw z3 -- z12 {dir -130} ..  {dir -110} z10 {dir 110} ..  {dir 130} z11 -- cycle;
853 enddef;
854
855 fet_beginchar("Arpeggio arrow down", "arpeggio-arrow--1", "arpeggioarrowdown");
856         draw_arpeggio_arrow;
857 fet_endchar;
858
859
860 fet_beginchar("Arpeggio arrow up", "arpeggio-arrow-1", "arpeggioarrowup");
861         draw_arpeggio_arrow;
862         currentpicture := currentpicture scaled -1 shifted (0.8staff_space, staff_space);
863 fet_endchar;
864
865
866
867
868 % Hmm
869 input feta-slag;
870
871
872
873 fet_endgroup("scripts");
874