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