2 % feta-toevallig.mf -- implement Accidentals
4 % (c) 1997--2008 Han-Wen Nienhuys <hanwen@xs4all.nl>
9 % also show in other configuration wrt staff lines.
11 def draw_shifted_too =
13 fet_beginchar ("shifted too", "");
14 set_char_box (0, 0, 0, 0);
15 currentpicture := remember_pic;
17 draw_staff (-2, 2, 0.5);
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]
39 % sharp.slashslash.stem
45 fet_begingroup ("accidentals");
50 % * "stemslant" gives the direction of the stem's left boundary
51 % (needed for brushed stems, equals "up" for straight stems)
52 % * "extend" is used to make the stem longer or shorter (if negative);
53 % different kinds of accidentals need different values here
55 def draw_arrow (expr attach, stemwidth, stemslant, extend, pointingdown) =
57 save htip; % tip height
58 save wwing; % wing "radius"
59 save angle_wing_bot, angle_wing_top, angle_tip;
63 wwing:=0.26 stemwidth;
64 htip:=staff_space*0.85 + stafflinethickness - wwing;
66 % "flip" is used to reflect the arrow vertically if arrow points downward
69 flip=identity reflectedabout (origin, right);
74 z1=attach shifted ((-stemwidth/2),0);
75 upshift:=max(0, wwing + 0.1 staff_space + extend);
76 z2=z1 shifted (((unitvector stemslant) scaled upshift) transformed flip);
78 z7=attach shifted ((stemwidth/2),0);
79 z6=z7 shifted (((unitvector (-xpart stemslant, ypart stemslant))
80 scaled upshift) transformed flip);
81 (z2-z3)= (0.38 staff_space, 0.05 htip) transformed flip;
82 (z6-z5)=(-0.38 staff_space, 0.05 htip) transformed flip;
84 z4 =attach shifted ((-0.2 stemwidth, upshift+htip) transformed flip);
85 z4'=attach shifted (( 0.2 stemwidth, upshift+htip) transformed flip);
87 % angle_wing_bot is the angle at which the arc from z2 to z3a enters z3a
88 % angle_wing_top is the angle at which the arc from z3b to z4 leaves z3b
89 % angle_tip is the angle at which the arc from z4 to z4' leaves z4
94 z3a=z3 shifted ((((dir angle_wing_bot) rotated (-90))
95 scaled wwing) transformed flip);
96 z3b=z3 shifted ((((dir angle_wing_top) rotated 90)
97 scaled wwing) transformed flip);
99 z5a=z5 shifted ((((dir (180-angle_wing_bot)) rotated 90)
100 scaled wwing) transformed flip);
101 z5b=z5 shifted ((((dir (180-angle_wing_top)) rotated (-90))
102 scaled wwing) transformed flip);
105 pickup pencircle scaled 1;
107 -- z2{stemslant transformed flip}
108 .. {(-dir angle_wing_bot) transformed flip}z3a
109 .. z3b{(dir angle_wing_top) transformed flip}
110 .. z4{(dir angle_tip) transformed flip}
111 .. z4'{(dir (-angle_tip)) transformed flip}
112 ..{(dir (-angle_wing_top)) transformed flip}z5b
113 ..z5a{(-dir (-angle_wing_bot)) transformed flip}
114 ..z6{((-stemslant) reflectedabout (origin, up)) transformed flip}
118 labels(range 0 thru 7,4',3a,3b,5a,5b);
123 picture remember_pic;
125 save sharp_beamheight;
126 sharp_beamheight# := 0.3 staff_space# + stafflinethickness#;
129 % The beams of most sharps have horizontal endings (as if drawn with
130 % a square pen). [Wanske] does not mention this, so we'll just ignore
134 def draw_meta_sharp (expr width, offset) =
135 save beamwidth, beamslope;
141 define_whole_vertical_blacker_pixels (sharp_beamheight);
145 beamslope = sharp_beamheight / beamwidth;
147 pickup pencircle scaled 2 blot_diameter;
149 rt x2 - lft x1 = beamwidth;
150 z2 = z1 + whatever * (beamwidth, sharp_beamheight);
151 .5 [z1, z3] = (.5 w, offset);
153 top y2 - bot y3 = sharp_beamheight;
155 top y1 - bot y4 = sharp_beamheight;
157 ne = unitvector (z2 - z1);
158 nw_dist = (ne rotated 90) * blot_diameter;
161 ... (z1 + nw_dist){ne}
162 -- (z2 + nw_dist){ne}
165 ... (z3 - nw_dist){-ne}
166 -- (z4 - nw_dist){-ne}
174 def draw_sharp(expr arrowup, arrowdown) =
175 save stem, stemx, stemwidth;
176 save outer_space, interbeam;
177 save stemlength, extendleft, extendright, height, depth;
179 stemwidth# := stafflinethickness# + .05 staff_space#;
180 define_whole_blacker_pixels (stemwidth);
182 interbeam := 1.05 staff_space_rounded;
184 stemlength# := 1.5 staff_space#;
185 define_pixels (stemlength);
187 height# = stemlength#;
188 depth# = stemlength#;
192 height# := height# + 1.2 staff_space#;
193 extendright# := extendright# + 1.5 stafflinethickness#;
196 depth# := depth# + 1.2 staff_space#;
197 extendleft# := extendleft# + 1.5 stafflinethickness#;
199 define_pixels(extendleft, extendright);
200 set_char_box (extendleft#, 1.1 staff_space#, depth#, height#);
203 stemx := hround stem;
204 outer_space := hround ((w - stemx - stemwidth) / 2);
206 w := 2 outer_space + stemx + stemwidth;
207 d := d - feta_space_shift;
209 draw_meta_sharp (w, -.5 interbeam);
210 draw_meta_sharp (w, -.5 interbeam + vround interbeam);
212 % expand the charbox so that it encloses the whole arrow; this mustn't
213 % happen earlier because some commands above still rely on the old width
214 w := w + extendright;
216 pickup pencircle scaled stemwidth;
218 lft x5 = lft x6 = outer_space;
219 lft x7 = lft x8 = outer_space + stemx;
220 bot y5 = -stemlength;
221 top y6 = vround (1.5 staff_space - stem * beamslope);
222 bot y7 = -top y6 + feta_space_shift;
227 draw_gridline (z5, z6, stemwidth);
228 draw_gridline (z7, z8, stemwidth);
231 draw_arrow (z8, stemwidth, up,
232 +(stafflinethickness/2 + stemwidth/2), false);
235 draw_arrow (z5, stemwidth, up,
236 +(stafflinethickness/2 + stemwidth/2), true);
239 remember_pic := currentpicture;
241 draw_staff (-2, 2, 0);
245 fet_beginchar ("Sharp", "sharp");
246 draw_sharp (false, false);
253 fet_beginchar ("Arrowed Sharp (arrow up)", "sharp.arrowup");
254 draw_sharp (true, false);
261 fet_beginchar ("Arrowed Sharp (arrow down)", "sharp.arrowdown");
262 draw_sharp (false, true);
269 fet_beginchar ("1/2 Sharp", "sharp.slashslash.stem");
270 save stem, stemwidth;
271 save outer_space, interbeam;
273 stemwidth# := stafflinethickness# + .05 staff_space#;
274 define_whole_blacker_pixels (stemwidth);
276 interbeam := 1.05 staff_space_rounded;
278 set_char_box (0, 0.7 staff_space#,
279 1.5 staff_space#, 1.5 staff_space#);
282 outer_space := hround ((w - stemwidth) / 2);
284 w := 2 outer_space + stemwidth;
285 d := d - feta_space_shift;
287 draw_meta_sharp (w, -.5 interbeam);
288 draw_meta_sharp (w, -.5 interbeam + vround interbeam);
290 pickup pencircle scaled stemwidth;
292 lft x5 = lft x6 = outer_space;
293 top y6 = vround (1.5 staff_space - .5 stem);
294 bot y5 = -top y6 + feta_space_shift;
298 draw_gridline (z5, z6, stemwidth);
300 remember_pic := currentpicture;
302 draw_staff (-2, 2, 0);
309 fet_beginchar ("Sharp (3 beams)", "sharp.slashslashslash.stemstem");
310 save stem, stemx, stemwidth;
311 save outer_space, interbeam;
312 save sharp_beamheight;
314 sharp_beamheight# := 0.22 staff_space# + stafflinethickness#;
316 stemwidth# := stafflinethickness# + .05 staff_space#;
317 define_whole_blacker_pixels (stemwidth);
319 interbeam := 1.2 staff_space_rounded;
321 set_char_box (0, 1.1 staff_space#,
322 1.5 staff_space#, 1.5 staff_space#);
325 stemx := hround stem;
326 outer_space := hround ((w - stemx - stemwidth) / 2);
328 w := 2 outer_space + stemx + stemwidth;
329 d := d - feta_space_shift;
331 draw_meta_sharp (.88 w, -.5 interbeam);
332 draw_meta_sharp (.88 w, -.5 interbeam + vround interbeam);
333 sharp_beamheight# := 1/.88 sharp_beamheight#;
334 draw_meta_sharp (w, 0);
336 pickup pencircle scaled stemwidth;
338 lft x5 = lft x6 = outer_space;
339 lft x7 = lft x8 = outer_space + stemx;
341 top y6 = vround (1.5 staff_space - stem * beamslope);
342 bot y7 = -top y6 + feta_space_shift;
347 draw_gridline (z5, z6, stemwidth);
348 draw_gridline (z7, z8, stemwidth);
350 remember_pic := currentpicture;
352 draw_staff (-2, 2, 0);
359 fet_beginchar ("1/2 Sharp (3 beams)", "sharp.slashslashslash.stem");
360 save stem, stemx, stemwidth;
361 save outer_space, interbeam;
362 save sharp_beamheight;
364 sharp_beamheight# := 0.22 staff_space# + stafflinethickness#;
366 stemwidth# := stafflinethickness# + .05 staff_space#;
367 define_whole_blacker_pixels (stemwidth);
369 interbeam := 1.2 staff_space_rounded;
371 set_char_box (0, 0.95 staff_space#,
372 1.3 staff_space#, 1.3 staff_space#);
375 outer_space := hround ((w - stemwidth) / 2);
377 w := 2 outer_space + stemwidth;
378 d := d - feta_space_shift;
380 draw_meta_sharp (.8 w, -.5 interbeam);
381 draw_meta_sharp (.8 w, -.5 interbeam + vround interbeam);
382 sharp_beamheight# := 1/.8 sharp_beamheight#;
383 draw_meta_sharp (w, 0);
385 pickup pencircle scaled stemwidth;
387 lft x5 = lft x6 = outer_space;
388 top y6 = vround (1.5 staff_space - .5 stem);
389 bot y5 = -top y6 + feta_space_shift;
392 draw_gridline (z5, z6, stemwidth);
394 remember_pic := currentpicture;
396 draw_staff (-2, 2, 0);
403 fet_beginchar ("3/4 Sharp", "sharp.slashslash.stemstemstem");
404 save stem, stemx, stemwidth;
405 save outer_space, interbeam;
407 stemwidth# := stafflinethickness# + .05 staff_space#;
408 define_whole_blacker_pixels (stemwidth);
410 interbeam := 1.05 staff_space_rounded;
412 set_char_box (0, 1.6 staff_space#,
413 1.5 staff_space#, 1.5 staff_space#);
416 stemx := hround stem;
417 outer_space := hround ((w - 2 stemx - stemwidth) / 2);
419 w := 2 outer_space + 2 stemx + stemwidth;
420 d := d - feta_space_shift;
422 draw_meta_sharp (w, -.5 interbeam);
423 draw_meta_sharp (w, -.5 interbeam + vround interbeam);
425 pickup pencircle scaled stemwidth;
427 lft x5 = lft x6 = outer_space;
428 lft x7 = lft x8 = outer_space + stemx;
429 lft x9 = lft x10 = outer_space + 2 stemx;
431 top y6 = vround (1.5 staff_space - 2 stem * beamslope);
432 bot y9 = -top y6 + feta_space_shift;
437 labels (5, 6, 7, 8, 9, 10);
439 draw_gridline (z5, z6, stemwidth);
440 draw_gridline (z7, z8, stemwidth);
441 draw_gridline (z9, z10, stemwidth);
443 remember_pic := currentpicture;
445 draw_staff (-2, 2, 0);
453 % The stems of the natural are brushed (at least, in Barenreiter SCS)
456 fet_beginchar ("Natural", "natural");
457 save stemwidth, top_stem_thick;
458 save ne, pat_top, pat_bottom;
460 path pat_top, pat_bottom;
462 top_stem_thick# = stafflinethickness# + .10 staff_space#;
463 stemwidth# = 0.09 staff_space# + .5 stafflinethickness#;
464 define_whole_blacker_pixels (top_stem_thick, stemwidth);
466 set_char_box (0, 2/3 staff_space#,
467 1.5 staff_space#, 1.5 staff_space#);
469 d := d - feta_space_shift;
471 pickup pencircle scaled stemwidth;
473 penpos1 (top_stem_thick, 0);
474 penpos3 (top_stem_thick, 0);
475 penpos2 (stemwidth, 0);
476 penpos4 (stemwidth, 0);
485 top y2 = vround (staff_space - 3/2 stafflinethickness);
486 y4 = -y2 + feta_space_shift;
488 pat_bottom := z4r{z4r - z1r}
491 fill simple_serif (z1l, z1r, -30)
495 pat_top := z2r{z2r - z3r}
498 fill simple_serif (z3l, z3r, 30)
502 ne = (x2 - x4, stafflinethickness);
504 z11' = z3l + whatever * (z2l - z3l);
505 y11' = vround (.5 (staff_space - stafflinethickness));
506 z11 = z11' + whatever * ne;
508 z12 = directionpoint -ne of pat_top;
509 z13 = z12 + whatever * ne;
511 z14 = z11 + whatever * ne;
514 z21' = z4r + whatever * (z1r - z4r);
515 y21' = -y11' + feta_space_shift;
516 z21 = z21' + whatever * ne;
518 z22 = directionpoint -ne of pat_bottom;
519 z23 = z22 + whatever * ne;
521 z24 = z21 + whatever * ne;
535 penlabels (1, 2, 3, 4);
536 labels (11, 11', 12, 13, 14, 21, 21', 22, 23, 24);
538 remember_pic := currentpicture;
540 draw_staff (-2, 2, 0);
548 % Dedicated to my mom. (3/10/97)
550 % Mamma, ik hou van je; kom je alsjeblieft terug?
554 % TODO: remove crook_fatness
555 % TODO: document, simplify!
558 def draw_meta_flat (expr xcenter, w, crook_fatness) =
560 save bottom_overshoot, bot_crook_dir;
561 save top_stem_thick, bottom_stem_thick, hair, smaller_hole;
562 save top_crook_thinness;
565 pair center, bot_crook_dir;
570 % the stem shouldn't reach the top staff line.
571 %% TODO: should take from height.
573 % TODO: parameterize this
575 if w >= 0.75 staff_space:
576 smaller_hole = 0.35 stafflinethickness;
580 clearing = 1.7 stafflinethickness;
581 crook_thinness = .7 stafflinethickness + .06 staff_space;
582 top_crook_thinness = 1 stafflinethickness + .065 staff_space;
583 bottom_overshoot = stafflinethickness;
585 bottom_stem_thick# = 0.06 staff_space# + 0.6 stafflinethickness#;
586 top_stem_thick# = 0.1 staff_space# + 1.2 stafflinethickness#;
587 define_whole_blacker_pixels (bottom_stem_thick, top_stem_thick);
589 if odd (top_stem_thick - bottom_stem_thick):
590 top_stem_thick := top_stem_thick - 1;
593 center = (xcenter, 0);
595 x1l = hround (xcenter - .5 top_stem_thick);
596 y1 = vround (2 staff_space - clearing);
597 x2l = hround (xcenter - .5 bottom_stem_thick);
598 y2 = -.5 staff_space - .5 stafflinethickness;
600 penpos1 (top_stem_thick, 0);
601 penpos2 (bottom_stem_thick, 0);
603 y3l = vfloor ((staff_space - stafflinethickness) / 2);
604 z3l = whatever [z2r, z1r];
605 z3r = .3 [z2r, z1r] + (smaller_hole, 0);
608 % we insert z3l to get better conversion with mf2pt1
609 fill simple_serif (z1r, z1l, 30)
615 z10 = whatever [z2r, z1r] + (smaller_hole, 0);
616 y10 = -1/10 staff_space;
619 x11 = xcenter + bottom_overshoot / 3;
620 y11 = -vround (.5 (staff_space + stafflinethickness)
623 penpos4 (whatever, 53);
625 y4l - y4r = top_crook_thinness;
626 y5r = .15 staff_space;
627 x5l = hround (w + xcenter);
628 y4 = staff_space / 2;
629 x4r = .45 [x5r, x3r];
632 penpos5 (crook_fatness, -175);
634 bot_crook_dir = unitvector ((x5l, 0) - z11);
635 z8 = z11 + whatever * bot_crook_dir;
636 y8 = -staff_space / 2;
639 + whatever * bot_crook_dir
640 + crook_thinness * (bot_crook_dir rotated 90);
643 unfill z3r{z3r - z10}
646 .. z7{-bot_crook_dir}
662 % unfortunately, 600dpi is not enough to show the brush of the stem.
665 fet_beginchar ("Flat", "flat");
666 set_char_box (1.2 stafflinethickness#, .8 staff_space#,
667 0.6 staff_space#, 1.9 staff_space#);
669 draw_meta_flat (0, w, 0.31 staff_space);
670 penlabels (range 0 thru 11);
672 remember_pic := currentpicture;
674 draw_staff (-2, 2, 0);
681 fet_beginchar ("Flat (slashed)", "flat.slash");
682 set_char_box (.4 staff_space#, .8 staff_space#,
683 0.6 staff_space#, 1.9 staff_space#);
685 draw_meta_flat (0, w, 0.31 staff_space);
689 save slope, slash_width;
694 z12 = z11 - (slash_width, slash_width * slope) / 2;
695 z13 = z11 + (slash_width, slash_width * slope) / 2;
696 penpos12 (1.5 stafflinethickness, angle (z13 - z12) - 90);
697 penpos13 (1.5 stafflinethickness, angle (z13 - z12) - 90);
699 z14 = z12 - .75 stafflinethickness * unitvector (z13 - z12);
700 z15 = z13 + .75 stafflinethickness * unitvector (z13 - z12);
714 remember_pic := currentpicture;
716 draw_staff (-2, 2, 0);
720 fet_beginchar ("Flat (slashed twice)", "flat.slashslash");
721 set_char_box (.4 staff_space#, .8 staff_space#,
722 0.6 staff_space#, 1.9 staff_space#);
724 draw_meta_flat (0, w, 0.31 staff_space);
728 save slope, slash_width;
733 z12 = z11 - (slash_width, slash_width * slope) / 2;
734 z13 = z11 + (slash_width, slash_width * slope) / 2;
735 penpos12 (1.5 stafflinethickness, angle (z13 - z12) - 90);
736 penpos13 (1.5 stafflinethickness, angle (z13 - z12) - 90);
738 z14 = z12 - .75 stafflinethickness * unitvector (z13 - z12);
739 z15 = z13 + .75 stafflinethickness * unitvector (z13 - z12);
754 z22 = z21 - (slash_width, slash_width * slope) / 2;
755 z23 = z21 + (slash_width, slash_width * slope) / 2;
756 penpos22 (1.5 stafflinethickness, angle (z23 - z22) - 90);
757 penpos23 (1.5 stafflinethickness, angle (z23 - z22) - 90);
759 z24 = z22 - .75 stafflinethickness * unitvector (z23 - z22);
760 z25 = z23 + .75 stafflinethickness * unitvector (z23 - z22);
774 remember_pic := currentpicture;
776 draw_staff (-2, 2, 0);
780 fet_beginchar ("Flatflat (mirrored)", "mirroredflat.flat");
781 set_char_box (0, 1.6 staff_space#,
782 0.6 staff_space#, 1.9 staff_space#);
784 % This is a modified version of `draw_meta_flat'.
786 save crook_thinness, crook_fatness;
787 save bottom_overshoot, bot_crook_dir;
788 save top_stem_thick, bottom_stem_thick, hair, smaller_hole;
789 save top_crook_thinness;
792 pair center, bot_crook_dir;
801 % the stem shouldn't reach the top staff line.
802 %% TODO: should take from height.
804 % TODO: parameterize this
806 if wid >= 0.75 staff_space:
807 smaller_hole = 0.35 stafflinethickness;
811 clearing = 1.7 stafflinethickness;
812 crook_thinness = .7 stafflinethickness + .06 staff_space;
813 crook_fatness = 0.31 staff_space;
814 top_crook_thinness = 1 stafflinethickness + .065 staff_space;
815 bottom_overshoot = stafflinethickness;
817 bottom_stem_thick# = 0.06 staff_space# + 0.6 stafflinethickness#;
818 top_stem_thick# = 0.1 staff_space# + 1.2 stafflinethickness#;
819 define_whole_blacker_pixels (bottom_stem_thick, top_stem_thick);
821 if odd (top_stem_thick - bottom_stem_thick):
822 top_stem_thick := top_stem_thick - 1;
827 x1l = hround (-.5 top_stem_thick);
828 y1 = vround (2 staff_space - clearing);
829 x2l = hround (-.5 bottom_stem_thick);
830 y2 = -.5 staff_space - .5 stafflinethickness;
832 penpos1 (top_stem_thick, 0);
833 penpos2 (bottom_stem_thick, 0);
835 y3l = vfloor ((staff_space - stafflinethickness) / 2);
836 z3l = whatever [z2r, z1r];
837 z3r = .3 [z2r, z1r] + (smaller_hole, 0);
840 z10 = whatever [z2r, z1r] + (smaller_hole, 0);
841 y10 = -1/10 staff_space;
844 x11 = bottom_overshoot / 3;
845 y11 = -vround (.5 (staff_space + stafflinethickness)
848 penpos4 (whatever, 53);
850 y4l - y4r = top_crook_thinness;
851 y5r = .15 staff_space;
853 y4 = staff_space / 2;
854 x4r = .45 [x5r, x3r];
857 penpos5 (crook_fatness, -175);
859 bot_crook_dir = unitvector ((x5l, 0) - z11);
860 z8 = z11 + whatever * bot_crook_dir;
861 y8 = -staff_space / 2;
864 + whatever * bot_crook_dir
865 + crook_thinness * (bot_crook_dir rotated 90);
868 pat := z3r{z3r - z10}
871 .. z7{-bot_crook_dir}
876 unfill pat xscaled -1;
884 -- simple_serif (z1r, z1l, 30)
885 -- reverse pat xscaled -1 shifted (-feta_eps, 0)
888 currentpicture := currentpicture shifted (w/2, 0);
890 remember_pic := currentpicture;
892 draw_staff (-2, 2, 0);
899 fet_beginchar ("Semi flat", "mirroredflat");
900 set_char_box (1.2 stafflinethickness#, .8 staff_space#,
901 0.6 staff_space#, 1.9 staff_space#);
903 draw_meta_flat (0, w, 0.31 staff_space);
904 currentpicture := currentpicture xscaled -1 shifted (w - b, 0);
908 fet_beginchar ("Semi flat", "mirroredflat.backslash");
909 set_char_box (.4 staff_space#, .8 staff_space#,
910 0.6 staff_space#, 1.9 staff_space#);
912 draw_meta_flat (0, w, 0.31 staff_space);
916 save slope, slash_width;
921 z12 = z11 - (slash_width, slash_width * slope) / 2;
922 z13 = z11 + (slash_width, slash_width * slope) / 2;
923 penpos12 (1.5 stafflinethickness, angle (z13 - z12) - 90);
924 penpos13 (1.5 stafflinethickness, angle (z13 - z12) - 90);
926 z14 = z12 - .75 stafflinethickness * unitvector (z13 - z12);
927 z15 = z13 + .75 stafflinethickness * unitvector (z13 - z12);
938 currentpicture := currentpicture xscaled -1 shifted (w - b, 0);
944 fet_beginchar ("Double Flat", "flatflat");
945 save left_wid, overlap, right_wid;
951 set_char_box (1.2 stafflinethickness#,
952 (left_wid + right_wid - overlap) * staff_space#,
953 .6 staff_space#, 1.9 staff_space#);
954 draw_meta_flat (0, left_wid * staff_space, 1/3 staff_space);
955 draw_meta_flat (hround ((left_wid - overlap) * staff_space),
956 right_wid * staff_space, 1/3 staff_space);
960 fet_beginchar ("3/4 Flat", "flatflat.slash");
961 save left_wid, overlap, right_wid;
967 set_char_box (1.2 stafflinethickness#,
968 (left_wid + right_wid - overlap) * staff_space#,
969 .6 staff_space#, 1.9 staff_space#);
970 draw_meta_flat (0, left_wid * staff_space, 1/3 staff_space);
971 draw_meta_flat (hround ((left_wid - overlap) * staff_space),
972 right_wid * staff_space, 1/3 staff_space);
974 %% maybe we should clip part of the stems?
975 %% or make the 1st flat smaller?
977 pickup pencircle scaled 2 stafflinethickness;
979 z12 = round (-.25 w - b, .55 staff_space) + feta_offset;
980 z13 = round (.75 w, 1.45 staff_space) + feta_offset;
981 penpos12 (2 stafflinethickness, angle (z13 - z12) - 90);
982 penpos13 (2 stafflinethickness, angle (z13 - z12) - 90);
984 z14 = z12 - stafflinethickness * unitvector (z13 - z12);
985 z15 = z13 + stafflinethickness * unitvector (z13 - z12);
999 remember_pic := currentpicture;
1001 draw_staff (-2, 2, 0);
1008 fet_beginchar ("Double Sharp", "doublesharp");
1009 save klaverblad, klaversteel;
1013 klaversteel = 1/15 staff_space;
1014 klaverblad = .4 staff_space - .5 stafflinethickness;
1016 set_char_box (0, staff_space#, .5 staff_space#, .5 staff_space#);
1018 z1 = (klaversteel, 0);
1019 z2 = (w / 2 - klaverblad / 10, h - klaverblad);
1021 z4 = z2 reflectedabout ((0, 0), (1, 1));
1022 z5 = z1 reflectedabout ((0, 0), (1, 1));
1024 labels (1, 2, 3, 4, 5);
1026 pickup pencircle scaled blot_diameter;
1028 x2 := hfloor (rt x2) - blot_diameter / 2;
1029 x3 := hfloor (rt x3) - blot_diameter / 2;
1030 y3 := vfloor (top y3) - blot_diameter / 2;
1031 y4 := vfloor (top y4) - blot_diameter / 2;
1033 pat = (rt z1){dir45}
1040 .. {dir 225}(top z5);
1042 -- reverse pat xscaled -1 shifted (-feta_eps, 0);
1044 % assure symmetry -- it's more important to center the glyph on the
1045 % staff line than centering it between staff lines, so we use
1046 % feta_shift, not feta_space_shift.
1047 h := h + feta_shift;
1049 fill pat shifted (0, feta_shift)
1050 -- reverse pat yscaled -1 shifted (0, -feta_eps)
1054 currentpicture := currentpicture shifted (hround (w / 2), 0);
1056 remember_pic := currentpicture;
1058 draw_staff (-2, 2, 0);
1068 leftindent := .2 staff_space;
1070 set_char_box (0, .5 staff_space# + stafflinethickness#,
1071 staff_space#, staff_space#);
1073 d := d - feta_shift;
1075 z1 = (leftindent, h);
1076 z2 = (w - stafflinethickness, .5 (h - d));
1077 z3 = (leftindent, -d);
1079 penpos1 (stafflinethickness, 35);
1080 penpos2 (.1 staff_space + stafflinethickness, 0);
1081 penpos3 (stafflinethickness, -35);
1084 .. simple_serif (z3l, z3r, 90)
1086 .. simple_serif (z1r, z1l, 90)
1092 fet_beginchar ("Right Parenthesis", "rightparen");
1094 penlabels (1, 2, 3);
1096 remember_pic := currentpicture;
1098 draw_staff (-2, 2, 0);
1105 fet_beginchar ("Left Parenthesis", "leftparen");
1108 currentpicture := currentpicture xscaled -1;
1110 set_char_box (charwd, charbp, chardp, charht);
1113 fet_endgroup ("accidentals");