2 % feta-toevallig.mf -- implement Accidentals
4 % source file of the Feta (Font-En-Tja) music font
6 % (c) 1997 Han-Wen Nienhuys <hanwen@stack.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("Sharp" , "1", "sharp");
30 set_char_box(0, 1.1 interline#, 1.5 interline#,
33 save interbeam, interstem, beamheight, beamwidth,
36 interbeam := 1.05 interline;
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 interline + ypart center;
74 top y4 = 1.5 interline + ypart center;
79 xs := interstem* beamwidth / 2;
80 draw stem shifted (- xs, - xs* beamslope);
81 draw stem shifted (xs , xs *beamslope);
85 fet_beginchar( "Natural", "0", "natural")
86 set_char_box(0, 8/12 interline#, 1.5 interline#, 1.5 interline#);
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 = interline - 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 interline;
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 interline) + center;
143 z2 = (0, - 1/2 interline)+ 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 = (interline - stafflinethickness)/2 + ypart center;
152 z3l = whatever [z2r,z1r];
154 z3r = .26 [z2r, z1r];
157 z4 = (3/8 interline, interline/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 interline + ypart center;
163 x5l = w + xpart center;
164 penpos5(crook_fatness, -175);
166 z8 = (0, - interline/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 interline) + 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("Flat", "-1", "flat")
207 set_char_box(1.2 stafflinethickness#, .8 interline#, .5 interline#, 2 interline#);
208 draw_meta_flat(0, w, 1/3 interline);
212 fet_beginchar("Double flat", "-2", "flatflat")
213 save left_wid, overlap, right_wid;
217 set_char_box(1.2 stafflinethickness#, (left_wid + right_wid -overlap) *interline#, .5 interline#, 2 interline#);
218 draw_meta_flat(0, left_wid* interline, 1/3 interline);
219 draw_meta_flat((left_wid - overlap) *interline,
220 right_wid *interline, 1/3 interline);
223 fet_beginchar("Double sharp", "2", "sharpsharp")
224 set_char_box(0, interline#, .5 interline#, .5 interline#);
225 save klaverblad, klaversteel;
227 klaversteel = 1/15 interline;
228 klaverblad = .35 interline;
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 interline;
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);
253 fet_endgroup("accidentals");