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