]> git.donarmstrong.com Git - lilypond.git/blob - mf/feta-schrift.mf
release: 1.5.42
[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 % FIXME: blotting 
282 %
283 fet_beginchar("Upbow", "upbow", "upbow")
284         save ht, wd, thick;
285
286         thick = 1.4 stafflinethickness;
287         wd# = 1.3 staff_space#;
288         ht# = 1.6 wd#; 
289
290         
291         set_char_box(wd#/2, wd#/2, 0, ht#);
292         pickup pencircle scaled thick;
293
294         x1 = 0;
295         bot y1 = 0;
296         rt x2 =  w;
297         top y2 = h;
298
299         labels(1,2);
300         draw z2 -- z1 -- (z2 xscaled -1);
301 fet_endchar;
302
303
304 fet_beginchar("Downbow", "downbow", "downbow")
305         save stemthick, beamheight;
306         save wd,round;
307         define_pixels(wd)
308
309         wd# = 1.5 staff_space#;
310         stemthick = 1.2 stafflinethickness;
311         set_char_box(wd#/2, wd#/2, 0, 4/3 staff_space#);
312
313         beamheight = 4/10 h;
314
315         draw_rounded_block((-b,h-beamheight),(w,h),blot_diameter);
316         draw_rounded_block((-b,-d),(-b+stemthick,h-stemthick),stemthick);
317         addto currentpicture also currentpicture xscaled -1;
318 fet_endchar;
319
320 %
321 % Inspired by a computer-set version of Auf dem Strom by Baerenreiter. 
322 %
323
324 def draw_turn =
325         save thin, thick, ball_diam, darkness;
326         save wd, ht, thick_nibangle, ball_nib_thick;
327         save turndir;
328         pair turndir;
329
330         wd# = 35/16 staff_space#;
331         ht# = 18/17 staff_space#;
332         darkness = 1.20 stafflinethickness;
333
334         set_char_box(wd#/2, wd#/2, ht#/2, ht#/2);       
335
336         thick_nibangle = 60;
337         thick = 3 darkness;
338         thin = darkness;
339         ball_nib_thick = 2.7 darkness;
340         ball_diam = ball_nib_thick + (h - ball_nib_thick) / 10;
341
342         
343         x3l = w;
344         y3 = 0;
345         y4l = h;
346         x4 = x2;
347         x2l = w/2;
348         y2l = -d;
349         z1 = (0,0);
350
351         penpos1(1.1 thick, thick_nibangle);
352         penpos2(thick, thick_nibangle);
353         penpos3(thin, 180);
354         penpos4(ball_nib_thick, -90);
355
356         path swoosh, ploop;
357         swoosh :=  z1l{curl 0} .. z2l .. z3l{up} .. {left}z4l 
358           -- z4r .. z3r{down} .. z2r{left} ;
359         fill swoosh .. (swoosh scaled -1) .. cycle;
360
361         x5r = x4;
362         y5r = y4l - ball_diam /2;
363         z6r = z5r;
364
365         penpos5(1.6 ball_diam/2, 10);
366         penpos6(ball_diam/2, 150);
367
368         ploop := z4l{left} .. z5l .. z6l -- cycle;
369         fill ploop;
370         fill ploop scaled -1;
371
372
373 enddef;
374
375 fet_beginchar("Reverse turn","reverseturn","reverseturn")
376         draw_turn;
377         currentpicture := currentpicture yscaled -1;
378         penlabels(5,6,7);
379         penlabels(2,3,4);
380 fet_endchar;
381
382
383 fet_beginchar("Turn","turn","turn")
384         draw_turn;
385                 
386         penlabels(5,6,7);
387         penlabels(1,2,3,4);
388 fet_endchar;
389
390
391
392 %
393 % Inspired by a (by now) PD edition of Durand & C'ie edition of 
394 % Saint-Saens' Celloconcerto no. 1 
395 %
396 % FIXME take out hardcoded vars.
397 % FIXME the two loops on the `t' should be smoother (and the left one bigger).
398 % FIXME generic macros for serifs: top of the t and bottom of r
399 %
400
401
402 fet_beginchar("Trill (`tr')","trill","trill")
403         
404         save start_nib_angle,  ascender_extra, ex, hair_thick, fatness,
405           slant_angle, slant, t_fatness, r_fatness, kerning, t_overshoot, 
406           uitschieter, bulb_size;
407         ;
408         pair slant_vec;
409
410         ascender_extra# = 1/2 ex#;
411         ascender# = ascender_extra# + ex#;
412         ex# = 1.4 staff_space#;
413         kerning# = .550 ex#;
414         start_nib_angle = 20;
415         bulb_size = 0.55;
416         define_pixels(ex, ascender_extra, ascender, kerning);
417
418         t_overshoot = 0.03 ex;
419         fatness = 12/40 ex;
420         t_fatness = 0.780 fatness;
421         t_width =  1.8 t_fatness;
422         r_fatness = 0.75 fatness;
423         uitschieter = 0.43 ex;
424         hair_thick =  blot_diameter;
425
426         slant = .2;
427 %       slant = .0;
428
429         local_copy(transform)(currenttransform);
430         currenttransform := currenttransform slanted slant shifted (- staff_space, 0)  ;
431
432         y1 = ascender;
433         x1l = 0;
434         x1r = t_fatness;
435         penpos1(start_nib_wid, start_nib_angle);
436         
437         z2 = (x1, 7/18 ex);
438         penpos2(start_nib_wid, start_nib_angle);
439
440         z3l = (0.5 t_width, - t_overshoot);
441
442         z4l = (t_width, 0.23 ex);
443         penpos4(whatever, 200);
444         x4l - x4r = hair_thick;
445
446         x3r = 0.5 [x4r, x2r];
447 %       1.7 [x3l, x3r] = x4r;
448         y3r - y3l = 0.6 t_fatness;
449
450         
451         save t_p, krul_p;
452         path t_p, krul_p, r_p;
453
454         z5 = (t_fatness/2, 2/3 ex);
455 %       penpos5(hair_thick, ); 
456
457         t_p := simple_serif (z1r, z1l, -40) -- z2l {down}
458                 .. tension (1 + .5 slant)
459                 .. z3l{right} 
460                 
461                 .. z4l{up} -- z4r{down} 
462                 .. z3r{left}
463                 .. tension (1.5 + .7 slant)
464                 .. z2r{up} .. z1r -- cycle;
465         fill t_p ;
466
467         krul_ang = 32;
468
469         pickup pencircle scaled hair_thick;
470         
471         lft x6 = - uitschieter;
472         y6 =  y5 ; % - 1/20 ex;
473
474         z7 = z5 + whatever*dir krul_ang;
475         up_angle = krul_ang;
476         % angle (z7-z5)
477         x7 = 5/10 kerning + x5;
478         
479         penpos7(hair_thick, up_angle + 90);
480
481         
482         y9 = 3/4 ex;
483         x9 = x1 + kerning;
484         penpos9(r_fatness, 0);
485
486         x10 = x9;
487         y10 =  -0.3 stafflinethickness;
488         penpos10(r_fatness, 0);
489
490         krul_p := z4{up}
491                 .. tension 0.98
492                 .. z5
493                 .. z6
494                 .. z5 --- z7;
495         draw krul_p;
496         r_p := z7l{z7-z5} .. z9l{down} --- simple_serif (z10l, z10r, -30)
497                 --- z9r{up} 
498                  ..  z7r{z5-z7} -- cycle;
499         fill r_p;
500
501         set_char_box(.85 staff_space# , .85 staff_space#, 0,ascender#);
502
503
504         penpos11(1/4 r_fatness, -20);
505         z11r = z9r;
506         
507         z13 = (x9 + 1.9 r_fatness, y11 -  stafflinethickness );
508         penpos13(0.45  r_fatness, 170);
509
510         z15 = z13r  - (bulb_size * r_fatness,0);
511         z14 = 0.5 [z13l, z15] - (0,bulb_size* r_fatness);
512         z16 = 0.5 [z13l, z15] + (0,bulb_size* r_fatness);
513
514
515         fill z11r{dir 70} .. tension 0.94 .. z13r{down} -- z15{down}
516                 .. tension 0.97 .. z13l{up}
517                 .. z11l{dir 250} -- cycle;
518
519         fill z15{up} .. tension 1.1 .. z13l{down} .. z14 .. cycle;
520
521
522
523         penlabels(range 1 thru 15);
524
525 fet_endchar;
526
527
528 def draw_heel =
529         save radius, thickness, wall;
530
531         radius# := .5 staff_space#;
532
533         define_pixels(radius);
534         set_char_box(radius#, radius#, radius#, 2/3 staff_space#);
535
536         thickness := 1.5 stafflinethickness;    
537         pickup pencircle scaled thickness;
538         rt x1 = b;
539         top y1 = h;
540         
541         x2 =x1;
542         y2 = 0;
543
544         x3 = 0;
545         bot y3 = -d;
546
547         draw z1{down} .. z2{down} .. z3{left};
548         addto currentpicture also currentpicture xscaled -1;
549         
550 enddef;
551
552
553 fet_beginchar("left heel", "upedalheel", "upedalheel")
554         draw_heel;
555         labels(1,2,3);
556 fet_endchar;
557
558 fet_beginchar("right heel", "dpedalheel", "dpedalheel")
559         draw_heel;
560         y_mirror_char;
561 fet_endchar;
562
563 def draw_toe =
564         save ht,wd;
565
566         thickness := 1.5 stafflinethickness;
567         ht# := 1.5 staff_space#;
568         wd# := 1/3 ht#;
569         define_pixels(ht,wd);
570
571
572         set_char_box(wd#, wd#, 0, ht#);
573         
574         pickup pencircle scaled thickness;
575         lft x1 = -b;
576         bot y1 = 0;
577         x2 =0;
578         top y2 = h;
579         z3 = z1 xscaled -1;
580
581
582         draw z1 -- z2 -- z3;
583
584 enddef;
585         
586 fet_beginchar("left toe", "upedaltoe", "upedaltoe")
587         draw_toe;
588         labels(1,2,3);
589 fet_endchar;
590 fet_beginchar("right toe", "dpedaltoe", "dpedaltoe")
591         draw_toe;
592         y_mirror_char;
593 fet_endchar;
594
595 fet_beginchar("Flageolet", "flageolet", "flageolet")
596         save height,width,thickness;
597         height#=4/15 staffsize#;
598         width#=height#;
599         thickness#=blot_diameter#;
600         define_pixels(height,width,thickness);
601         set_char_box(width#/2,width#/2,height#/2,height#/2);
602         
603         pickup pencircle scaled thickness;
604         x1= .5 [x2, x4];
605         x1 = 0;
606         top y1=height/2;
607         rt x4  - lft x2 =width; 
608         y2 = 0;
609         y4=y2;
610         x3=x1;
611         bot y3=-height/2;
612
613         penlabels(1,2,3,4);
614         draw z1..z2..z3..z4..cycle;
615 fet_endchar;
616
617 fet_beginchar("Segno", "segno", "segno")
618         save thin, thick, ball_diam, darkness, pointheight;
619         save wd, ht, thick_nibangle, ball_nib_thick;
620         save turndir;
621         pair turndir;
622
623         ht# = 3 staff_space#;
624         wd# = 2 staff_space#;
625         darkness = 1.20 stafflinethickness;
626
627         set_char_box(wd#/2, wd#/2, ht#/2, ht#/2);       
628
629         thick_nibangle = 30;
630         thick = 3 darkness;
631         thin = darkness;
632         ball_nib_thick = 2.7 darkness;
633         ball_diam = ball_nib_thick + (w - ball_nib_thick) / 10;
634         pointheight = 2 stafflinethickness;
635         
636         y3l = h;
637         2 x3 = x2 + x4;
638         x4 = 0;
639         y4 = y2;
640         y2l = .6 h;
641         x2l = -b;
642         z1 = (0,0);
643
644         penpos1(thick, 2 thick_nibangle);
645         penpos2(thick, thick_nibangle);
646         penpos3(thin, -90);
647         penpos4(ball_nib_thick, 180-thick_nibangle);
648
649         path swoosh, ploop;
650         swoosh :=  z1l{curl 0} .. z2l .. z3l{right} .. {down}z4l 
651           -- z4r .. z3r{left} .. z2r{down} ;
652         fill swoosh .. (swoosh scaled -1) .. cycle;
653         penlabels(1,2,3,4);
654
655         y5r = y4;
656         x5r = x4l - ball_diam /2;
657         z6r = z5r;
658
659         penpos5(1.6 ball_diam/2, 100);
660         penpos6(ball_diam/2, 240);
661
662         ploop := z4l{down} .. z5l .. z6l -- cycle;
663         fill ploop;
664         fill ploop scaled -1;
665         penlabels(4,5,6);
666
667         penpos7(2 thin,0);
668         z7l=(-b,-d);
669         penpos8(2 thin,0);
670         z8r=(w,h);
671         filldraw z7l--z8l{right}--z8r{down}--z7r{right}--cycle;
672         pickup pencircle scaled 2 thin;
673         draw (-x2r,pointheight);
674         draw (x2r,-pointheight);
675 fet_endchar;
676
677 fet_beginchar("Coda", "coda", "coda")
678         save thin, thick, codawidth, codaheight;
679         thin# = 1.2 stafflinethickness#;
680         thick# = 3.5 stafflinethickness#;
681         codawidth# = 2/3 staff_space#;
682         codaheight# = 1 staff_space#;
683         define_pixels(thin, thick, codawidth, codaheight);
684
685         set_char_box(codawidth#+thick#, codawidth#+thick#,
686                 codaheight#+thick#, codaheight#+thick#);
687
688         penpos1(thick,0);
689         penpos2(thin,-90);
690         penpos3(thick,180);
691         x1l=-codawidth;
692         y2l=codaheight;
693         y1=0;
694         x2=0;
695         z3 = - z1;
696         penlabels(1,2,3);
697
698         path halfcoda;
699         halfcoda := z1l{up} .. z2l{right} .. z3l{down} -- 
700                 z3r{up} .. z2r{left} .. z1r{down} .. cycle;
701         fill halfcoda;
702         fill (halfcoda scaled -1);
703
704         draw_gridline((0,-h),(0,h),thin);
705         draw_gridline((-w,0),(w,0),thin);
706
707 fet_endchar;
708
709 def draw_comma = 
710         save alpha, thick, thin, ht;
711         alpha:=35;
712         thin# = 1.2 stafflinethickness#;
713         thick# = 3 stafflinethickness#;
714         ht# = .6staff_space#;
715         define_pixels(thin, thick,ht);
716         set_char_box(0, .5staff_space#, ht#, ht#);
717
718         penpos1(thick, alpha);
719         penpos2(thick, alpha+90);
720         penpos3(thin, 180-alpha);
721         penpos4(thin, 90-alpha);
722         x3r=0;
723         x1l=x3l;
724         y2r=-y4l=h;
725         z1=z2;
726         z3=z4;
727         penlabels(1,2,3,4);
728         fill z1l{dir (alpha+90)} .. z2r{dir alpha} .. z1r{dir (alpha-90)} .. 
729         z3l{dir (270-alpha)} .. z4l{dir (alpha+180)} .. 
730         z3r{dir (90-alpha)} .. cycle;
731 enddef;
732
733 fet_beginchar("Right Comma","rcomma","rcomma");
734         draw_comma;
735 fet_endchar;
736
737 fet_beginchar("Left Comma","lcomma","lcomma");
738         draw_comma;
739         xy_mirror_char;
740 fet_endchar;
741
742 thick#:=1/24designsize;
743 define_blacker_pixels(thick);
744
745 rthin:=1/8*staff_space;
746 rthick:=2thick+rthin;
747
748 def draw_arpeggio =
749         save alpha;
750         alpha:=-40;
751         save ne,nw,se,sw; pair ne,nw,se,sw;
752         save x,y;
753         
754         se=dir alpha; nw=dir (alpha+180);
755         ne=dir (alpha+90); sw=dir (alpha-90);
756         penpos1(rthin,alpha+90);
757         penpos2(5/4rthick,alpha);
758         penpos4(5/4rthick,alpha);
759         penpos5(rthin,alpha+90);
760         penpos3(3/4rthick,alpha);
761
762         z1=(width/2, height) - overshoot*se;
763         z2=2[z4,(width/2,height/2)];
764         z3=1/2[z2,z4];
765         x4=2/8staff_space;
766         y4=rthin;
767
768         z5=2[z1,(width/2,height/2)];
769         z6=z2l+1/2rthin*sw;
770         z7=z4l+1/2rthin*sw+1/2rthin*se;
771         z8=2[z6,(width/2,height/2)];
772         z9=2[z7,(width/2,height/2)];
773         
774         fill z1l{se}..{se}z6..z3l..z7{se}..{se}z5l..z5r{nw}..{nw}z8..z3r..z9{nw}..{nw}z1r.. cycle;
775         penlabels(1,2,3,4,5,6,7,8,9);
776         enddef;
777
778 fet_beginchar("Arpeggio","arpeggio","arpeggio");
779         %draw_staff (-2, 2, 0.0);       
780         save height, overshoot, width;
781         height# = staff_space#;
782         width# = 0.8height#;
783         overshoot# = 0.25 staff_space#;
784         define_pixels (height,overshoot,width);
785         set_char_box(0, width#, 0, height#);
786         draw_arpeggio;
787         fet_endchar;
788
789 % Extendable Trill symbol.
790 % Not yet used
791 % Rename me to Trill, rename Trill to Tr?
792 fet_beginchar("Trill-element","trill-element","trill-element");
793         save height, overshoot;
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, height#, 0, width#);
799         draw_arpeggio;
800         currentpicture := currentpicture shifted -(width/2, height/2);
801         currentpicture := currentpicture rotated 90;
802         currentpicture := currentpicture shifted (height/2, width/2);
803         fet_endchar;
804
805
806
807 %
808 % Arpeggio arrow by Chris Jackson <chris@fluffhouse.org.uk>
809 %
810
811 def draw_arpeggio_arrow =
812         save thinness, height, width, overshoot, se, sw, ne, nw, alpha;
813         pair ne, nw, se, sw;
814         height# = staff_space#;
815         width# = 0.8height#;
816         overshoot# = 0.25 staff_space#;
817         define_pixels (height,overshoot,width);
818         set_char_box(0, width#, 0, height#);
819         alpha := -40;
820         nw = dir (alpha+180);
821         sw = dir (alpha-90); se = dir alpha;
822
823         penpos1(rthin,     alpha+90);
824         penpos2(5/4 rthick, alpha);
825         penpos3(5/4 rthick,     0);
826
827         z1 = (width/2, height) - overshoot*se; % numbering is consistent with the arpeggio symbol
828         z2 = 2[z4,(width/2,height/2)];
829         z3 = (0.5 width, 0.5 height);
830         z4 = (0.25 staff_space, rthin);
831         z6 = z2l + 1/2rthin*sw;
832         z9 = (width/2, height) + overshoot*se;
833         fill z1l {se}..{se} z6 .. z3l .. z3r.. z9{nw} ..{nw} z1r.. cycle;
834
835         bot z10 = ( 0.5w,  0   );
836         lft z11 = (-0.3w,  0.8h);
837         rt z12  = ( 1.3w,  0.8h);
838         pickup pencircle scaled 0.5 rthin;
839         filldraw z3 -- z12 {dir -130} ..  {dir -110} z10 {dir 110} ..  {dir 130} z11 -- cycle;
840 enddef;
841
842 fet_beginchar("Arpeggio arrow down", "arpeggio-arrow--1", "arpeggioarrowdown");
843         draw_arpeggio_arrow;
844 fet_endchar;
845
846
847 fet_beginchar("Arpeggio arrow up", "arpeggio-arrow-1", "arpeggioarrowup");
848         draw_arpeggio_arrow;
849         currentpicture := currentpicture scaled -1 shifted (0.8staff_space, staff_space);
850 fet_endchar;
851
852
853
854
855 % Hmm
856 input feta-slag;
857
858
859
860 fet_endgroup("scripts");
861