1 % solfa.mf - implements solfa shaped notes
3 % (c) 2001 Glen Prideaux <glenprideaux@iname.com>
5 % We can use the regular distorted-elliptical head in the feta font
6 % for the sol head, but we can't use the triangle or diamond heads for
7 % the do or me because they're too narrow and their lines too thin.
9 fet_begingroup("solfa");
11 noteheight#:=staff_space#+ (overdone_heads) *stafflinethickness#;
12 define_pixels(noteheight);
21 pent# = stafflinethickness#;
24 def generic_drawnoteshape =
25 save a,beta,black,white;
28 pickup pencircle scaled pent;
29 2 beta# = noteheight#;
32 hei# := noteheight#+pent#;
33 set_char_box(0, wid#,0.5 hei#, 0.5 hei#);
35 define_pixels(a,beta);
37 black = noteshape xscaled a yscaled beta shifted (a+pent/2,0);
41 white = noteishape xscaled (a*ai_a) yscaled (beta*bi_b)
42 shifted ((dx+1)*(a+pent/2),dy*(beta+pent/2));
48 save solid; boolean solid;
50 generic_drawnoteshape;
52 def drawquarternoteshape =
53 save solid; boolean solid;
55 generic_drawnoteshape;
58 % do - equilateral triangle: (0,-h/2) -- (w/2,h/2) -- (w,-h/2) -- cycle;
59 % stem attachment: -h/2
61 save triangle; path triangle;
62 triangle := (-1,-1) -- (0,1) -- (1,-1) -- cycle;
65 save noteshape, noteishape, dx, dy, ai_a, bi_b;
66 path noteshape, noteishape;
67 noteshape = noteishape = triangle;
69 (ai_a,bi_b)=(i_o,i_o);
73 fet_beginchar("Whole dohead", "0do", "wholedohead")
74 pickup pencircle scaled blot_diameter;
82 fet_beginchar("Half dohead", "1do", "halfdohead")
90 fet_beginchar("Quart dohead", "2do", "dohead")
100 % re - flat top, curved bottom:
101 % (0,h/2) {dir -90} .. (w/2,-h/2) .. {dir 90} (w,h/2) -- cycle;
102 % (broader along the base and with more vertical sides for half and
104 % stem attachment: h/2
106 save reshape; path reshape;
107 reshape = (-1,1)--(-1,0.2){down} ... (0,-1) ... {up}(1,0.2)--(1,1)--cycle;
109 fet_beginchar("Whole rehead", "0re", "wholerehead")
110 save a_b, ai_a, bi_b, dx, dy, noteshape, noteishape;
111 path noteshape, noteishape;
113 noteishape = reshape;
121 fet_beginchar("Half rehead", "1re", "halfrehead")
122 save a_b, ai_a, bi_b, dx, dy, noteshape, noteishape;
123 path noteshape, noteishape;
125 noteishape = reshape;
133 fet_beginchar("Quart rehead", "2ro", "rehead")
139 drawquarternoteshape;
142 % me - diamond: (0,0) -- (w/2,h/2) -- (w,0) -- (w/2,-h/2) -- cycle;
143 % similar to existing diamond shaped head, but not quite the same
146 save meshape; path meshape;
147 meshape = (-1,0)--(0,1)--(1,0)--(0,-1)--cycle;
149 fet_beginchar("Whole mehead", "0me", "wholemehead")
150 save a_b, ai_a, bi_b, dx, dy, noteshape, noteishape;
151 path noteshape, noteishape;
153 noteishape = (meshape slanted -0.35) rotated -10.5;
161 fet_beginchar("Half mehead", "1me", "halfmehead")
162 save a_b, ai_a, bi_b, dx, dy, noteshape, noteishape;
163 path noteshape, noteishape;
165 noteishape = (meshape slanted -0.35) rotated -10.5;
173 fet_beginchar("Quart mehead", "2me", "mehead")
179 drawquarternoteshape;
183 % fa - scalene triangle:
184 % for stem up: (0,h/2) -- (w,h/2) -- (w,-h/2) -- cycle;
185 % for stem down: (w,-h/2) -- (0,1h/2) -- (0,h/2) -- cycle;
186 % (one is a 180 degree rotation of the other)
187 % stem attachment: (doesn't much matter)
189 save fashape; path fashape;
190 fashape = (-1,1)--(1,1)--(1,-1)--cycle;
192 fet_beginchar("Whole fahead", "0fa", "wholefahead")
193 save a_b, ai_a, bi_b, dx, dy, noteshape, noteishape;
194 path noteshape, noteishape;
196 noteishape = fashape;
204 fet_beginchar("Half stemup fahead", "1fau", "halffauhead")
205 save a_b, ai_a, bi_b, dx, dy, noteshape, noteishape;
206 path noteshape, noteishape;
208 noteishape = fashape;
216 fet_beginchar("Quart stemup fahead", "2fau", "fauhead")
222 drawquarternoteshape;
225 fet_beginchar("Half stemdn fahead", "1fad", "halffadhead")
226 save a_b, ai_a, bi_b, dx, dy, noteshape, noteishape;
227 path noteshape, noteishape;
228 noteshape = fashape rotated 180;
229 noteishape = fashape rotated 180;
237 fet_beginchar("Quart stemdn fahead", "2fad", "fadhead")
242 noteshape = fashape rotated 180;
243 drawquarternoteshape;
247 % sol - oval ... the standard "round" note
249 % la - rectangle: (0,h/2)--(w,h.2)--(w,-h/2)--(0,-h/2)--cycle;
250 % stem attachment: (doesn't much matter)
251 save lashape; path lashape;
252 lashape = (-1,-1)--(-1,1)--(1,1)--(1,-1)--cycle;
254 fet_beginchar("Whole lahead", "0la", "wholelahead")
255 save a_b, ai_a, bi_b, dx, dy, noteshape, noteishape;
256 path noteshape, noteishape;
258 noteishape = lashape;
266 fet_beginchar("Half lahead", "1la", "halflahead")
267 save a_b, ai_a, bi_b, dx, dy, noteshape, noteishape;
268 path noteshape, noteishape;
270 noteishape = lashape;
278 fet_beginchar("Quart lahead", "2la", "lahead")
284 drawquarternoteshape;
288 % te - an "icecream cone" with about 2/3 of
289 % the height in the cone and only 1/3 in the curved top:
290 % (0,h/6)--(w/2,-h/2)--(w,h/6)..(w/2,h/2)..cycle;
291 % stem attachment: h/6
292 save teshape; path teshape;
293 teshape = (0,-1)--(-1,0.3)..(0,1)..(1,0.3)--cycle;
295 fet_beginchar("Whole tehead", "0te", "wholetehead")
296 save a_b, ai_a, bi_b, dx, dy, noteshape, noteishape;
297 path noteshape, noteishape;
299 noteishape = teshape;
307 fet_beginchar("Half tehead", "1te", "halftehead")
308 save a_b, ai_a, bi_b, dx, dy, noteshape, noteishape;
309 path noteshape, noteishape;
311 noteishape = teshape;
319 fet_beginchar("Quart tehead", "2te", "tehead")
325 drawquarternoteshape;
328 fet_endgroup("solfa")