]> git.donarmstrong.com Git - lilypond.git/blob - mf/feta-scripts.mf
Merge branch 'lilypond/translation' of ssh://git.sv.gnu.org/srv/git/lilypond
[lilypond.git] / mf / feta-scripts.mf
1 % Feta (not the Font-En-Tja) music font --  implement scripts
2 % This file is part of LilyPond, the GNU music typesetter.
3 %
4 % Copyright (C) 1997--2009 Han-Wen Nienhuys <hanwen@xs4all.nl>
5 %       Jan Nieuwenhuizen <janneke@gnu.org>
6 %
7 %
8 % LilyPond is free software: you can redistribute it and/or modify
9 % it under the terms of the GNU General Public License as published by
10 % the Free Software Foundation, either version 3 of the License, or
11 % (at your option) any later version.
12 %
13 % LilyPond is distributed in the hope that it will be useful,
14 % but WITHOUT ANY WARRANTY; without even the implied warranty of
15 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 % GNU General Public License for more details.
17 %
18 % You should have received a copy of the GNU General Public License
19 % along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
20
21
22 fet_begingroup ("scripts");
23
24 def draw_fermata =
25         save alpha, radius, crook_thinness, crook_fatness, dot_size;
26         save pat;
27         path pat;
28
29         % [Wanske] and some Baerenreiter editions
30         % suggest about 80 degrees instead of a half-circle
31         alpha := 10;
32
33         radius# = 1.25 staff_space#;
34         crook_thinness# = 1.5 linethickness#;
35         crook_fatness# = 0.25 staff_space# + 1.5 linethickness#;
36
37         radius# + crook_fatness# / 2 = h#;
38         radius# + crook_thinness# / 2 = w#;
39
40         set_char_box (w#, w#, crook_thinness# / 2, h#);
41
42         define_pixels (radius, crook_thinness, crook_fatness);
43
44         dot_size# = 8/6 crook_fatness#;
45         define_whole_blacker_pixels (dot_size);
46
47         penpos1 (crook_thinness, 0);
48         penpos2 (crook_fatness, -90);
49         z1 = (-radius, 0);
50         z2 = (0, radius);
51
52         pat := z2l{left}
53                .. z1l{dir (-alpha - 90)}
54                .. {dir (90 - alpha)}z1r
55                .. {right}z2r;
56         pat := pat
57                -- reverse pat xscaled -1 shifted (-feta_eps, 0)
58                -- cycle;
59         fill pat;
60
61         pickup pencircle scaled dot_size;
62         x4 = 0;
63         bot y4 = vround (-crook_thinness / 2);
64         drawdot z4;
65 enddef;
66
67
68 fet_beginchar ("fermata up", "ufermata");
69         draw_fermata;
70         penlabels (1, 2, 4);
71 fet_endchar;
72
73
74 fet_beginchar ("fermata down", "dfermata");
75         draw_fermata;
76         y_mirror_char;
77 fet_endchar;
78
79
80 def draw_short_fermata =
81         save fat_factor, thinness, dot_size;
82         save left_dist, right_dist, se, ne;
83         pair left_dist, right_dist, se, ne;
84
85         set_char_box (staff_space#, staff_space#, 0, 2.2 staff_space#);
86
87         dot_size# = 0.266 staff_space# + 2.666 linethickness#;
88         define_whole_blacker_pixels (dot_size);
89
90         fat_factor = .11;
91         thinness = 1.5 linethickness;
92
93         pickup pencircle scaled thinness;
94
95         rt x2 = w;
96         lft x5 = -b;
97         bot y5 = 0;
98         top y3 = h;
99         y1 = y2 = y5;
100
101         x3 = 0;
102         z1 - z4 = whatever * (charwd, -charht);
103         z4 = fat_factor [z3, z5];
104
105         ne = unitvector (z3 - z5);
106         se = unitvector (z2 - z3);
107
108         left_dist = (ne rotated 90) * 0.5 thinness;
109         right_dist = (se rotated 90) * 0.5 thinness;
110
111         fill bot z5{right}
112              .. (z5 - left_dist){ne}
113              -- (((z5 - left_dist) -- (z3 - left_dist)) intersectionpoint
114                   ((z1 - right_dist) -- (z4 - right_dist)))
115              -- (z1 - right_dist){se}
116              .. bot z1{right}
117              -- bot z2{right}
118              .. (z2 + right_dist){-se}
119              -- (z3 + right_dist){-se}
120              .. top z3
121              .. (z3 + left_dist){-ne}
122              -- (z5 + left_dist){-ne}
123              .. cycle;
124
125         pickup pencircle scaled dot_size;
126
127         x1 - 2 x6 = x2;
128         x6 := vround (x6);
129         bot y6 = -d;
130
131         drawdot z6;
132 enddef;
133
134 fet_beginchar ("short fermata up", "ushortfermata");
135         draw_short_fermata;
136         labels (1, 2, 3, 4, 5, 6);
137 fet_endchar;
138
139
140 fet_beginchar ("short fermata down", "dshortfermata");
141         draw_short_fermata;
142         xy_mirror_char;
143 fet_endchar;
144
145
146 def draw_long_fermata =
147         save stemthick, beamheight, dot_size, wd;
148         save pat;
149         path pat;
150
151         wd# = 2.5 staff_space#;
152         stemthick = hround (1.5 linethickness);
153         beamheight = 0.3 staff_space + linethickness;
154         dot_size# = 0.266 staff_space# + 2.666 * linethickness#;
155         define_pixels (wd);
156         define_whole_blacker_pixels (dot_size);
157
158         set_char_box (wd# / 2, wd# / 2, 0, 3/2 staff_space#);
159
160         pickup pencircle scaled blot_diameter;
161
162         top y1 = h;
163         lft x1 = -b;
164
165         pat := top z1{left}
166                .. {down}lft z1;
167
168         pickup pencircle scaled stemthick;
169
170         x2 = -b + stemthick;
171         y2 = h - beamheight;
172         lft x3 = -b;
173         bot y3 = -d;
174
175         pat := pat
176                -- lft z3
177                .. bot z3
178                .. rt z3
179                -- z2;
180         pat := pat
181                -- reverse pat xscaled -1 shifted (-feta_eps, 0)
182                -- cycle;
183
184         fill pat;
185
186         pickup pencircle scaled dot_size;
187
188         x4 = 0;
189         bot y4 = -d;
190
191         drawdot z4;
192 enddef;
193
194
195 fet_beginchar ("long fermata up", "ulongfermata");
196         draw_long_fermata;
197         labels (1, 2, 3, 4);
198 fet_endchar;
199
200
201 fet_beginchar ("long fermata down", "dlongfermata");
202         draw_long_fermata;
203         y_mirror_char;
204 fet_endchar;
205
206
207 def draw_very_long_fermata =
208         save ibeamheight, obeamheight;
209         save ihwd, ohwd, iht, oht;      % inner/outer half_width/height
210         save stemthick, dot_size;
211         save opat, ipat;
212         path opat, ipat;
213
214         ihwd# = 1.0 staff_space#;
215         ohwd# = 1.5 staff_space#;
216         iht# = 0.9 staff_space#;
217         oht# = 1.6 staff_space#;
218         define_pixels (ihwd, ohwd, iht, oht)
219
220         stemthick = hround (1.5 linethickness);
221         ibeamheight# = 0.3 staff_space#;
222         obeamheight# = 0.5 staff_space#;
223         define_pixels (ibeamheight, obeamheight);
224
225         dot_size# = (iht# - ibeamheight#) * 8/10;
226         define_whole_blacker_pixels (dot_size);
227
228         set_char_box (ohwd#, ohwd#, 0, oht#);
229
230         pickup pencircle scaled blot_diameter;
231
232         top y1 = oht;
233         lft x1 = -ohwd;
234         top y11 = iht;
235         lft x11 = -ihwd;
236
237         opat := top z1{left}
238                 .. {down}lft z1;
239         ipat := top z11{left}
240                 .. {down}lft z11;
241
242         pickup pencircle scaled stemthick;
243
244         x2 = -ohwd + stemthick;
245         y2 = oht - obeamheight;
246         lft x3 = -ohwd;
247         bot y3 = 0;
248         x12 = -ihwd + stemthick;
249         y12 = iht - ibeamheight;
250         lft x13 = -ihwd;
251         bot y13 = 0;
252
253         opat := opat
254                 -- lft z3
255                 .. bot z3
256                 .. rt z3
257                 -- z2;
258         opat := opat
259                 -- reverse opat xscaled -1 shifted (-feta_eps, 0)
260                 -- cycle;
261         ipat := ipat
262                 -- lft z13
263                 .. bot z13
264                 .. rt z13
265                 -- z12;
266         ipat := ipat
267                 -- reverse ipat xscaled -1 shifted (-feta_eps, 0)
268                 -- cycle;
269
270         fill opat;
271         fill ipat;
272
273         pickup pencircle scaled dot_size;
274
275         x4 = 0;
276         bot y4 = -d;
277
278         drawdot z4;
279 enddef;
280
281
282 fet_beginchar ("very long fermata up", "uverylongfermata");
283         draw_very_long_fermata;
284         labels (1, 2, 3, 11, 12, 13, 4);
285 fet_endchar;
286
287
288 fet_beginchar ("very long fermata down", "dverylongfermata");
289         draw_very_long_fermata;
290         y_mirror_char;
291 fet_endchar;
292
293
294 %
295 % Thumbs are used in cello music.
296 % TODO : thumbs should look like the finger-font and should be placed in
297 % the same way in the score.
298 %
299
300 fet_beginchar ("Thumb", "thumb");
301         save thin, height, width, thick, depth;
302         height# = 5/4 width#;
303         height# = staff_space#;
304         depth# = 1.6 (height# / 2);
305
306         set_char_box (width# / 2, width# / 2, depth#, height# / 2);
307
308         define_pixels (height, width);
309
310         thin = .6 linethickness + 0.06 staff_space;
311         2 thick + 0.5 (height - 2 thin) = width;
312
313         penpos1 (thick, 0);
314         penpos2 (thin, 90);
315         penpos3 (thick, 180);
316         penpos4 (thin, 270);
317         z1r = (w, 0);
318         z2r = (0, h);
319         z3r = (-w, 0);
320         z4r = (0, -h);
321
322         penlabels (1, 2, 3, 4);
323
324         penstroke z1e{up}
325                   .. z2e{left}
326                   .. z3e{down}
327                   .. z4e{right}
328                   .. cycle;
329
330         save brush_thick;
331         y5 = -d + brush_thick / 2;
332         brush_thick = 0.9 thick;
333         x5 = 0;
334
335         labels (5);
336
337         draw_brush (z4r, 1.4 thin, z5, brush_thick);
338 fet_endchar;
339
340
341 %
342 % `\accent' is TeX reserved.
343 %
344
345 def draw_accent (expr bottom_left, top_right, thickness, diminish) =
346         save thinning_start;
347         thinning_start = 0.4;
348         pickup pencircle scaled thickness;
349
350         lft x1 = xpart bottom_left;
351         top y1 = ypart top_right;
352         lft x6 = xpart bottom_left;
353         bot y6 = ypart bottom_left;
354
355         rt z4 = (xpart top_right, (ypart top_right + ypart bottom_left) / 2);
356         x5 = x3 = thinning_start [xpart top_right, xpart bottom_left]
357                   - linethickness + 0.1 staff_space;
358         z3 = whatever [z1, z4];
359         z5 = whatever [z6, z4];
360
361         penpos1 (thickness, angle (z3 - z1) + 90);
362         penpos3 (thickness, angle (z3 - z1) + 90);
363         penpos4 (thickness, 90);
364         penpos5 (thickness, angle (z6 - z5) + 90);
365         penpos6 (thickness, angle (z6 - z5) + 90);
366
367         x4 - x7 = diminish * thickness;
368         y7 = y4;
369
370         fill z1l
371              -- z3l
372              -- z7
373              -- z5l
374              -- z6l
375              .. lft z6{down}
376              .. bot z6
377              .. z6r
378              -- z4l
379              ..tension 0.8.. rt z4
380              ..tension 0.8.. z4r
381              -- z1r
382              .. top z1
383              .. lft z1{down}
384              .. cycle;
385 enddef;
386
387
388 fet_beginchar ("> accent", "sforzato");
389         set_char_box (.9 staff_space#, .9 staff_space#,
390                       .5 staff_space#, .5 staff_space#);
391
392         draw_accent ((-w, -d), (w, h),
393                      0.05 staff_space + linethickness, 0.7);
394         penlabels (1, 3, 4, 5, 6);
395         labels (7);
396 fet_endchar;
397
398
399 fet_beginchar ("espr", "espr");
400         set_char_box (1.9 staff_space#, 1.9 staff_space#,
401                       .5 staff_space#, .5 staff_space#);
402
403         draw_accent ((w - 1.78 staff_space, -d), (w, h),
404                      0.05 staff_space + linethickness, 0.6);
405         addto currentpicture also currentpicture xscaled -1;
406 fet_endchar;
407
408
409 fet_beginchar ("staccato dot", "staccato");
410         save radius;
411         radius# = 0.20 * staff_space#;
412         define_whole_pixels (radius);
413
414         pickup pencircle scaled 2 radius;
415         drawdot (0, 0);
416
417         set_char_box (radius#, radius#, radius#, radius#);
418 fet_endchar;
419
420
421 def draw_staccatissimo =
422         save radius, height;
423         height# = .8 staff_space#;
424         radius# = linethickness# + .1 staff_space#;
425         define_whole_blacker_pixels (radius);
426         define_pixels (height);
427
428         draw_brush ((0, 0), linethickness, (0, height), 2 radius);
429
430         set_char_box (radius#, radius#,
431                       blot_diameter# / 2, height# + radius#);
432 enddef;
433
434
435 fet_beginchar ("staccatissimo/martellato up", "ustaccatissimo");
436         draw_staccatissimo;
437 fet_endchar;
438
439
440 fet_beginchar ("staccatissimo/martellato down", "dstaccatissimo");
441         draw_staccatissimo;
442         y_mirror_char;
443 fet_endchar;
444
445
446 fet_beginchar ("portato/single tenuto", "tenuto");
447         save thick;
448         thick# = 1.6 linethickness#;
449         define_whole_blacker_pixels (thick);
450
451         set_char_box (.6 staff_space#, .6 staff_space#,
452                       thick# / 2, thick# / 2);
453
454         draw_rounded_block ((-b, -thick / 2), (w, thick / 2), thick);
455 fet_endchar;
456
457
458 def draw_portato =
459         save thick, dot_size;
460         thick# = 1.4 linethickness#;
461         dot_size# = 2.4 linethickness# + 0.08 staff_space#;
462         define_whole_blacker_pixels (thick, dot_size);
463
464         set_char_box (.6 staff_space#, .6 staff_space#,
465                       thick# / 2, .5 staff_space# + .5 dot_size#);
466
467         draw_rounded_block ((-b, -thick / 2), (w, thick / 2), thick);
468
469         pickup pencircle scaled dot_size;
470         drawdot (0, h);
471 enddef;
472
473
474 fet_beginchar ("portato/tenuto with staccato", "uportato");
475         draw_portato;
476 fet_endchar;
477
478
479 fet_beginchar ("portato/tenuto with staccato", "dportato");
480         draw_portato;
481         y_mirror_char
482 fet_endchar;
483
484
485 def draw_marcato =
486         save fat_factor, thinness;
487         save left_dist, right_dist, ne, se;
488         pair left_dist, right_dist, ne, se;
489
490         set_char_box (staff_space# / 2, staff_space# / 2,
491                       0, 1.1 staff_space#);
492
493         fat_factor = .3;
494         thinness = linethickness;
495
496         pickup pencircle scaled thinness;
497
498         rt x2 = w;
499         lft x5 = -b;
500         bot y5 = 0;
501         top y3 = h;
502         y1 = y2 = y5;
503
504         x3 =0;
505         z1 - z4 = whatever * (charwd, -charht);
506         z4 = fat_factor [z3, z5];
507
508         ne = unitvector (z3 - z5);
509         se = unitvector (z2 - z3);
510
511         left_dist = (ne rotated 90) * 0.5 thinness;
512         right_dist = (se rotated 90) * 0.5 thinness;
513
514         fill bot z5{right}
515              .. (z5 - left_dist){ne}
516              -- (((z5 - left_dist) -- (z3 - left_dist)) intersectionpoint
517                   ((z1 - right_dist) -- (z4 - right_dist)))
518              -- (z1 - right_dist){se}
519              .. bot z1{right}
520              -- bot z2{right}
521              .. (z2 + right_dist){-se}
522              -- (z3 + right_dist){-se}
523              .. top z3
524              .. (z3 + left_dist){-ne}
525              -- (z5 + left_dist){-ne}
526              .. cycle;
527 enddef;
528
529
530 fet_beginchar ("marcato up", "umarcato");
531         draw_marcato;
532         labels (1, 2, 3, 4, 5);
533 fet_endchar;
534
535
536 %
537 % The down marcato char (not very much used).
538 % Contrary to what some MF/TeX `gurus' believe
539 % it is *point*-symmetric with the "up" version
540 %
541
542 fet_beginchar ("marcato down", "dmarcato");
543         draw_marcato;
544         xy_mirror_char;
545 fet_endchar;
546
547
548 %
549 % used in french horn music todo
550 %
551 % TODO: too light at 20pt
552 %
553
554 fet_beginchar ("open (unstopped)", "open");
555         save thin, height, width, thick;
556
557         height# = 5/4 width#;
558         height# = staff_space#;
559         thin = .6 linethickness + 0.06 staff_space;
560
561         set_char_box (width# / 2, width# / 2, height# / 2, height# / 2);
562
563         define_pixels (width, height);
564
565         2 thick + 0.6 (height - 2 thin) = width;
566
567         penpos1 (thick, 0);
568         penpos2 (thin, 90);
569         penpos3 (thick, 180);
570         penpos4 (thin, 270);
571         z1r = (w, 0);
572         z2r = (0, h);
573         z3r = (-w, 0);
574         z4r = (0, -h);
575
576         penlabels (1, 2, 3, 4);
577
578         penstroke z1e{up}
579                   .. z2e{left}
580                   .. z3e{down}
581                   .. z4e{right}
582                   .. cycle;
583 fet_endchar;
584
585
586 fet_beginchar ("plus (stopped)", "stopped");
587         save hthick, vthick, size, outer_hsize, outer_vsize;
588
589         hthick# = vthick# = 2 linethickness#;
590         size# = 1.1 staff_space#;
591         define_whole_blacker_pixels (vthick);
592         define_whole_vertical_blacker_pixels (hthick);
593
594         set_char_box (size# / 2, size# / 2, size# / 2, size# / 2);
595
596         outer_hsize = hround ((b + w - vthick) / 2);
597         outer_vsize = vround ((h + d - hthick) / 2);
598         w := b := (2 outer_hsize + vthick) / 2;
599         h := d := (2 outer_vsize + hthick) / 2;
600
601         draw_rounded_block ((-b, -d + outer_vsize),
602                             (w, -d + outer_vsize + hthick), hthick);
603         draw_rounded_block ((-b + outer_hsize, -d),
604                             (-b + outer_hsize + vthick, h), vthick);
605 fet_endchar;
606
607
608 fet_beginchar ("Upbow", "upbow");
609         save ht, wd, thick;
610
611         thick = 1.4 linethickness;
612         wd# = 1.3 staff_space#;
613         ht# = 1.6 wd#;
614
615         set_char_box (wd# / 2, wd# / 2, 0, ht#);
616
617         draw_accent ((-h, -w), (0, w), thick, 0.9);
618         currentpicture := currentpicture rotated -90;
619 fet_endchar;
620
621
622 fet_beginchar ("Downbow", "downbow");
623         save stemthick, beamheight, wd;
624         save pat;
625         path pat;
626
627         wd# = 1.5 staff_space#;
628         define_pixels (wd);
629
630         stemthick = hround (1.2 linethickness);
631
632         set_char_box (wd# / 2, wd# / 2, 0, 4/3 staff_space#);
633
634         beamheight = 4/10 h;
635
636         pickup pencircle scaled blot_diameter;
637
638         top y1 = h;
639         lft x1 = -b;
640
641         pat := top z1{left}
642                .. {down}lft z1;
643
644         pickup pencircle scaled stemthick;
645
646         x2 = -b + stemthick;
647         y2 = h - beamheight;
648         lft x3 = -b;
649         bot y3 = -d;
650
651         pat := pat
652                -- lft z3
653                .. bot z3
654                .. rt z3
655                -- z2;
656         pat := pat
657                -- reverse pat xscaled -1 shifted (-feta_eps, 0)
658                -- cycle;
659
660         fill pat;
661
662         labels (1, 2, 3);
663 fet_endchar;
664
665 %
666 % Inspired by a computer-set version of Auf dem Strom by Baerenreiter.
667 %
668
669 def draw_turn =
670         save thin, thick, ball_diam, darkness;
671         save wd, ht, thick_nibangle, ball_nib_thick;
672         save turndir;
673         pair turndir;
674
675         wd# = 35/16 staff_space#;
676         ht# = 18/17 staff_space#;
677         darkness = 0.3 linethickness + 0.09 staff_space;
678
679         set_char_box (wd# / 2, wd# / 2, ht# / 2, ht# / 2);
680
681         thick_nibangle = 60;
682         thick = 3 darkness;
683         thin = darkness;
684         ball_nib_thick = 2.7 darkness;
685         ball_diam = ball_nib_thick + (h - ball_nib_thick) / 10;
686
687         x3l = w;
688         y3 = 0;
689         y4l = h;
690         x4 = x2;
691         x2l = w / 2;
692         y2l = -d;
693         z1 = (0,0);
694
695         penpos1 (1.1 thick, thick_nibangle);
696         penpos2 (thick, thick_nibangle);
697         penpos3 (thin, 180);
698         penpos4 (ball_nib_thick, -90);
699
700         path swoosh, ploop;
701         swoosh := z1l{curl 0}
702                   .. z2l
703                   .. z3l{up}
704                   .. {left}z4l
705                   -- z4r
706                   .. z3r{down}
707                   .. z2r{left};
708         fill swoosh
709              .. swoosh scaled -1 shifted (-feta_eps, -feta_eps)
710              .. cycle;
711
712         x5r = x4;
713         y5r = y4l - ball_diam / 2;
714         z6r = z5r;
715
716         penpos5 (1.6 ball_diam / 2, 10);
717         penpos6 (ball_diam / 2, 150);
718
719         ploop := z4l{left}
720                  .. z5l
721                  .. z6l
722                  -- cycle;
723         fill ploop;
724         fill ploop scaled -1 shifted (-feta_eps, -feta_eps);
725 enddef;
726
727
728 fet_beginchar ("Reverse turn", "reverseturn");
729         draw_turn;
730         currentpicture := currentpicture yscaled -1;
731 fet_endchar;
732
733
734 fet_beginchar ("Turn", "turn");
735         draw_turn;
736         penlabels (1, 2, 3, 4, 5, 6, 7);
737 fet_endchar;
738
739
740 %
741 % Inspired by a (by now) PD edition of Durand & C'ie edition of
742 % Saint-Saens' Celloconcerto no. 1
743 %
744 % FIXME take out hardcoded vars.
745 % FIXME the two loops on the `t' should be smoother (and the left one bigger).
746 % FIXME generic macros for serifs: top of the t and bottom of r
747 %
748
749 fet_beginchar ("Trill (`tr')", "trill");
750         save start_nib_angle, ascender_extra, ex, hair_thick, fatness;
751         save slant, t_fatness, r_fatness, kerning, t_overshoot;
752         save uitschieter, bulb_size, krul_ang;
753         save u, v;
754
755         ascender_extra# = 1/2 ex#;
756         ascender# = ascender_extra# + ex#;
757         ex# = 1.4 staff_space#;
758         kerning# = 0.6 ex#;
759         start_nib_angle = 20;
760         bulb_size = 0.8;
761         define_pixels (ex, ascender_extra, ascender, kerning);
762
763         t_overshoot = 0.03 ex;
764         fatness = 12/40 ex;
765         t_fatness = 0.78 fatness;
766         t_width =  1.9 t_fatness;
767         r_fatness = 0.78 fatness;
768         uitschieter = 0.48 ex;
769         hair_thick = linethickness;
770         r_flare = .5 hair_thick + 0.25 r_fatness;
771         r_width =  2 r_fatness + 0.25 kerning;
772         slant = .2;
773
774         local_copy (transform)(currenttransform);
775         currenttransform := currenttransform slanted slant
776                                              shifted (-staff_space, 0);
777
778         set_char_box (.85 staff_space#, .85 staff_space#, 0, ascender#);
779
780         y1 = ascender;
781
782         % try to position in such a way that the center is the visual
783         % center
784
785         x1l = 0.2 staff_space;
786         x1r - x1l = t_fatness;
787         penpos1 (start_nib_wid, start_nib_angle);
788
789         z2 = (x1, 7/18 ex);
790         penpos2 (start_nib_wid, start_nib_angle);
791
792         z3l = (x2l + 0.5 t_width, - t_overshoot);
793
794         z4l = (x2l + t_width, 0.23 ex);
795         penpos4 (whatever, 180);        % 200
796         x4l - x4r = hair_thick;
797
798         x3r = 0.5 [x4r, x2r];
799 %       1.7 [x3l, x3r] = x4r;
800         y3r - y3l = 0.6 t_fatness;
801
802         save krul_p;
803         path krul_p;
804
805         krul_ang = 32;
806
807         pickup pencircle scaled hair_thick;
808
809         z5 = (x2l + t_fatness / 2, 2/3 ex);
810         lft x6 = x2l - uitschieter;
811         y6 = y5;                                % - 1/20 ex;
812         z7 = z5 + whatever * dir krul_ang;
813         up_angle = krul_ang;                    % = angle (z7-z5)
814         x7 = 5/10 kerning + x5;
815
816         krul_p := z4{up}
817                   ..tension 0.98.. z5
818                   .. z6
819                   .. z5{z7 - z5}
820                   -- z7;
821
822         z4' = point 0.85 of krul_p;
823         penpos4' (hair_thick, angle (direction 0.85 of krul_p) + 90);
824
825         % the body of the `t' and the bottom loop
826         fill z1r{dir (angle (z1l - z1r) + 30)}
827              .. z1l{-dir (angle (z1r - z1l) - 45)}
828              -- z2l{down}
829              ..tension (1 + .5 slant).. z3l{right}
830              .. z4l{up}
831              .. z4'l{direction 0.85 of krul_p}
832              -- z4'r{-direction 0.85 of krul_p}
833              .. z4r{down}
834              .. z3r{left}
835              ..tension (1.5 + .7 slant).. z2r{up}
836              -- cycle;
837
838         z5' = point 1.1 of krul_p;
839         penpos5' (hair_thick, angle (direction 1.1 of krul_p) + 90);
840         z5'' = point 1.5 of krul_p;
841         penpos5'' (hair_thick, angle (direction 1.5 of krul_p) + 90);
842         z5''' = point 1.8 of krul_p;
843         penpos5''' (hair_thick, angle (direction 1.8 of krul_p) + 90);
844         z6 = point 2 of krul_p;
845         penpos6 (hair_thick, angle (direction 2 of krul_p) + 90);
846         z6' = point 2.3 of krul_p;
847         penpos6' (hair_thick, angle (direction 2.3 of krul_p) + 90);
848         z6'' = point 2.6 of krul_p;
849         penpos6'' (hair_thick, angle (direction 2.6 of krul_p) + 90);
850         z6''' = point 2.9 of krul_p;
851         penpos6''' (hair_thick, angle (direction 2.9 of krul_p) + 90);
852         penpos7 (hair_thick, up_angle + 90);
853         z7' = point 3.2 of krul_p;
854         penpos7' (hair_thick, angle (direction 3.2 of krul_p) + 90);
855
856         % the left loop
857         penstroke z5'e{direction 1.1 of krul_p}
858                   .. z5''e{direction 1.5 of krul_p}
859                   .. z5'''e{direction 1.8 of krul_p}
860                   .. z6e{direction 2 of krul_p}
861                   .. z6'e{direction 2.3 of krul_p}
862                   .. z6''e{direction 2.6 of krul_p}
863                   .. {direction 2.9 of krul_p}z6'''e;
864
865         y9 = 3/4 ex;
866         x9 = x1 + kerning;
867         penpos9 (r_fatness, 0);
868
869         x10 = x9;
870         y10 = -0.3 linethickness;
871         penpos10 (r_fatness, 0);
872
873         penpos11 (hair_thick, -4);
874         z11r = z9r;
875
876         z13l = (x9l + r_width, y11 - linethickness);
877         penpos13 (r_flare, 180);
878
879         z15 = z13r - (bulb_size * r_fatness, 0);
880         z14 = 0.5 [z13l, z15] - (0, bulb_size * r_fatness);
881
882         save before, after;
883         path before, after;
884         before := z13l{up}
885                   .. {down}z11l;
886         after := z9r{up}
887                  .. z7r{z7' - z7}
888                  -- z7'r;
889         (u, v) = before intersectiontimes after;
890
891         save before_bulb, after_bulb;
892         path before_bulb, after_bulb;
893         before_bulb := z9r{up}
894                        ..tension 0.94.. z13r{down};
895         after_bulb := z13l{up}
896                       ..tension 1.06.. z15{down};
897         (u_bulb, v_bulb) = before_bulb intersectiontimes after_bulb;
898
899         % the connection between `t' and `r', the body of the `r',
900         % and the bulb
901         fill z7'l
902              -- z7l{z7 - z7'}
903              .. z9l{down}
904              -- simple_serif (z10l, z10r, -30)
905              -- z9r{up}
906              .. subpath (0, u_bulb) of before_bulb
907              .. subpath (v_bulb, infinity) of after_bulb
908              .. z14
909              .. z13l{up}
910              .. subpath (0, u) of before
911              .. subpath (v, infinity) of after
912              -- cycle;
913
914         penlabels (range 1 thru 15);
915         penlabels (4', 5', 5'', 5''', 6', 6'', 6''', 7');
916 fet_endchar;
917
918
919 def draw_heel =
920         save radius, thickness;
921         save pat;
922         path pat;
923
924         radius# := .5 staff_space#;
925
926         set_char_box (radius#, radius#, radius#, 2/3 staff_space#);
927
928         thickness := hround (1.5 linethickness);
929
930         pickup pencircle scaled thickness;
931
932         rt x1 = b;
933         top y1 = h;
934
935         x2 =x1;
936         y2 = 0;
937
938         x3 = 0;
939         bot y3 = -d;
940
941         pat := top z3{right}
942                .. lft z2{up}
943                -- lft z1
944                .. top z1
945                .. rt z1
946                -- rt z2{down}
947                .. bot z3{left};
948         pat := pat
949                -- reverse pat xscaled -1 shifted (-feta_eps, 0)
950                -- cycle;
951         fill pat;
952 enddef;
953
954
955 fet_beginchar ("left heel", "upedalheel");
956         draw_heel;
957         labels (1, 2, 3);
958 fet_endchar;
959
960
961 fet_beginchar ("right heel", "dpedalheel");
962         draw_heel;
963         y_mirror_char;
964 fet_endchar;
965
966
967 def draw_toe =
968         save ht, wd, thickness;
969
970         thickness := 1.5 linethickness;
971         ht# := 1.5 staff_space#;
972         wd# := 1/3 ht#;
973         define_pixels (ht, wd);
974
975         set_char_box (wd#, wd#, 0, ht#);
976         draw_accent ((-h, -w), (0, w), thickness, 0.9);
977         currentpicture := currentpicture rotated -90;
978 enddef;
979
980
981 fet_beginchar ("left toe", "upedaltoe");
982         draw_toe;
983 fet_endchar;
984
985
986 fet_beginchar ("right toe", "dpedaltoe");
987         draw_toe;
988         y_mirror_char;
989 fet_endchar;
990
991
992 fet_beginchar ("Flageolet", "flageolet");
993         save height, width, thickness, superness;
994
995         height# = 4/15 staffsize#;
996         width# = height#;
997         thickness# = blot_diameter#;
998         define_pixels (height, width);
999         define_whole_blacker_pixels (thickness);
1000
1001         set_char_box (width# / 2, width# / 2, height# / 2, height# / 2);
1002
1003         penpos1 (thickness, 90);
1004         penpos2 (thickness, 180);
1005         penpos3 (thickness, 270);
1006         penpos4 (thickness, 0);
1007
1008         x1 = 0;
1009         y1r = h;
1010         x4r = w;
1011         x2r = -x4r;
1012         y2 = 0;
1013         y4 = y2;
1014         x3 = x1;
1015         y3r = -y1r;
1016
1017         penlabels (1, 2, 3, 4);
1018
1019         % mf doesn't handle pixel dropouts in outline objects, so we use
1020         % `draw' if not called by mpost
1021         if known miterlimit:
1022                 penstroke z1e
1023                           .. z2e
1024                           .. z3e
1025                           .. z4e
1026                           .. cycle;
1027         else:
1028                 pickup pencircle scaled thickness;
1029                 draw z1
1030                      .. z2
1031                      .. z3
1032                      .. z4
1033                      .. cycle;
1034         fi;
1035 fet_endchar;
1036
1037
1038 %
1039 % TODO:  ARGRGHGH code dup.
1040 %
1041
1042 fet_beginchar ("Segno", "segno");
1043         save thin, thick, ball_diam, darkness, pointheight;
1044         save wd, ht, thick_nibangle, ball_nib_thick;
1045         save turndir;
1046         pair turndir;
1047
1048         ht# = 3 staff_space#;
1049         wd# = 2 staff_space#;
1050         darkness = .08 staff_space + 0.4 linethickness;
1051
1052         set_char_box (wd# / 2, wd# / 2, ht# / 2, ht# / 2);
1053
1054         thick_nibangle = 30;
1055         thick = 3 darkness;
1056         thin = darkness;
1057         ball_nib_thick = 2.7 darkness;
1058         ball_diam = ball_nib_thick + (w - ball_nib_thick) / 10;
1059         pointheight = 2 linethickness;
1060
1061         y3l = h;
1062         2 x3 = x2 + x4;
1063         x4 = 0;
1064         y4 = y2;
1065         y2l = .6 h;
1066         x2l = -b;
1067         z1 = (0, 0);
1068
1069         penpos1 (thick, 2 thick_nibangle);
1070         penpos2 (thick, thick_nibangle);
1071         penpos3 (thin, -90);
1072         penpos4 (ball_nib_thick, 180 - thick_nibangle);
1073
1074         save swoosh, ploop;
1075         path swoosh, ploop;
1076
1077         swoosh := z1l{curl 0}
1078                   .. z2l
1079                   .. z3l{right}
1080                   .. {down}z4l
1081                   -- z4r
1082                   .. z3r{left}
1083                   .. z2r{down};
1084         fill swoosh
1085              .. (swoosh scaled -1)
1086              .. cycle;
1087
1088         y5r = y4;
1089         x5r = x4l - ball_diam / 2;
1090         z6r = z5r;
1091
1092         penpos5 (1.6 ball_diam / 2, 100);
1093         penpos6 (ball_diam / 2, 240);
1094
1095         ploop := z4l{down}
1096                  .. z5l
1097                  .. z6l
1098                  -- cycle;
1099         fill ploop;
1100         fill ploop scaled -1;
1101
1102         penpos7 (2 thin, 0);
1103         z7l = (-b, -d);
1104         penpos8 (2 thin, 0);
1105         z8r = (w, h);
1106
1107         penstroke z7e
1108                   -- z8e;
1109
1110         pickup pencircle scaled 2 thin;
1111         drawdot (-x2r, pointheight);
1112         drawdot (x2r, -pointheight);
1113
1114         penlabels (range 1 thru 8);
1115 fet_endchar;
1116
1117
1118 fet_beginchar ("Coda", "coda");
1119         save stickout, thin, thick, codawidth, codaheight;
1120
1121         stickout# = 0.35 staff_space#;
1122         codawidth# = 2/3 staff_space#;
1123         codaheight# = staff_space#;
1124         define_pixels (codawidth, codaheight);
1125
1126         set_char_box (codawidth# + stickout#, codawidth# + stickout#,
1127                       codaheight# + stickout#, codaheight# + stickout#);
1128
1129         thin = 1.2 linethickness;
1130         0.1 (codaheight - 2 thin) = (codawidth - 2 thick);
1131
1132         penpos1 (thick, 0);
1133         penpos2 (thin, -90);
1134         penpos3 (thick, -180);
1135         penpos4 (thin, -270);
1136
1137         x1l = -codawidth;
1138         y2l = codaheight;
1139         y1 = 0;
1140         x2 = 0;
1141         z3 = -z1;
1142         z4 = -z2;
1143
1144         penlabels (1, 2, 3, 4);
1145
1146         fill z1l{up}
1147              .. z2l{right}
1148              .. z3l{down}
1149              .. z4l{left}
1150              .. cycle;
1151         unfill z1r{up}
1152                .. z2r{right}
1153                .. z3r{down}
1154                .. z4r{left}
1155                .. cycle;
1156
1157         draw_gridline ((0, -h), (0, h), thin);
1158         draw_gridline ((-w, 0), (w, 0), thin);
1159 fet_endchar;
1160
1161
1162 fet_beginchar ("Varied Coda", "varcoda");
1163         save thin, thick, codawidth, codaheight;
1164         thin# = 1.2 linethickness#;
1165         thick# = 1.0 linethickness# + 0.25 staff_space#;
1166         codawidth# = 2/3 staff_space#;
1167         codaheight# = staff_space#;
1168         define_pixels (thin, thick, codawidth, codaheight);
1169
1170         set_char_box (codawidth# + thick#, codawidth# + thick#,
1171                       codaheight# + thick#, codaheight# + thick#);
1172
1173         x1 = -codawidth + thick - .5 blot_diameter;
1174         y1 = y2 - thin;
1175         x2 = codawidth - thick + .5 blot_diameter;
1176         y2 = codaheight;
1177         draw_square_block (z1, z2);
1178
1179         x3 = -codawidth;
1180         y3 = -codaheight;
1181         x4 = x3 + thick;
1182         y4 = y2;
1183         draw_block (z3, z4);
1184
1185         labels (1, 2, 3, 4);
1186
1187         addto currentpicture also currentpicture scaled -1;
1188
1189         draw_gridline ((0, -h), (0, h), thin);
1190         draw_gridline ((-w, 0), (w, 0), thin);
1191 fet_endchar;
1192
1193
1194 def draw_comma =
1195         save alpha, thick, thin, ht;
1196
1197         alpha := 35;
1198         thin# = 1.2 linethickness#;
1199         thick# = 3 linethickness#;
1200         ht# = .6 staff_space#;
1201         define_pixels (thin, thick, ht);
1202
1203         set_char_box (0, .5 staff_space#, ht#, ht#);
1204
1205         penpos1 (thick, alpha);
1206         penpos2 (thick, alpha + 90);
1207         penpos3 (thin, 180 - alpha);
1208         penpos4 (thin, 90 - alpha);
1209
1210         x3r = 0;
1211         x1l = x3l;
1212         y2r = -y4l = h;
1213         z1 = z2;
1214         z3 = z4;
1215
1216         fill z1l{dir (alpha + 90)}
1217              .. z2r{dir alpha}
1218              .. z1r{dir (alpha - 90)}
1219              .. z3l{dir (270 - alpha)}
1220              .. z4l{dir (180 - alpha)}
1221              .. z3r{dir (90-alpha)}
1222              .. cycle;
1223 enddef;
1224
1225
1226 fet_beginchar ("Right Comma", "rcomma");
1227         draw_comma;
1228         penlabels (1, 2, 3, 4);
1229 fet_endchar;
1230
1231
1232 fet_beginchar ("Left Comma", "lcomma");
1233         draw_comma;
1234         xy_mirror_char;
1235 fet_endchar;
1236
1237
1238 def draw_varcomma =
1239         save thick, thin, ht, wd, alpha;
1240
1241         alpha := 35;
1242         thin# = 1.2 linethickness#;
1243         thick# = 3 linethickness#;
1244         ht# = .6 staff_space#;
1245         wd# = .25 staff_space#;
1246         define_pixels (thin, thick, ht, alpha);
1247
1248         set_char_box (wd#, wd#, ht#, ht#);
1249
1250         z1 = (-b, -d);
1251         z2 = (w, h);
1252
1253         draw_brush (z1, thin, z2, thick);
1254 enddef;
1255
1256
1257 fet_beginchar ("Right Varied Comma", "rvarcomma");
1258         draw_varcomma;
1259         labels (1, 2);
1260 fet_endchar;
1261
1262
1263 fet_beginchar ("Left Varied Comma", "lvarcomma");
1264         draw_varcomma;
1265         xy_mirror_char;
1266 fet_endchar;
1267
1268
1269 thick# := 1/24 designsize;
1270 define_blacker_pixels (thick);
1271
1272 rthin := 0.075 * staff_space + 0.5 linethickness;
1273 rthick := 2 thick + rthin;
1274
1275
1276 def draw_arpeggio =
1277         save alpha;
1278         save ne, nw, se, sw;
1279         save x, y;
1280         pair ne, nw, se, sw;
1281
1282         alpha := -40;
1283
1284         nw = dir (alpha + 180);
1285         ne = dir (alpha + 90);
1286         se = dir alpha;
1287         sw = dir (alpha - 90);
1288
1289         penpos1 (rthin, alpha + 90);
1290         penpos2 (5/4 rthick, alpha);
1291         penpos3 (3/4 rthick, alpha);
1292         penpos4 (5/4 rthick, alpha);
1293         penpos5 (rthin, alpha + 90);
1294
1295         z1 = (width / 2, height) - overshoot * se;
1296         z2 = 2 [z4, (width / 2, height / 2)];
1297         z3 = 1/2 [z2, z4];
1298         x4 = 2/8 staff_space;
1299         y4 = rthin;
1300
1301         z5 = 2 [z1, (width / 2, height / 2)];
1302         z6 = z2l + 1/2 rthin * sw;
1303         z7 = z4l + 1/2 rthin * sw + 1/2 rthin * se;
1304         z8 = 2 [z6, (width / 2, height / 2)];
1305         z9 = 2 [z7, (width / 2, height / 2)];
1306
1307         fill z1l{se}
1308              -- z6
1309              .. z3l
1310              .. z7{se}
1311              -- z5l
1312              .. z5r{nw}
1313              -- z8
1314              .. z3r
1315              .. z9{nw}
1316              -- z1r
1317              .. cycle;
1318 enddef;
1319
1320
1321 fet_beginchar ("Arpeggio", "arpeggio");
1322         save height, overshoot, width;
1323         height# = staff_space#;
1324         width# = 0.8 height#;
1325         overshoot# = 0.25 staff_space#;
1326         define_pixels (height, overshoot, width);
1327
1328         set_char_box (0, width#, 0, height#);
1329         draw_arpeggio;
1330         penlabels (range 1 thru 9);
1331
1332         draw_staff (-2, 2, 0.0);
1333 fet_endchar;
1334
1335
1336 %
1337 % Extendable Trill symbol.
1338 % Not yet used
1339 % Rename me to Trill, rename Trill to Tr?
1340 %
1341
1342 fet_beginchar ("Trill_element", "trill_element");
1343         save height, overshoot;
1344         height# = staff_space#;
1345         width# = 0.8 height#;
1346         overshoot# = 0.25 staff_space#;
1347         define_pixels (height, overshoot, width);
1348
1349         set_char_box (0, height#, 0, width#);
1350         draw_arpeggio;
1351
1352         currentpicture := currentpicture shifted -(width / 2, height / 2);
1353         currentpicture := currentpicture rotated 90;
1354         currentpicture := currentpicture shifted (height / 2, width / 2);
1355 fet_endchar;
1356
1357
1358 %
1359 % Arpeggio arrow by Chris Jackson <chris@fluffhouse.org.uk>
1360 %
1361
1362 def draw_arpeggio_arrow =
1363         save thinness, height, width, overshoot;
1364         save nw, ne, se, sw;
1365         save alpha;
1366         save before_left, before_right, after_left, after_right;
1367         save u_left, v_left, u_right, v_right;
1368         pair nw, ne, se, sw;
1369         path before_left, before_right, after_left, after_right;
1370
1371         height# = staff_space#;
1372         width# = 0.8 height#;
1373         overshoot# = 0.25 staff_space#;
1374         define_pixels (height, overshoot, width);
1375
1376         set_char_box (0, width#, 0, height#);
1377
1378         alpha := -40;
1379         nw = dir (alpha + 180);
1380         ne = dir (alpha + 90);
1381         se = dir alpha;
1382         sw = dir (alpha - 90);
1383
1384         penpos1 (rthin, alpha + 90);
1385         penpos2 (5/4 rthick, alpha);
1386         penpos3 (5/4 rthick, 0);
1387
1388         z1 = (width / 2, height) - overshoot * se; % numbering is consistent
1389                                                    % with the arpeggio symbol
1390         z2 = 2 [z4, (width / 2, height / 2)];
1391         z3 = (0.5 width, 0.5 height);
1392         z4 = (0.25 staff_space, rthin);
1393         z6 = z2l + 1/2 rthin * sw;
1394         z9 = (width / 2, height) + overshoot * se;
1395
1396         pickup pencircle scaled vround (0.5 rthin);
1397
1398         bot z10 = (0.5 w, 0);
1399         lft z11 = (0.5 w - hround (0.8 w), 0.8 h);
1400         rt z12 = (0.5 w + hround (0.8 w), 0.8 h);
1401
1402         before_left := z1l
1403                        -- z6{z6 - z1l}
1404                        .. {down}z3l;
1405         after_left := (z3 + (0, -0.25 rthin / cosd (angle (nw))))
1406                       -- (z11 + 0.25 rthin * ne);
1407         (u_left, v_left) = before_left intersectiontimes after_left;
1408
1409         before_right := (z12 + 0.25 rthin * nw)
1410                         -- (z3 + (0, -0.25 rthin / cosd (angle (nw))));
1411         after_right := z3r{up}
1412                        .. z9{z1r - z9}
1413                        -- z1r;
1414         (u_right, v_right) = before_right intersectiontimes after_right;
1415
1416         fill subpath (0, u_left) of before_left
1417              .. subpath (v_left, infinity) of after_left
1418              .. top z11
1419              .. lft z11
1420              .. {dir -50}(z11 + 0.25 rthin * sw)
1421              .. (z10 + 0.25 rthin * sw){dir -70}
1422              .. bot z10
1423              .. {dir 70}(z10 + 0.25 rthin * se)
1424              .. (z12 + 0.25 rthin * se){dir 50}
1425              .. rt z12
1426              .. top z12
1427              .. subpath (0, u_right) of before_right
1428              .. subpath (v_right, infinity) of after_right
1429              .. cycle;
1430
1431         % mf doesn't handle pixel dropouts in outline objects, so we use
1432         % `draw' if not called by mpost
1433         if not known miterlimit:
1434                 pickup pencircle scaled 0.7 rthin;
1435                 draw z1
1436                      -- (z9 + 0.5 rthin * dir (alpha - 90));
1437         fi;
1438 enddef;
1439
1440
1441 fet_beginchar ("Arpeggio arrow down", "arpeggio.arrow.M1");
1442         draw_arpeggio_arrow;
1443         penlabels (range 1 thru 12);
1444 fet_endchar;
1445
1446
1447 fet_beginchar ("Arpeggio arrow up", "arpeggio.arrow.1");
1448         draw_arpeggio_arrow;
1449         currentpicture := currentpicture scaled -1
1450                                          shifted (w - feta_eps, h - feta_eps);
1451 fet_endchar;
1452
1453
1454 % Hmm
1455 input feta-trills;
1456
1457
1458 %
1459 % Railroad tracks.  We define two variants of these -- both as slightly
1460 % tapered, comma-shaped curves and as two straight parallel slashes.
1461 %
1462
1463 fet_beginchar ("Curved caesura", "caesura.curved");
1464         save slant, space_between, clearance;
1465         save alpha, pat;
1466         save botthick, topthick;
1467         save krom;
1468         path pat;
1469
1470         botthick = 1.5 linethickness;
1471         topthick = 2.5 linethickness;
1472
1473         pickup pencircle scaled botthick;
1474
1475         slant = 3.5;
1476         space_between# = 0.6 staff_space#;
1477         clearance# = 0.2 staff_space#;
1478         height# = 1.2 staff_space#;
1479
1480         set_char_box (0, 2.0 staff_space#,
1481                       staff_space# - clearance#, height#);
1482         define_pixels (clearance, height);
1483         define_whole_pixels (space_between);
1484
1485         bot y1 = -d;
1486         top y2 = h;
1487
1488         lft x1 = 0;
1489         x2 = (y2 - y1) / slant;
1490
1491         krom = 10;
1492
1493         alpha = angle (z2 - z1);
1494         penpos1 (botthick, alpha - krom);
1495         penpos3 (botthick, alpha - krom + 90);
1496
1497         penpos2 (topthick, alpha + krom);
1498         penpos4 (topthick, alpha + krom + 90);
1499
1500         z3 = z1;
1501         z4 = z2;
1502
1503         penlabels (1, 2, 3, 4);
1504
1505         pat := z3r{(z1r - z1l)}
1506                .. z4r{z2r-z2l}
1507                .. z2r{z4l-z4r}
1508                .. z4l{z2l-z2r}
1509                .. z3l{z1l-z1r}
1510                .. z1l{z3r-z3l}
1511                .. cycle;
1512         fill pat;
1513         fill pat shifted (space_between, 0);
1514 fet_endchar;
1515
1516
1517 fet_beginchar ("Straight caesura", "caesura.straight");
1518         save slant, space_between, clearance;
1519         save thick, ne, pat;
1520         path pat;
1521         pair ne;
1522
1523         slant = 2.0;
1524         thick = 2.88 linethickness;
1525
1526         space_between# = 0.56 staff_space#;
1527         clearance# = 0.2 staff_space#;
1528
1529         set_char_box (0, 2.0 staff_space#,
1530                       staff_space# - clearance#, 1.2 staff_space#);
1531         define_whole_pixels (space_between);
1532
1533         x1 = 0;
1534         x2 = x1 + thick;
1535         y1 = y2 = -d;
1536
1537         x3 = x4 + thick;
1538         x4 = x1 + (h + d) / slant;
1539         y3 = y4 = h;
1540
1541         ne = unitvector (z4 - z1);
1542
1543         z1a = z1 + blot_diameter * ne;
1544         z1b = z1 + blot_diameter * right;
1545         z2a = z2 + blot_diameter * ne;
1546         z2b = z2 + blot_diameter * left;
1547
1548         z3a = z3 - blot_diameter * ne;
1549         z3b = z3 + blot_diameter * left;
1550         z4a = z4 - blot_diameter * ne;
1551         z4b = z4 + blot_diameter * right;
1552
1553         pat = z1a{-ne}
1554               .. {right}z1b
1555               -- z2b{right}
1556               .. {ne}z2a
1557               -- z3a{ne}
1558               .. {left}z3b
1559               -- z4b{left}
1560               .. {-ne}z4a
1561               -- cycle;
1562
1563         fill pat;
1564         fill pat shifted (space_between, 0);
1565
1566         labels(range 1 thru 4);
1567         labels(1a, 1b, 2a, 2b, 3a, 3b, 4a, 4b);
1568 fet_endchar;
1569
1570
1571 fet_beginchar ("snap pizzicato (Bartok pizzicato)", "snappizzicato");
1572         save height, width, thickness, superness;
1573
1574         height# = 4/15 staffsize#;
1575         width# = height#;
1576         thickness# = 1.3 linethickness#;
1577         define_pixels (height, width);
1578         define_whole_blacker_pixels (thickness);
1579
1580         set_char_box (width# / 2, width# / 2, height# / 2, height# * 3 / 4);
1581
1582         penpos1 (thickness, 90);
1583         penpos2 (thickness, 180);
1584         penpos3 (thickness, 270);
1585         penpos4 (thickness, 0);
1586
1587         x1 = 0;
1588         y1r = height / 2;
1589         x3 = x1;
1590         y3r = -y1r;
1591         x4r = width / 2;
1592         y4 = 0;
1593         x2r = -x4r;
1594         y2 = y4;
1595
1596         penlabels (1, 2, 3, 4);
1597
1598         % mf doesn't handle pixel dropouts in outline objects, so we use
1599         % `draw' if not called by mpost
1600         if known miterlimit:
1601                 penstroke z1e
1602                           .. z2e
1603                           .. z3e
1604                           .. z4e
1605                           .. cycle;
1606         else:
1607                 pickup pencircle scaled thickness;
1608                 draw z1
1609                      .. z2
1610                      .. z3
1611                      .. z4
1612                      .. cycle;
1613         fi;
1614
1615         z5 = (0, 0);
1616         z6 = (x5, 1.5 y1r);
1617
1618         draw_gridline (z5, z6, thickness);
1619
1620         labels (5, 6);
1621 fet_endchar;
1622
1623 fet_endgroup ("scripts");