]> git.donarmstrong.com Git - lilypond.git/blob - mf/feta-solfa.mf
2003 -> 2004
[lilypond.git] / mf / feta-solfa.mf
1 % solfa.mf - implements solfa shaped notes
2 %
3 % (c) 2001--2004 Glen Prideaux <glenprideaux@iname.com>
4
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.
8
9 fet_begingroup("solfa");
10
11 noteheight#:=staff_space#+ (overdone_heads) *stafflinethickness#;
12 define_pixels(noteheight);
13
14 %%%%%%%%
15 %
16 %
17 % SOLFA SHAPED NOTES
18 %
19 %
20 save pent;
21 pent# = stafflinethickness#;
22 define_pixels(pent);
23
24 def generic_drawnoteshape =
25   save a,beta,black,white;
26   path black, white;
27
28   pickup pencircle scaled pent;
29   2 beta# = noteheight#;
30   a# = a_b*beta#;
31   wid# := 2a#+pent#;
32   hei# := noteheight#+pent#;
33   set_char_box(0, wid#,0.5 hei#, 0.5 hei#);
34
35   define_pixels(a,beta);
36
37   black = noteshape xscaled a yscaled beta shifted (a+pent/2,0);
38   filldraw black;
39
40   if (solid=false):
41     white = noteishape xscaled (a*ai_a) yscaled (beta*bi_b)
42                        shifted ((dx+1)*(a+pent/2),dy*(beta+pent/2));
43     unfill white;
44   fi;
45 enddef;  
46
47 def drawnoteshape =
48   save solid; boolean solid;
49   solid=false;
50   generic_drawnoteshape;
51 enddef;
52 def drawquarternoteshape =
53   save solid; boolean solid;
54   solid=true;
55   generic_drawnoteshape;
56 enddef;
57
58 % do - equilateral triangle: (0,-h/2) -- (w/2,h/2) -- (w,-h/2) -- cycle;
59 % stem attachment: -h/2
60
61 save triangle; path triangle;
62 triangle := (-1,-1) -- (0,1) -- (1,-1) -- cycle;
63
64 def drawdoshape =
65   save noteshape, noteishape, dx, dy, ai_a, bi_b;
66   path noteshape, noteishape;
67   noteshape = noteishape = triangle;
68   (dx,dy)=(0,0.05);
69   (ai_a,bi_b)=(i_o,i_o);
70   drawnoteshape;
71 enddef;
72
73 fet_beginchar("Whole dohead", "0do", "wholedohead")
74   pickup pencircle scaled blot_diameter;
75   save a_b, i_o;
76   a_b = 1.8;
77   i_o = 0.6;
78
79   drawdoshape;
80 fet_endchar;
81   
82 fet_beginchar("Half dohead", "1do", "halfdohead")
83   save a_b, i_o;
84   a_b = 1.5;
85   i_o = 0.6;
86
87   drawdoshape;
88 fet_endchar;
89   
90 fet_beginchar("Quart dohead", "2do", "dohead")
91   save a_b, noteshape;
92   path noteshape;
93   a_b = 1.54;
94   
95   noteshape = triangle;
96   drawquarternoteshape;
97
98 fet_endchar;
99   
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
103 % whole notes)
104 % stem attachment: h/2
105
106 save reshape; path reshape;
107 reshape = (-1,1)--(-1,0.2){down} ... (0,-1) ... {up}(1,0.2)--(1,1)--cycle;
108
109 fet_beginchar("Whole rehead", "0re", "wholerehead")
110   save a_b, ai_a, bi_b, dx, dy, noteshape, noteishape;
111   path noteshape, noteishape;
112   noteshape = reshape;
113   noteishape = reshape;
114   a_b = 1.8;
115   bi_b = 0.65;
116   ai_a = 0.8;
117   (dx,dy)=(0,-0.1);
118   drawnoteshape;
119 fet_endchar;
120
121 fet_beginchar("Half rehead", "1re", "halfrehead")
122   save a_b, ai_a, bi_b, dx, dy, noteshape, noteishape;
123   path noteshape, noteishape;
124   noteshape = reshape;
125   noteishape = reshape;
126   a_b = 1.5;
127   bi_b = 0.65;
128   ai_a = 0.8;
129   (dx,dy)=(0,-0.1);
130   drawnoteshape;
131 fet_endchar;
132
133 fet_beginchar("Quart rehead", "2ro", "rehead")
134   save a_b, noteshape;
135   path noteshape;
136   a_b = 1.54;
137   
138   noteshape = reshape;
139   drawquarternoteshape;
140 fet_endchar;
141   
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
144 % stem attachment: 0
145
146 save meshape; path meshape;
147 meshape = (-1,0)--(0,1)--(1,0)--(0,-1)--cycle;
148
149 fet_beginchar("Whole mehead", "0me", "wholemehead")
150   save a_b, ai_a, bi_b, dx, dy, noteshape, noteishape;
151   path noteshape, noteishape;
152   noteshape = meshape;
153   noteishape = (meshape slanted -0.35) rotated -10.5;
154   a_b = 1.8;
155   bi_b = 0.65;
156   ai_a = 0.7;
157   (dx,dy)=(0,0);
158   drawnoteshape;
159 fet_endchar;
160
161 fet_beginchar("Half mehead", "1me", "halfmehead")
162   save a_b, ai_a, bi_b, dx, dy, noteshape, noteishape;
163   path noteshape, noteishape;
164   noteshape = meshape;
165   noteishape =  (meshape slanted -0.35) rotated -10.5;
166   a_b = 1.5;
167   bi_b = 0.65;
168   ai_a = 0.7;
169   (dx,dy)=(0,0);
170   drawnoteshape;
171 fet_endchar;
172
173 fet_beginchar("Quart mehead", "2me", "mehead")
174   save a_b, noteshape;
175   path noteshape;
176   a_b = 1.54;
177   
178   noteshape = meshape;
179   drawquarternoteshape;
180 fet_endchar;
181
182
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)
188
189 save fashape; path fashape;
190 fashape = (-1,1)--(1,1)--(1,-1)--cycle;
191
192 fet_beginchar("Whole fahead", "0fa", "wholefahead")
193   save a_b, ai_a, bi_b, dx, dy, noteshape, noteishape;
194   path noteshape, noteishape;
195   noteshape = fashape;
196   noteishape = fashape;
197   a_b = 1.8;
198   bi_b = 0.6;
199   ai_a = 0.6;
200   (dx,dy)=(0.2,.05);
201   drawnoteshape;
202 fet_endchar;
203
204 fet_beginchar("Half stemup fahead", "1fau", "halffauhead")
205   save a_b, ai_a, bi_b, dx, dy, noteshape, noteishape;
206   path noteshape, noteishape;
207   noteshape = fashape;
208   noteishape =  fashape;
209   a_b = 1.5;
210   bi_b = 0.6;
211   ai_a = 0.6;
212   (dx,dy)=(0.2,.05);
213   drawnoteshape;
214 fet_endchar;
215
216 fet_beginchar("Quart stemup fahead", "2fau", "fauhead")
217   save a_b, noteshape;
218   path noteshape;
219   a_b = 1.54;
220   
221   noteshape = fashape;
222   drawquarternoteshape;
223 fet_endchar;
224
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;
230   a_b = 1.5;
231   bi_b = 0.6;
232   ai_a = 0.6;
233   (dx,dy)=(-0.2,-.05);
234   drawnoteshape;
235 fet_endchar;
236
237 fet_beginchar("Quart stemdn fahead", "2fad", "fadhead")
238   save a_b, noteshape;
239   path noteshape;
240   a_b = 1.54;
241   
242   noteshape = fashape rotated 180;
243   drawquarternoteshape;
244 fet_endchar;
245
246
247 % sol - oval ... the standard "round" note
248
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;
253
254 fet_beginchar("Whole lahead", "0la", "wholelahead")
255   save a_b, ai_a, bi_b, dx, dy, noteshape, noteishape;
256   path noteshape, noteishape;
257   noteshape = lashape;
258   noteishape = lashape;
259   a_b = 1.8;
260   bi_b = 0.6;
261   ai_a = 0.85;
262   (dx,dy)=(0,0);
263   drawnoteshape;
264 fet_endchar;
265
266 fet_beginchar("Half lahead", "1la", "halflahead")
267   save a_b, ai_a, bi_b, dx, dy, noteshape, noteishape;
268   path noteshape, noteishape;
269   noteshape = lashape;
270   noteishape =  lashape;
271   a_b = 1.5;
272   bi_b = 0.6;
273   ai_a = 0.85;
274   (dx,dy)=(0,0);
275   drawnoteshape;
276 fet_endchar;
277
278 fet_beginchar("Quart lahead", "2la", "lahead")
279   save a_b, noteshape;
280   path noteshape;
281   a_b = 1.54;
282   
283   noteshape = lashape;
284   drawquarternoteshape;
285 fet_endchar;
286
287
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;
294
295 fet_beginchar("Whole tehead", "0te", "wholetehead")
296   save a_b, ai_a, bi_b, dx, dy, noteshape, noteishape;
297   path noteshape, noteishape;
298   noteshape = teshape;
299   noteishape = teshape;
300   a_b = 1.8;
301   bi_b = 0.75;
302   ai_a = 0.75;
303   (dx,dy)=(0,-.02);
304   drawnoteshape;
305 fet_endchar;
306
307 fet_beginchar("Half tehead", "1te", "halftehead")
308   save a_b, ai_a, bi_b, dx, dy, noteshape, noteishape;
309   path noteshape, noteishape;
310   noteshape = teshape;
311   noteishape =  teshape;
312   a_b = 1.5;
313   bi_b = 0.75;
314   ai_a = 0.75;
315   (dx,dy)=(0,-.02);
316   drawnoteshape;
317 fet_endchar;
318
319 fet_beginchar("Quart tehead", "2te", "tehead")
320   save a_b, noteshape;
321   path noteshape;
322   a_b = 1.54;
323   
324   noteshape = teshape;
325   drawquarternoteshape;
326 fet_endchar;
327
328 fet_endgroup("solfa")