Fix typo in convert-ly.
[lilypond.git] / mf / feta-toevallig.mf
blob1f2690dd5e1d7f55c2ba1001c6023d0c049f082c
2 % feta-toevallig.mf -- implement Accidentals
4 % (c) 1997--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
9 % also show in other configuration wrt staff lines.
11 def draw_shifted_too =
12 if test > 0:
13         fet_beginchar ("shifted too", "");
14                 set_char_box (0, 0, 0, 0);
15                 currentpicture := remember_pic;
17                 draw_staff (-2, 2, 0.5);
18         fet_endchar;
19 fi;
20 enddef;
24 % Accidentals from various sources, notably
26 %   Baerenreiter edition of Schuberts `Auf dem Strom' (sharp, natural)
27 %   F Hofmeister edition of Muellers `Etueden fuer Horn' (double sharp, flat)
32 % Naming for accidentals (including microtonal variants):
34 %   SHARPBASE[.SLASHES.STEMS]
35 %   FLATBASE[.MODIFIER]
36 %  
37 % Examples:
39 %   sharp.slashslash.stem
40 %   mirroredflat.flat
45 fet_begingroup ("accidentals");
48 save remember_pic;
49 picture remember_pic;
51 save sharp_beamheight;
52 sharp_beamheight# := 0.3 staff_space# + stafflinethickness#;
55 % The beams of most sharps have horizontal endings (as if drawn with
56 % a square pen).  [Wanske] does not mention this, so we'll just ignore
57 % this fact.
60 def draw_meta_sharp (expr width, offset) =
61         save beamwidth, beamslope;
62         save ne, nw_dist;
63         pair ne, nw_dist;
65         beamwidth := width;
67         define_whole_vertical_blacker_pixels (sharp_beamheight);
69         clearxy;
71         beamslope = sharp_beamheight / beamwidth;
73         pickup pencircle scaled 2 blot_diameter;
75         rt x2 - lft x1 = beamwidth;
76         z2 = z1 + whatever * (beamwidth, sharp_beamheight);
77         .5 [z1, z3] = (.5 w, offset);
78         x3 = x2;
79         top y2 - bot y3 = sharp_beamheight;
80         x4 = x1;
81         top y1 - bot y4 = sharp_beamheight;
83         ne = unitvector (z2 - z1);
84         nw_dist = (ne rotated 90) * blot_diameter;
86         fill lft z1{up}
87              ... (z1 + nw_dist){ne}
88              -- (z2 + nw_dist){ne}
89              ... rt z2{down}
90              -- rt z3{down}
91              ... (z3 - nw_dist){-ne}
92              -- (z4 - nw_dist){-ne}
93              ... lft z4{up}
94              -- cycle;
96         labels (1, 2, 3, 4);
97 enddef;
100 fet_beginchar ("Sharp", "sharp");
101         save stem, stemx, stemwidth;
102         save outer_space, interbeam;
104         stemwidth# := stafflinethickness# + .05 staff_space#;
105         define_whole_blacker_pixels (stemwidth);
107         interbeam := 1.05 staff_space_rounded;
109         set_char_box (0, 1.1 staff_space#,
110                       1.5 staff_space#, 1.5 staff_space#);
112         stem := 7 / 16 * w;
113         stemx := hround stem;
114         outer_space := hround ((w - stemx - stemwidth) / 2);
116         w := 2 outer_space + stemx + stemwidth;
117         d := d - feta_space_shift;
119         draw_meta_sharp (w, -.5 interbeam);
120         draw_meta_sharp (w, -.5 interbeam + vround interbeam);
122         pickup pencircle scaled stemwidth;
124         lft x5 = lft x6 = outer_space;
125         lft x7 = lft x8 = outer_space + stemx;
126         bot y5 = -d;
127         top y6 = vround (1.5 staff_space - stem * beamslope);
128         bot y7 = -top y6 + feta_space_shift;
129         top y8 = h;
131         labels (5, 6, 7, 8);    
133         draw_gridline (z5, z6, stemwidth);
134         draw_gridline (z7, z8, stemwidth);
136         remember_pic := currentpicture;
138         draw_staff (-2, 2, 0);
139 fet_endchar;
142 draw_shifted_too;
145 fet_beginchar ("1/2 Sharp", "sharp.slashslash.stem");
146         save stem, stemwidth;
147         save outer_space, interbeam;
149         stemwidth# := stafflinethickness# + .05 staff_space#;
150         define_whole_blacker_pixels (stemwidth);
152         interbeam := 1.05 staff_space_rounded;
154         set_char_box (0, 0.7 staff_space#,
155                       1.5 staff_space#, 1.5 staff_space#);
157         stem := 7 / 16 * w;
158         outer_space := hround ((w - stemwidth) / 2);
160         w := 2 outer_space + stemwidth;
161         d := d - feta_space_shift;
163         draw_meta_sharp (w, -.5 interbeam);
164         draw_meta_sharp (w, -.5 interbeam + vround interbeam);
166         pickup pencircle scaled stemwidth;
168         lft x5 = lft x6 = outer_space;
169         top y6 = vround (1.5 staff_space - .5 stem);
170         bot y5 = -top y6 + feta_space_shift;
172         labels (5, 6);
174         draw_gridline (z5, z6, stemwidth);
176         remember_pic := currentpicture;
178         draw_staff (-2, 2, 0);
179 fet_endchar;
182 draw_shifted_too;
185 fet_beginchar ("Sharp (3 beams)", "sharp.slashslashslash.stemstem");
186         save stem, stemx, stemwidth;
187         save outer_space, interbeam;
188         save sharp_beamheight;
190         sharp_beamheight# := 0.22 staff_space# + stafflinethickness#;
192         stemwidth# := stafflinethickness# + .05 staff_space#;
193         define_whole_blacker_pixels (stemwidth);
195         interbeam := 1.2 staff_space_rounded;
197         set_char_box (0, 1.1 staff_space#,
198                       1.5 staff_space#, 1.5 staff_space#);
200         stem := 7 / 16 * w;
201         stemx := hround stem;
202         outer_space := hround ((w - stemx - stemwidth) / 2);
204         w := 2 outer_space + stemx + stemwidth;
205         d := d - feta_space_shift;
207         draw_meta_sharp (.88 w, -.5 interbeam);
208         draw_meta_sharp (.88 w, -.5 interbeam + vround interbeam);
209         sharp_beamheight# := 1/.88 sharp_beamheight#;
210         draw_meta_sharp (w, 0);
212         pickup pencircle scaled stemwidth;
214         lft x5 = lft x6 = outer_space;
215         lft x7 = lft x8 = outer_space + stemx;
216         bot y5 = -d;
217         top y6 = vround (1.5 staff_space - stem * beamslope);
218         bot y7 = -top y6 + feta_space_shift;
219         top y8 = h;
221         labels (5, 6, 7, 8);    
223         draw_gridline (z5, z6, stemwidth);
224         draw_gridline (z7, z8, stemwidth);
226         remember_pic := currentpicture;
228         draw_staff (-2, 2, 0);
229 fet_endchar;
232 draw_shifted_too;
235 fet_beginchar ("1/2 Sharp (3 beams)", "sharp.slashslashslash.stem");
236         save stem, stemx, stemwidth;
237         save outer_space, interbeam;
238         save sharp_beamheight;
240         sharp_beamheight# := 0.22 staff_space# + stafflinethickness#;
242         stemwidth# := stafflinethickness# + .05 staff_space#;
243         define_whole_blacker_pixels (stemwidth);
245         interbeam := 1.2 staff_space_rounded;
247         set_char_box (0, 0.95 staff_space#,
248                       1.3 staff_space#, 1.3 staff_space#);
250         stem := 7 / 16 * w;
251         outer_space := hround ((w - stemwidth) / 2);
253         w := 2 outer_space + stemwidth;
254         d := d - feta_space_shift;
256         draw_meta_sharp (.8 w, -.5 interbeam);
257         draw_meta_sharp (.8 w, -.5 interbeam + vround interbeam);
258         sharp_beamheight# := 1/.8 sharp_beamheight#;
259         draw_meta_sharp (w, 0);
261         pickup pencircle scaled stemwidth;
263         lft x5 = lft x6 = outer_space;
264         top y6 = vround (1.5 staff_space - .5 stem);
265         bot y5 = -top y6 + feta_space_shift;
266         labels (5, 6);
268         draw_gridline (z5, z6, stemwidth);
270         remember_pic := currentpicture;
272         draw_staff (-2, 2, 0);
273 fet_endchar;
276 draw_shifted_too;
279 fet_beginchar ("3/4 Sharp", "sharp.slashslash.stemstemstem");
280         save stem, stemx, stemwidth;
281         save outer_space, interbeam;
283         stemwidth# := stafflinethickness# + .05 staff_space#;
284         define_whole_blacker_pixels (stemwidth);
286         interbeam := 1.05 staff_space_rounded;
288         set_char_box (0, 1.6 staff_space#,
289                       1.5 staff_space#, 1.5 staff_space#);
291         stem := 9 / 32 * w;
292         stemx := hround stem;
293         outer_space := hround ((w - 2 stemx - stemwidth) / 2);
295         w := 2 outer_space + 2 stemx + stemwidth;
296         d := d - feta_space_shift;
298         draw_meta_sharp (w, -.5 interbeam);
299         draw_meta_sharp (w, -.5 interbeam + vround interbeam);
301         pickup pencircle scaled stemwidth;
303         lft x5 = lft x6 = outer_space;
304         lft x7 = lft x8 = outer_space + stemx;
305         lft x9 = lft x10 = outer_space + 2 stemx;
306         bot y5 = -d;
307         top y6 = vround (1.5 staff_space - 2 stem * beamslope);
308         bot y9 = -top y6 + feta_space_shift;
309         top y10 = h;
310         y7 = .5 [y5, y9];
311         y8 = .5 [y6, y10];
313         labels (5, 6, 7, 8, 9, 10);
315         draw_gridline (z5, z6, stemwidth);
316         draw_gridline (z7, z8, stemwidth);
317         draw_gridline (z9, z10, stemwidth);
319         remember_pic := currentpicture;
321         draw_staff (-2, 2, 0);
322 fet_endchar;
325 draw_shifted_too;
329 % The stems of the natural are brushed (at least, in Barenreiter SCS)
332 fet_beginchar ("Natural", "natural");
333         save stemwidth, top_stem_thick;
334         save ne, pat_top, pat_bottom;
335         pair ne;
336         path pat_top, pat_bottom;
338         top_stem_thick# = stafflinethickness# + .10 staff_space#;
339         stemwidth# = 0.09 staff_space# + .5 stafflinethickness#;
340         define_whole_blacker_pixels (top_stem_thick, stemwidth);
342         set_char_box (0, 2/3 staff_space#,
343                       1.5 staff_space#, 1.5 staff_space#);
345         d := d - feta_space_shift;
347         pickup pencircle scaled stemwidth;
349         penpos1 (top_stem_thick, 0);
350         penpos3 (top_stem_thick, 0);
351         penpos2 (stemwidth, 0);
352         penpos4 (stemwidth, 0);
354         x2r = w;
355         x4l = 0;
356         x3 = x2;
357         x1 = x4;
359         y1 = h;
360         y3 = -d;
361         top y2 = vround (staff_space - 3/2 stafflinethickness);
362         y4 = -y2 + feta_space_shift;
364         pat_bottom := z4r{z4r - z1r}
365                       .. bot z4
366                       .. z4l{z1l - z4l};
367         fill simple_serif (z1l, z1r, -30)
368              -- pat_bottom
369              -- cycle;
371         pat_top := z2r{z2r - z3r}
372                    .. top z2
373                    .. z2l{z3l - z2l};
374         fill simple_serif (z3l, z3r, 30)
375              -- pat_top
376              -- cycle;
378         ne = (x2 - x4, stafflinethickness);
380         z11' = z3l + whatever * (z2l - z3l);
381         y11' = vround (.5 (staff_space - stafflinethickness));
382         z11 = z11' + whatever * ne;
383         x11 = x12;
384         z12 = directionpoint -ne of pat_top;
385         z13 = z12 + whatever * ne;
386         x13 = x1;
387         z14 = z11 + whatever * ne;
388         x14 = x1;
390         z21' = z4r + whatever * (z1r - z4r);
391         y21' = -y11' + feta_space_shift;
392         z21 = z21' + whatever * ne;
393         x21 = x22;
394         z22 = directionpoint -ne of pat_bottom;
395         z23 = z22 + whatever * ne;
396         x23 = x3;
397         z24 = z21 + whatever * ne;
398         x24 = x3;
400         fill z11
401              -- z12
402              -- z13
403              -- z14
404              -- cycle;
405         fill z21
406              -- z22
407              -- z23
408              -- z24
409              -- cycle;
411         penlabels (1, 2, 3, 4);
412         labels (11, 11', 12, 13, 14, 21, 21', 22, 23, 24);
414         remember_pic := currentpicture;
416         draw_staff (-2, 2, 0);
417 fet_endchar;
420 draw_shifted_too;
424 % Dedicated to my mom.    (3/10/97)
426 % Mamma, ik hou van je; kom je alsjeblieft terug?
427 %    -- HW
430 % TODO: remove crook_fatness
431 % TODO: document, simplify!
434 def draw_meta_flat (expr xcenter, w, crook_fatness) =
435         save crook_thinness;
436         save bottom_overshoot, bot_crook_dir;
437         save top_stem_thick, bottom_stem_thick, hair, smaller_hole;
438         save top_crook_thinness;
439         save zwiep;
440         save center;
441         pair center, bot_crook_dir;
442         save clearing;
444         clearxy;
446         % the stem shouldn't reach the top staff line.
447         %% TODO: should take from height.
448         %
449         % TODO: parameterize this
450         %
451         if w >= 0.75 staff_space:
452                 smaller_hole = 0.35 stafflinethickness;
453         else:
454                 smaller_hole = 0;
455         fi;
456         clearing = 1.7 stafflinethickness;
457         crook_thinness = .7 stafflinethickness + .06 staff_space;
458         top_crook_thinness = 1 stafflinethickness + .065 staff_space;
459         bottom_overshoot = stafflinethickness;
461         bottom_stem_thick# = 0.06 staff_space# + 0.6 stafflinethickness#;
462         top_stem_thick# = 0.1 staff_space# + 1.2 stafflinethickness#;
463         define_whole_blacker_pixels (bottom_stem_thick, top_stem_thick);
465         if odd (top_stem_thick - bottom_stem_thick):
466                 top_stem_thick := top_stem_thick - 1;
467         fi;
469         center = (xcenter, 0);
471         x1l = hround (xcenter - .5 top_stem_thick);
472         y1 = vround (2 staff_space - clearing);
473         x2l = hround (xcenter - .5 bottom_stem_thick);
474         y2 = -.5 staff_space - .5 stafflinethickness;
476         penpos1 (top_stem_thick, 0);
477         penpos2 (bottom_stem_thick, 0);
479         y3l = vfloor ((staff_space - stafflinethickness) / 2);
480         z3l = whatever [z2r, z1r];
481         z3r = .3 [z2r, z1r] + (smaller_hole, 0);
482         x3r := hceiling x3r;
484         % we insert z3l to get better conversion with mf2pt1
485         fill simple_serif (z1r, z1l, 30)
486              -- z2l
487              -- z2r
488              -- z3l
489              -- cycle;
491         z10 = whatever [z2r, z1r] + (smaller_hole, 0);
492         y10 = -1/10 staff_space;
493         x10 := hceiling x10;
495         x11 = xcenter + bottom_overshoot / 3;
496         y11 = -vround (.5 (staff_space + stafflinethickness)
497                        + bottom_overshoot);
499         penpos4 (whatever, 53);
501         y4l - y4r = top_crook_thinness;
502         y5r = .15 staff_space;
503         x5l = hround (w + xcenter);
504         y4 = staff_space / 2;
505         x4r = .45 [x5r, x3r];
506         y4l := vround y4l;
508         penpos5 (crook_fatness, -175);
510         bot_crook_dir = unitvector ((x5l, 0) - z11);
511         z8 = z11 + whatever * bot_crook_dir;
512         y8 = -staff_space / 2;
514         z7 = z8
515              + whatever * bot_crook_dir
516              + crook_thinness * (bot_crook_dir rotated 90);
517         x7 = .1 [x3r, x8];
519         unfill z3r{z3r - z10}
520                .. z4r{right}
521                .. z5r{down}
522                .. z7{-bot_crook_dir}
523                & z7
524                .. z10{z3r - z10}
525                -- cycle;
527         fill z2l{down}
528              .. z11{right}
529              .. z8{bot_crook_dir}
530              .. z5l{up}
531              .. z4l{left}
532              .. z3l
533              -- cycle;
534 enddef;
538 % unfortunately, 600dpi is not enough to show the brush of the stem.
541 fet_beginchar ("Flat", "flat");
542         set_char_box (1.2 stafflinethickness#, .8 staff_space#,
543                       0.6 staff_space#, 1.9 staff_space#);
545         draw_meta_flat (0, w, 0.31 staff_space);
546         penlabels (range 0 thru 11);
548         remember_pic := currentpicture;
550         draw_staff (-2, 2, 0);
551 fet_endchar;
554 draw_shifted_too;
557 fet_beginchar ("Flat (slashed)", "flat.slash");
558         set_char_box (.4 staff_space#, .8 staff_space#,
559                       0.6 staff_space#, 1.9 staff_space#);
561         draw_meta_flat (0, w, 0.31 staff_space);
563         clearxy;
565         save slope, slash_width;
566         slope = 0.5;
567         slash_width = w;
569         z11 = (0, h / 2);
570         z12 = z11 - (slash_width, slash_width * slope) / 2;
571         z13 = z11 + (slash_width, slash_width * slope) / 2;
572         penpos12 (1.5 stafflinethickness, angle (z13 - z12) - 90);
573         penpos13 (1.5 stafflinethickness, angle (z13 - z12) - 90);
575         z14 = z12 - .75 stafflinethickness * unitvector (z13 - z12);
576         z15 = z13 + .75 stafflinethickness * unitvector (z13 - z12);
578         fill z13r
579              .. z15
580              .. z13l
581              -- z12l
582              .. z14
583              .. z12r
584              -- z13r
585              .. cycle;
587         penlabels (12, 13);
588         labels (14, 15);
590         remember_pic := currentpicture;
592         draw_staff (-2, 2, 0);
593 fet_endchar;
596 fet_beginchar ("Flat (slashed twice)", "flat.slashslash");
597         set_char_box (.4 staff_space#, .8 staff_space#,
598                       0.6 staff_space#, 1.9 staff_space#);
600         draw_meta_flat (0, w, 0.31 staff_space);
602         clearxy;
604         save slope, slash_width;
605         slope = 0.5;
606         slash_width = w;
608         z11 = (0, 5/12 h);
609         z12 = z11 - (slash_width, slash_width * slope) / 2;
610         z13 = z11 + (slash_width, slash_width * slope) / 2;
611         penpos12 (1.5 stafflinethickness, angle (z13 - z12) - 90);
612         penpos13 (1.5 stafflinethickness, angle (z13 - z12) - 90);
614         z14 = z12 - .75 stafflinethickness * unitvector (z13 - z12);
615         z15 = z13 + .75 stafflinethickness * unitvector (z13 - z12);
617         fill z13r
618              .. z15
619              .. z13l
620              -- z12l
621              .. z14
622              .. z12r
623              -- z13r
624              .. cycle;
626         penlabels (12, 13);
627         labels (14, 15);
629         z21 = (0, 2/3 h);
630         z22 = z21 - (slash_width, slash_width * slope) / 2;
631         z23 = z21 + (slash_width, slash_width * slope) / 2;
632         penpos22 (1.5 stafflinethickness, angle (z23 - z22) - 90);
633         penpos23 (1.5 stafflinethickness, angle (z23 - z22) - 90);
635         z24 = z22 - .75 stafflinethickness * unitvector (z23 - z22);
636         z25 = z23 + .75 stafflinethickness * unitvector (z23 - z22);
638         fill z23r
639              .. z25
640              .. z23l
641              -- z22l
642              .. z24
643              .. z22r
644              -- z23r
645              .. cycle;
647         penlabels (22, 23);
648         labels (24, 25);
650         remember_pic := currentpicture;
652         draw_staff (-2, 2, 0);
653 fet_endchar;
656 fet_beginchar ("Flatflat (mirrored)", "mirroredflat.flat");
657         set_char_box (0, 1.6 staff_space#, 
658                       0.6 staff_space#, 1.9 staff_space#);
660         % This is a modified version of `draw_meta_flat'.
662         save crook_thinness, crook_fatness;
663         save bottom_overshoot, bot_crook_dir;
664         save top_stem_thick, bottom_stem_thick, hair, smaller_hole;
665         save top_crook_thinness;
666         save zwiep;
667         save center;
668         pair center, bot_crook_dir;
669         save clearing, wid;
670         save pat;
671         path pat;
673         clearxy;
675         wid = w / 2;
677         % the stem shouldn't reach the top staff line.
678         %% TODO: should take from height.
679         %
680         % TODO: parameterize this
681         %
682         if wid >= 0.75 staff_space:
683                 smaller_hole = 0.35 stafflinethickness;
684         else:
685                 smaller_hole = 0;
686         fi;
687         clearing = 1.7 stafflinethickness;
688         crook_thinness = .7 stafflinethickness + .06 staff_space;
689         crook_fatness = 0.31 staff_space;
690         top_crook_thinness = 1 stafflinethickness + .065 staff_space;
691         bottom_overshoot = stafflinethickness;
693         bottom_stem_thick# = 0.06 staff_space# + 0.6 stafflinethickness#;
694         top_stem_thick# = 0.1 staff_space# + 1.2 stafflinethickness#;
695         define_whole_blacker_pixels (bottom_stem_thick, top_stem_thick);
697         if odd (top_stem_thick - bottom_stem_thick):
698                 top_stem_thick := top_stem_thick - 1;
699         fi;
701         center = (0, 0);
703         x1l = hround (-.5 top_stem_thick);
704         y1 = vround (2 staff_space - clearing);
705         x2l = hround (-.5 bottom_stem_thick);
706         y2 = -.5 staff_space - .5 stafflinethickness;
708         penpos1 (top_stem_thick, 0);
709         penpos2 (bottom_stem_thick, 0);
711         y3l = vfloor ((staff_space - stafflinethickness) / 2);
712         z3l = whatever [z2r, z1r];
713         z3r = .3 [z2r, z1r] + (smaller_hole, 0);
714         x3r := hceiling x3r;
716         z10 = whatever [z2r, z1r] + (smaller_hole, 0);
717         y10 = -1/10 staff_space;
718         x10 := hceiling x10;
720         x11 = bottom_overshoot / 3;
721         y11 = -vround (.5 (staff_space + stafflinethickness)
722                        + bottom_overshoot);
724         penpos4 (whatever, 53);
726         y4l - y4r = top_crook_thinness;
727         y5r = .15 staff_space;
728         x5l = hround (wid);
729         y4 = staff_space / 2;
730         x4r = .45 [x5r, x3r];
731         y4l := vround y4l;
733         penpos5 (crook_fatness, -175);
735         bot_crook_dir = unitvector ((x5l, 0) - z11);
736         z8 = z11 + whatever * bot_crook_dir;
737         y8 = -staff_space / 2;
739         z7 = z8
740              + whatever * bot_crook_dir
741              + crook_thinness * (bot_crook_dir rotated 90);
742         x7 = .1 [x3r, x8];
744         pat := z3r{z3r - z10}
745                .. z4r{right}
746                .. z5r{down}
747                .. z7{-bot_crook_dir}
748                & z7
749                .. z10{z3r - z10}
750                -- cycle;
751         unfill pat;
752         unfill pat xscaled -1;
754         pat := z11{right}
755                .. z8{bot_crook_dir}
756                .. z5l{up}
757                .. z4l{left}
758                .. z3l;
759         fill pat
760              -- simple_serif (z1r, z1l, 30)
761              -- reverse pat xscaled -1 shifted (-feta_eps, 0)
762              -- cycle;
764         currentpicture := currentpicture shifted (w/2, 0);
766         remember_pic := currentpicture;
768         draw_staff (-2, 2, 0);
769 fet_endchar;
772 draw_shifted_too;
775 fet_beginchar ("Semi flat", "mirroredflat");
776         set_char_box (1.2 stafflinethickness#, .8 staff_space#,
777                       0.6 staff_space#, 1.9 staff_space#);
779         draw_meta_flat (0, w, 0.31 staff_space);
780         currentpicture := currentpicture xscaled -1 shifted (w - b, 0);
781 fet_endchar;
784 fet_beginchar ("Semi flat", "mirroredflat.backslash");
785         set_char_box (.4 staff_space#, .8 staff_space#,
786                       0.6 staff_space#, 1.9 staff_space#);
788         draw_meta_flat (0, w, 0.31 staff_space);
790         clearxy;
792         save slope, slash_width;
793         slope = 0.5;
794         slash_width = w;
796         z11 = (0, h / 2);
797         z12 = z11 - (slash_width, slash_width * slope) / 2;
798         z13 = z11 + (slash_width, slash_width * slope) / 2;
799         penpos12 (1.5 stafflinethickness, angle (z13 - z12) - 90);
800         penpos13 (1.5 stafflinethickness, angle (z13 - z12) - 90);
802         z14 = z12 - .75 stafflinethickness * unitvector (z13 - z12);
803         z15 = z13 + .75 stafflinethickness * unitvector (z13 - z12);
805         fill z13r
806              .. z15
807              .. z13l
808              -- z12l
809              .. z14
810              .. z12r
811              -- z13r
812              .. cycle;
814         currentpicture := currentpicture xscaled -1 shifted (w - b, 0);
816         labels (1, 2, 3);
817 fet_endchar;
820 fet_beginchar ("Double Flat", "flatflat");
821         save left_wid, overlap, right_wid;
823         left_wid = .7;
824         right_wid = .8;
825         overlap = .05;
827         set_char_box (1.2 stafflinethickness#,
828                       (left_wid + right_wid - overlap) * staff_space#,
829                       .6 staff_space#, 1.9 staff_space#);
830         draw_meta_flat (0, left_wid * staff_space, 1/3 staff_space);
831         draw_meta_flat (hround ((left_wid - overlap) * staff_space),
832                         right_wid * staff_space, 1/3 staff_space);
833 fet_endchar;
836 fet_beginchar ("3/4 Flat", "flatflat.slash");
837         save left_wid, overlap, right_wid;
839         left_wid = .7;
840         right_wid = .8;
841         overlap = .05;
843         set_char_box (1.2 stafflinethickness#,
844                       (left_wid + right_wid - overlap) * staff_space#,
845                       .6 staff_space#, 1.9 staff_space#);
846         draw_meta_flat (0, left_wid * staff_space, 1/3 staff_space);
847         draw_meta_flat (hround ((left_wid - overlap) * staff_space),
848                         right_wid * staff_space, 1/3 staff_space);
850         %% maybe we should clip part of the stems?
851         %% or make the 1st flat smaller?
852         %% or reverse it?
853         pickup pencircle scaled 2 stafflinethickness;
855         z12 = round (-.25 w - b, .55 staff_space) + feta_offset;
856         z13 = round (.75 w, 1.45 staff_space) + feta_offset;
857         penpos12 (2 stafflinethickness, angle (z13 - z12) - 90);
858         penpos13 (2 stafflinethickness, angle (z13 - z12) - 90);
860         z14 = z12 - stafflinethickness * unitvector (z13 - z12);
861         z15 = z13 + stafflinethickness * unitvector (z13 - z12);
863         fill z13r
864              .. z15
865              .. z13l
866              -- z12l
867              .. z14
868              .. z12r
869              -- z13r
870              .. cycle;
872         penlabels (12, 13);
873         labels (14, 15);
875         remember_pic := currentpicture;
877         draw_staff (-2, 2, 0);
878 fet_endchar;
881 draw_shifted_too;
884 fet_beginchar ("Double Sharp", "doublesharp");
885         save klaverblad, klaversteel;
886         save pat;
887         path pat;
889         klaversteel = 1/15 staff_space;
890         klaverblad = .4 staff_space - .5 stafflinethickness;
892         set_char_box (0, staff_space#, .5 staff_space#, .5 staff_space#);
894         z1 = (klaversteel, 0);
895         z2 = (w / 2 - klaverblad / 10, h - klaverblad);
896         z3 = (w / 2, h);
897         z4 = z2 reflectedabout ((0, 0), (1, 1));
898         z5 = z1 reflectedabout ((0, 0), (1, 1));
900         labels (1, 2, 3, 4, 5);
902         pickup pencircle scaled blot_diameter;
904         x2 := hfloor (rt x2) - blot_diameter / 2;
905         x3 := hfloor (rt x3) - blot_diameter / 2;
906         y3 := vfloor (top y3) - blot_diameter / 2;
907         y4 := vfloor (top y4) - blot_diameter / 2;
909         pat = (rt z1){dir45}
910               .. {right}(bot z2)
911               .. rt z2
912               -- rt z3{z3 - z2}
913               .. top z3{z4 - z3}
914               -- top z4{z4 - z3}
915               .. (lft z4){down}
916               .. {dir 225}(top z5);
917         pat := pat
918                -- reverse pat xscaled -1 shifted (-feta_eps, 0);
920         % assure symmetry -- it's more important to center the glyph on the
921         % staff line than centering it between staff lines, so we use
922         % feta_shift, not feta_space_shift.
923         h := h + feta_shift;
925         fill pat shifted (0, feta_shift)
926              -- reverse pat yscaled -1 shifted (0, -feta_eps)
927              -- cycle;
929         % ugh
930         currentpicture := currentpicture shifted (hround (w / 2), 0);
932         remember_pic := currentpicture;
934         draw_staff (-2, 2, 0);
935 fet_endchar;
938 draw_shifted_too;
941 def draw_paren =
942         save leftindent;
944         leftindent := .2 staff_space;
946         set_char_box (0, .5 staff_space# + stafflinethickness#,
947                       staff_space#, staff_space#);
949         d := d - feta_shift;
951         z1 = (leftindent, h);
952         z2 = (w - stafflinethickness, .5 (h - d));
953         z3 = (leftindent, -d);
955         penpos1 (stafflinethickness, 35);
956         penpos2 (.1 staff_space + stafflinethickness, 0);
957         penpos3 (stafflinethickness, -35);
959         fill z2l{down}
960              .. simple_serif (z3l, z3r, 90)
961              .. z2r{up}
962              .. simple_serif (z1r, z1l, 90)
963              .. z2l{down}
964              -- cycle;
965 enddef;
968 fet_beginchar ("Right Parenthesis", "rightparen");
969         draw_paren;
970         penlabels (1, 2, 3);
972         remember_pic := currentpicture;
974         draw_staff (-2, 2, 0);
975 fet_endchar;
978 draw_shifted_too;
981 fet_beginchar ("Left Parenthesis", "leftparen");
982         draw_paren;
984         currentpicture := currentpicture xscaled -1;
986         set_char_box (charwd, charbp, chardp, charht);
987 fet_endchar;
989 fet_endgroup ("accidentals");