2 % feta-toevallig.mf -- implement Accidentals
4 % source file of the Feta (Font-En-Tja) music font
6 % (c) 1997--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
11 % Accidentals from various sources, notably
13 % Baerenreiter edition of Schuberts `Auf dem Strom' (sharp, natural)
14 % F Hofmeister edition of Muellers `Etueden fuer Horn' (double sharp, flat)
20 %\tracingequations:= tracingonline := 1;
22 fet_begingroup("accidentals");
25 % The beams of most sharps have horizontal endings (as if drawn with
26 % a square pen). [Wanske] does not mention this, so we'll just ignore
29 fet_beginchar("Default Sharp" , "1", "sharp");
30 set_char_box(0, 1.1 staff_space#, 1.5 staff_space#,
33 save interbeam, interstem, beamheight, beamwidth,
36 interbeam := 1.05 staff_space;
38 beamheight := 4 stafflinethickness;
40 stemwidth := 1.3 stafflinethickness;
41 roundness := 2blot_diameter;
45 roundness + 2 spanwidth = beamwidth;
46 roundness + 2 spanheight = beamheight;
48 2 horizontal_protrusion + interstem * beamwidth + stemwidth
51 % wanske: whole beamheight; or ca 18 degrees
52 % z2 - z1 = (beamwidth - roundness, beamheight/2);
53 z2 - z1 = (beamwidth - roundness, beamheight);
55 beamslope = (y2-y1)/(x2-x1);
58 hspan = (spanwidth, beamslope * spanwidth);
59 vspan = (0, spanheight);
63 beam := (hspan + vspan -- -hspan
64 + vspan -- -hspan -vspan -- hspan - vspan -- cycle )
67 pickup pencircle scaled roundness;
68 filldraw (beam shifted (0,-interbeam/2));
69 filldraw (beam shifted (0,interbeam/2));
71 pickup pencircle scaled stemwidth;
72 x3 = x4 = xpart center;
73 bot y3 = -1.5 staff_space + ypart center;
74 top y4 = 1.5 staff_space + ypart center;
79 xs := interstem* beamwidth / 2;
80 draw stem shifted (- xs, - xs* beamslope);
81 draw stem shifted (xs , xs *beamslope);
85 fet_beginchar( "Default Natural", "0", "natural")
86 set_char_box(0, 8/12 staff_space#, 1.5 staff_space#, 1.5 staff_space#);
88 save interbeam, interstem, beamheight, beamwidth,
91 beamheight = 4.5 stafflinethickness;
92 interstem + stemwidth = w;
93 stemwidth = 1.3 stafflinethickness;
95 z2 -z1 = (interstem, slope * interstem);
96 xpart .5 [z2,z1] = xcenter ;
100 pickup penrazor scaled beamheight rotated 90;
101 top y2 = staff_space - 3/2 stafflinethickness ;
102 slope = stafflinethickness / interstem;
105 draw (xpart z1, -y2) .. (xpart z2, -y1);
108 pickup pencircle scaled stemwidth;
111 top y3 = 1.5 staff_space;
114 draw (xpart z1, -y4) .. z3;
115 draw (xpart z2, -y3) .. z4;
122 % Dedicated to my mom. (3/10/97)
124 % Mamma, ik hou van je; kom je alsjeblieft terug?
128 % TODO: remove crook_fatness
129 def draw_meta_flat(expr xcenter, w, crook_fatness) =
132 save top_stem_thick, bottom_stem_thick, hair;
135 center = (xcenter, 0);
137 crook_thinness = 1.25 stafflinethickness;
138 top_stem_thick = 2 stafflinethickness;
139 bottom_stem_thick = 1.2 stafflinethickness;
142 z1 = (0, 2 staff_space) + center;
143 z2 = (0, - 1/2 staff_space)+ center;
145 penpos1(top_stem_thick, 0);
146 penpos2(bottom_stem_thick, 0);
148 fill simple_serif(z1r, z1l, 30) -- z2l -- z2r -- cycle;
151 y3l = (staff_space - stafflinethickness)/2 + ypart center;
152 z3l = whatever [z2r,z1r];
154 z3r = .26 [z2r, z1r];
157 z4 = (3/8 staff_space, staff_space/2) + center;
158 penpos4(whatever, 53);
159 y4l - y4r = 2 crook_thinness ;
160 % y4l - y4r = 6/20[crook_thinness, crook_fatness] ;
162 y5r = 1/4 staff_space + ypart center;
163 x5l = w + xpart center;
164 penpos5(crook_fatness, -175);
166 z8 = (0, - staff_space/2 - stafflinethickness/2) + center;
171 ne_angle = angle(z9 - z8);
174 z6l = 18/33 [z8,z9] + .5 crook_thinness *dir(ne_angle -90);
176 penpos7(crook_thinness, ne_angle + 90);
178 z6r = .3 (z9-z8) + z7r;
180 % penpos7(crook_thinness, angle(dir(z8-center) -180);
182 penpos8(whatever, ne_angle + 90);
183 x8r = xpart center - bottom_stem_thick/2;
184 penlabels(range 0 thru 10);
186 z10 = (bottom_stem_thick/2, -1/5 staff_space) + center;
188 unfill z3r{up} .. z4r{right} .. tension .9
191 .. z10 {up} -- cycle;
193 .. tension 0.8 ..z8l{(z9-z8)}
197 .. z4l{left} .. z3l -- cycle;
204 % unfortunately, 600dpi is not enough to show the brush of the stem.
206 fet_beginchar("Default Flat", "-1", "flat")
207 set_char_box(1.2 stafflinethickness#, .8 staff_space#, .5 staff_space#, 2 staff_space#);
208 draw_meta_flat(0, w, 1/3 staff_space);
212 fet_beginchar("Default Double Flat", "-2", "flatflat")
213 save left_wid, overlap, right_wid;
217 set_char_box(1.2 stafflinethickness#, (left_wid + right_wid -overlap) *staff_space#, .5 staff_space#, 2 staff_space#);
218 draw_meta_flat(0, left_wid* staff_space, 1/3 staff_space);
219 draw_meta_flat((left_wid - overlap) *staff_space,
220 right_wid *staff_space, 1/3 staff_space);
223 fet_beginchar("Default Double Sharp", "2", "sharpsharp")
224 set_char_box(0, staff_space#, .5 staff_space#, .5 staff_space#);
225 save klaverblad, klaversteel;
227 klaversteel = 1/15 staff_space;
228 klaverblad = .35 staff_space;
230 z1 = (klaversteel, 0);
231 z2 = (w/2 - klaverblad / 10, h - klaverblad);
233 z4 = z2 reflectedabout((0,0), (1,1));
234 z5 = z1 reflectedabout((0,0), (1,1));
237 pickup pencircle scaled 1/20 staff_space;
239 z1{dir 45} .. {right}z2 -- z3 --
240 z4{down} .. {dir 225}z5 .. cycle;
243 addto currentpicture also currentpicture yscaled (-d/h);
244 addto currentpicture also currentpicture xscaled (-1);
247 currentpicture := currentpicture shifted (w/2,0);
256 leftindent# := .2 staff_space#;
257 define_pixels(leftindent);
258 set_char_box(0, .5 staff_space#+stafflinethickness#,
259 staff_space#, staff_space#);
261 z2 = (w-stafflinethickness,0);
262 z3 = (leftindent,-d);
264 penpos1(stafflinethickness, 35);
265 penpos2(2 stafflinethickness, 0);
266 penpos3(stafflinethickness, -35);
269 fill z2l{down} .. simple_serif(z3l, z3r, 90) .. z2r{up}
270 .. simple_serif(z1r, z1l, 90) .. z2l{down} -- cycle;
273 fet_beginchar("Right Parenthesis", ")", "rightparen")
277 fet_beginchar("Left Parenthesis", "(", "leftparen")
279 currentpicture := currentpicture xscaled -1;
280 set_char_box(charwd, charbp, chardp, charht);
291 fet_beginchar("Ed. Med. Flat" , "medicaea-1", "medicaeaflat");
292 set_char_box(0, 0.8 staff_space#, 0.6 staff_space#,
296 xscaled 0.50 stafflinethickness
297 yscaled 0.22 staff_space;
302 za = (0.00 staff_space, +0.90 staff_space);
303 zb = (0.00 staff_space, -0.50 staff_space);
307 xscaled 0.50 stafflinethickness
308 yscaled 0.22 staff_space
314 zc = (0.10 staff_space, -0.50 staff_space);
315 zd = (0.40 staff_space, +0.40 staff_space);
316 ze = (0.10 staff_space, +0.40 staff_space);
318 draw zc{(1,2)} .. zd .. ze{(-1,-1)};
330 fet_beginchar("Ed. Vat. Flat" , "vaticana-1", "vaticanaflat");
331 set_char_box(0, 0.8 staff_space#, 0.6 staff_space#,
333 define_pixels (stafflinethickness, staff_space);
335 save za, zb, zc, zd, ze, zf, zg;
336 pair za, zb, zc, zd, ze, zf, zg;
337 za = (0.00 staff_space, +0.80 staff_space);
338 zb = (0.00 staff_space, -0.03 staff_space);
339 zc = (0.25 staff_space, -0.23 staff_space);
340 zd = (0.50 staff_space, -0.23 staff_space);
341 ze = (0.50 staff_space, +0.00 staff_space);
342 zf = (0.25 staff_space, +0.20 staff_space);
343 zg = (0.15 staff_space, +0.26 staff_space);
346 xscaled 0.50 stafflinethickness
347 yscaled 0.22 staff_space;
348 draw za{down} .. {down}zb .. zc .. zd{up} .. {up}ze .. zf .. zg;
351 fet_beginchar("Ed. Vat. Natural" , "vaticana0", "vaticananatural");
352 set_char_box(0, 0.7 staff_space#, 0.6 staff_space#,
354 define_pixels (stafflinethickness, staff_space);
359 xscaled 0.80 stafflinethickness
360 yscaled 0.22 staff_space;
361 za = (0.00 staff_space, +0.65 staff_space);
362 zb = (0.00 staff_space, -0.35 staff_space);
363 zc = (0.00 staff_space, -0.30 staff_space);
364 zd = (0.40 staff_space, -0.08 staff_space);
368 addto currentpicture also currentpicture
371 shifted (0.40 staff_space, 0.0 staff_space);
383 fet_beginchar("Mensural Sharp" , "mensural1", "mensuralsharp");
384 set_char_box(0, 0.7 staff_space#, 0.5 staff_space#,
387 define_pixels (stemthick, staff_space);
388 stemthick# = stafflinethickness#;
392 pickup pencircle scaled 0.8 stemthick;
393 za = 0.4 * staff_space * (0.8, 1);
397 addto currentpicture also currentpicture xscaled -1;
398 addto currentpicture also currentpicture shifted (0.20 staff_space, 0);
402 fet_beginchar("Mensural Flat" , "mensural-1", "mensuralflat");
403 set_char_box(0, 0.7 staff_space#, 0.4 staff_space#,
406 define_pixels (stemthick, staff_space);
407 stemthick# = stafflinethickness#;
409 save za, zb, zc, zd, ze;
410 pair za, zb, zc, zd, ze;
412 xscaled 1.4 stemthick
413 yscaled 0.6 stemthick
416 za = (0.00 staff_space, +1.80 staff_space);
417 zb = (0.00 staff_space, -0.25 staff_space);
418 zc = (0.35 staff_space, -0.25 staff_space);
419 zd = (0.35 staff_space, +0.25 staff_space);
420 ze = (0.00 staff_space, +0.25 staff_space);
421 draw za -- zb .. zc .. zd .. ze;
424 fet_beginchar("Hufnagel Flat" , "hufnagel-1", "hufnagelflat");
425 set_char_box(0, 0.7 staff_space#, 0.4 staff_space#,
428 define_pixels (stemthick, staff_space);
429 stemthick# = stafflinethickness#;
431 save za, zb, zc, zd, ze, zf;
432 pair za, zb, zc, zd, ze, zf;
434 xscaled 2.4 stemthick
435 yscaled 0.4 stemthick
438 za = (0.00 staff_space, +1.80 staff_space);
439 zb = (0.00 staff_space, -0.15 staff_space);
440 zc = (0.25 staff_space, -0.30 staff_space);
441 zd = (0.50 staff_space, +0.00 staff_space);
442 ze = (0.30 staff_space, +0.30 staff_space);
443 zf = (0.00 staff_space, +0.15 staff_space);
444 draw za -- zb -- zc .. zd .. ze -- zf;
447 fet_endgroup("accidentals");