]> git.donarmstrong.com Git - lilypond.git/blob - mf/feta-eindelijk.mf
* input/mutopia/F.Schubert/GNUmakefile: add morgenlied.ly
[lilypond.git] / mf / feta-eindelijk.mf
1 % feta-eindelijk.mf -- implement rest symbols -*-Fundamental-*-
2 %
3 % part of LilyPond's pretty-but-neat music font
4 %
5 % source file of the Feta (not the Font-En-Tja) music font
6
7 % (c)  1997--2003 Jan Nieuwenhuizen <janneke@gnu.org>
8
9 fet_begingroup("rests");
10
11 begingroup
12
13
14 save block_rest_y, block_rest_x;
15 save breve_rest_y, breve_rest_x;
16
17 breve_rest_y# =  staff_space#;
18 breve_rest_x# = 3/5 staff_space#;
19 block_rest_y# = 5/8 staff_space#;
20 block_rest_x# = 3/2 staff_space#;
21
22 define_pixels(block_rest_y, block_rest_x);
23
24 def block_rest =
25         draw_block ((0,0), (block_rest_x, block_rest_y));
26         enddef;
27
28 fet_beginchar( "whole rest", "0", "wholerest");
29         set_char_box(0, block_rest_x#,
30                 block_rest_y#,  0);
31         block_rest;
32         currentpicture := currentpicture shifted (0,- block_rest_y);
33 fet_endchar;
34
35 fet_beginchar("half rest", "1", "halfrest");
36         set_char_box(0, block_rest_x#, 0, block_rest_y#);
37         block_rest;
38 fet_endchar;
39
40
41 %
42 % should use ledgerline thickness?
43 %
44 fet_beginchar( "whole rest (outside staff)", "0o", "outsidewholerest");
45         set_char_box(0, block_rest_x#,
46                 block_rest_y#, ledgerlinethickness#/2);
47         block_rest;
48         currentpicture := currentpicture shifted (0, - block_rest_y);
49         pickup pencircle scaled ledgerlinethickness;
50
51         y5 = y6 = 0;
52         lft x5 = - b - block_rest_y;
53         rt x6 = w + block_rest_y;
54         draw_gridline(z5,z6,ledgerlinethickness);
55 fet_endchar;
56
57 fet_beginchar("half rest (outside staff)", "1o", "outsidehalfrest");
58         set_char_box(0, block_rest_x#,
59                 ledgerlinethickness#/2, block_rest_y#);
60         block_rest;
61         pickup pencircle scaled ledgerlinethickness;
62         y5 = y6 = 0;
63         lft x5 = - b - block_rest_y ;  
64         rt x6 = w + block_rest_y;
65         draw_gridline (z5,z6,ledgerlinethickness);
66 fet_endchar;
67
68
69
70 define_pixels(breve_rest_y, breve_rest_x, multi_rest_x, multi_beam_height);
71
72 fet_beginchar("maxima rest", "-3", "maximarest");
73         set_char_box(0, 3 breve_rest_x#, breve_rest_y#, breve_rest_y#);
74         draw_block ((0,-floor (breve_rest_y)), (breve_rest_x, floor (breve_rest_y)));
75         addto currentpicture also currentpicture shifted (2 breve_rest_x, 0);
76 fet_endchar;
77
78 fet_beginchar("longa rest", "-2", "longarest");
79         set_char_box(0, breve_rest_x#, breve_rest_y#, breve_rest_y#);
80         draw_block ((0,-floor (breve_rest_y)), (breve_rest_x, floor (breve_rest_y)));
81 fet_endchar;
82
83 fet_beginchar("breve rest", "-1", "breverest");
84         set_char_box(0, breve_rest_x#, 0, breve_rest_y#);
85         draw_block ((0,0), (breve_rest_x, floor (breve_rest_y)));
86 fet_endchar;
87
88
89 tracingvariables := 1;
90
91 fet_beginchar("Quarter rest","2","quartrest");
92 %       draw_staff (-2, 2, 0.0);        
93         save alpha, yshift, height;
94         alpha:=-50;
95
96
97         thick# := 1/4 staff_space#;
98         define_blacker_pixels(thick);
99
100         rthin := 1.25 stafflinethickness;
101         rthick := 2 thick+rthin;
102
103
104
105         yshift# = -1.25 staff_space#;
106         height# = 2.8125 staff_space#;
107
108         define_pixels (yshift, height);
109         save xcenter;
110         xcenter = -0.1 staff_space;
111         
112         set_char_box(0, 0.95 staff_space#,
113           -yshift#,
114           yshift# + height#);
115         
116         save ne,nw, se, sw; pair ne, nw, se, sw;
117         
118         se=dir alpha; nw=dir (alpha+180);
119         ne=dir (alpha+90); sw=dir (alpha-90);
120         penpos1(rthin, alpha+90);
121         penpos2(5/4rthick, alpha);
122         penpos4(5/4rthick, alpha);
123         penpos5(rthin, alpha+90);
124         penpos3(3/4rthick, alpha);
125 %       penpos6(5/8rthick, alpha);
126         penpos6(2/3rthick,  alpha);
127         penpos7(1/2rthin,  alpha+90);
128
129         z10=z2l+1/2rthin*sw;
130 %       z11=z4l+1/2rthin*sw;
131         z11=z4l+1/2rthin*sw+1/2rthin*se;
132         z12=z4r+1/2rthin*ne;
133 %       z13=z2r+1/2rthin*ne;
134         z13=z2r+1/2rthin*ne+1/2rthin*nw;
135
136         y1r = h;
137         x1l=xcenter +  1/3staff_space;
138         z2r=z1+staff_space*se;
139         z3=1/2[z2, z4];
140         x4= xcenter + 3/8staff_space;
141         y4= 0;
142         z5=z4l+1.3staff_space*se;
143         x6l=x4l;
144         y6l=y4r;
145         x7= xcenter + 2/5staff_space;
146         y7= -d;
147         
148         fill z1l{se}..{se}z10..z3l..z11{se}..{se}z5l..z5r{nw}..{nw}z12..z3r..z13{nw}..{nw}z1r.. cycle;
149         fill z5r{nw}..tension1.4..z6l..tension1.4..{se}z7l..z7r{nw}..tension1.4..z6r..tension1.4..{se}z5l..cycle;
150         penlabels(1, 2, 3, 4, 5, 6, 7);
151         penlabels(10, 11, 12, 13);
152         
153 fet_endchar;
154
155 def rest_crook(expr a, w) =
156         balled_crook(a, w, ball_crook_balldiam, ball_crook_stem)
157 enddef;
158
159 %
160 % Notes about 8th rest:  
161
162 % * 8th rest should be no wider than the black note head
163 %
164 % * The inside corner of the horizontal portion is usually a little blotted.
165 %
166 % * The top of the crook chops off the vertical brush
167
168 % * The crook widens a little
169 %
170 % * The bottom of the brush is slightly flat, as it has to align with
171 % stafflines if it is inside the staff.
172 %
173 % * The top of the brush usually is a little lower than the top of bulb.
174 %
175 % * The bulb can vary. Sometimes it is open (like in the clefs). Sometimes 
176 % it is closed, or even a flare.
177
178
179 % from an email to Rune Zedeler:
180 %
181
182 % For example, the 8th rest was vaguely based on a book with trumpet
183 % studies by Duhem, and by Baerenreiters cello suites. I included my
184 % findings in a comment in the mf file.  One of the things that I tried
185 % to do was make the rest a little lighter and narrower than the black
186 % note head. I think this looks better in polyphonic music, when the
187 % rest is below a head from a different voice.
188 %
189 %
190
191 save bulb_diam, thin, thick;
192
193 bulb_diam# := 0.64 staff_space#;
194 thin# := 1.2 stafflinethickness#;
195 thick# :=  2.2 stafflinethickness#;
196 crook_thin := 0.5 stafflinethickness  + 0.08 staff_space;
197
198 lower_brush := 1.5 stafflinethickness;
199
200 define_pixels ( bulb_diam, thin, thick);
201
202 def draw_rest_bulb(expr ycenter, ycut, pat, stretch) =
203 begingroup;
204         save x,y,pt;
205         z1l = point 0 of pat;
206         z2l = point 1 of pat;
207         z2r = point 3 of pat;
208         z1r = point 4 of pat;
209         z1 = 0.5[z1l,z1r];
210         z2 = 0.5[z2l,z2r];
211         y10 = ycenter;
212         z10 = whatever[z2, z1] + left*bulb_diam*stretch;
213
214
215         z3 = z10+bulb_diam/2.15*dir(-72) ;
216         z5 = z10 + up*bulb_diam/2 + right*stafflinethickness/3;
217         
218         z7 = 0.5 [z4, z5] +  crook_thin * (0.45 ,0.4 ) / 1.3;
219         x8 = x10-0.4bulb_diam;
220         y8 = y10 + 0.25 stafflinethickness;
221
222         z6 = whatever [z1l, z2l];
223         z6 = z3 + whatever * dir(12);
224
225         z4 = z3 + whatever * (z6-z3)
226                 + 1.1 crook_thin *(unitvector (z6 -z3) rotated 90);
227         x4 = x10+bulb_diam*.62 ;
228         y4 := ceiling (y4);
229
230         (pt,whatever) = pat intersectiontimes ((0,ycut)--(w,ycut));
231
232         fill point pt of pat {-direction pt of pat} .. tension 2
233                 .. z4{left} .. tension 0.9 .. z7
234                 .. z5{left} .. z8 .. z3{right}
235                 .. {curl 0.2} z6 {right} .. tension 10 .. {left} point pt of pat -- cycle;
236
237         labels(3, 4, 5, 6, 7, 8, 9, 10, 11);
238
239 endgroup;
240 enddef;
241
242 def draw_eighth_rest =
243         save width;
244         save ycenter;
245         save crook_dir, pat;
246         pair crook_dir;
247         path pat;
248
249         width# := 1.0 staff_space#;
250
251         define_pixels (width);
252         set_char_box (0, width#,
253                 1.0 staff_space# + 0.5 stafflinethickness#, 0.5 staff_space# + bulb_diam#/2);
254
255         penpos1 (thick, 0);
256         penpos2 (thin, 10);
257
258         y1 = - staff_space ;
259         y2 = h -  lower_brush;
260         x2r = width;
261         z2 = z1 + whatever*dir(72);
262         z9 = z2 + 0.5 stafflinethickness * dir (angle(z2 - z1)- 10);
263         pat = z1l --- z2l .. z9 .. z2r --- simple_serif (z1r, z1l, -40) .. cycle;
264         fill pat;
265         
266
267         draw_rest_bulb(0.5 staff_space , y2r , pat , 1.0);
268         penlabels (1, 2);
269         labels(9);
270
271         % draw_staff (-2,2,0.0);
272
273         enddef;
274
275 fet_beginchar("Classical quarter rest","2classical","clasquartrest");
276         draw_eighth_rest;
277         currentpicture := currentpicture xscaled -1 shifted (w,0);
278         fet_endchar;
279
280 fet_beginchar("8th rest","3","eighthrest");
281         draw_eighth_rest;
282         fet_endchar;
283
284
285 %
286 % TODO: the X dimensions of the rests are fucked up:
287 % they can collide with augmentation dots. 
288 %
289
290 fet_beginchar("16th rest","4","sixteenthrest");
291         save width;
292         save ycenter;
293         save crook_dir, pat;
294         pair crook_dir;
295         path pat;
296
297         width# := 1.2 staff_space#;
298
299         define_pixels (width);
300         set_char_box (0, width#,
301                 2.0 staff_space# + 0.5 stafflinethickness#, 0.5 staff_space# + bulb_diam#/2);
302
303         penpos1 (thick, 0);
304         penpos2 (thin, 10);
305
306         y1 = -2 staff_space ;
307         y2 = h -  lower_brush;
308         x2r = width;
309         z2 = z1 + whatever*dir(74);
310         z9 = z2 + 0.5 stafflinethickness * dir (angle(z2 - z1)- 10);
311         pat = z1l --- z2l .. z9 .. z2r --- simple_serif (z1r, z1l, -40) .. cycle;
312         fill pat;
313         
314
315         draw_rest_bulb(0.5 staff_space , y2r , pat , 0.98);
316         draw_rest_bulb(-0.5 staff_space , (-0.5+0.2)*staff_space , pat , 1.02);
317         penlabels (1, 2);
318         labels(9);
319
320         % draw_staff (-2,2,0.0);
321         fet_endchar;
322
323 fet_beginchar("32th rest","5","thirtysecondrest");
324         save width;
325         save ycenter;
326         save crook_dir, pat;
327         pair crook_dir;
328         path pat;
329
330         width# := 1.3 staff_space#;
331
332         define_pixels (width);
333         set_char_box (0, width#,
334                 2.0 staff_space# + 0.5 stafflinethickness#, 1.5 staff_space# + bulb_diam#/2);
335
336         penpos1 (thick, 0);
337         penpos2 (thin, 10);
338
339         y1 = -2 staff_space ;
340         y2 = h -  lower_brush;
341         x2r = width;
342         z2 = z1 + whatever*dir(76);
343         z9 = z2 + 0.5 stafflinethickness * dir (angle(z2 - z1)- 10);
344         pat = z1l --- z2l .. z9 .. z2r --- simple_serif (z1r, z1l, -40) .. cycle;
345         fill pat;
346         
347
348         draw_rest_bulb(1.5 staff_space , y2r , pat , 0.96);
349         draw_rest_bulb(0.5 staff_space , (0.5+0.2)*staff_space , pat , 1.00);
350         draw_rest_bulb(-0.5 staff_space , (-0.5+0.21)*staff_space , pat , 1.04);
351         penlabels (1, 2);
352         labels(9);
353
354         % draw_staff (-2,2,0.0);
355         fet_endchar;
356
357 fet_beginchar("64th rest","6","sixtyfourthrest");
358         save width;
359         save ycenter;
360         save crook_dir, pat;
361         pair crook_dir;
362         path pat;
363
364         width# := 1.4 staff_space#;
365
366         define_pixels (width);
367         set_char_box (0, width#,
368                 3.0 staff_space# + 0.5 stafflinethickness#, 1.5 staff_space# + bulb_diam#/2);
369
370         penpos1 (thick, 0);
371         penpos2 (thin, 10);
372
373         y1 = -3 staff_space ;
374         y2 = h -  lower_brush;
375         x2r = width;
376         z2 = z1 + whatever*dir(78);
377         z9 = z2 + 0.5 stafflinethickness * dir (angle(z2 - z1)- 10);
378         pat = z1l --- z2l .. z9 .. z2r --- simple_serif (z1r, z1l, -40) .. cycle;
379         fill pat;
380         
381
382         draw_rest_bulb(1.5 staff_space , y2r , pat , 0.94);
383         draw_rest_bulb(0.5 staff_space , (0.5+0.20)*staff_space , pat , 0.98);
384         draw_rest_bulb(-0.5 staff_space , (-0.5+0.21)*staff_space , pat , 1.02);
385         draw_rest_bulb(-1.5 staff_space , (-1.5+0.22)*staff_space , pat , 1.06);
386         penlabels (1, 2);
387         labels(9);
388
389         % draw_staff (-2,2,0.0);
390         fet_endchar;
391
392 fet_beginchar("128th rest","7","hundredtwentyeighthrest");
393         save width;
394         save ycenter;
395         save crook_dir, pat;
396         pair crook_dir;
397         path pat;
398
399         width# = 1.5 staff_space#;
400
401         define_pixels (width);
402         set_char_box (0, width#,
403                 3.0 staff_space# + 0.5 stafflinethickness#, 2.5 staff_space# + bulb_diam#/2);
404
405         penpos1 (thick, 0);
406         penpos2 (thin, 10);
407
408         y1 = -3 staff_space ;
409         y2 = h -  lower_brush;
410         x2r = width;
411         z2 = z1 + whatever*dir(80);
412         z9 = z2 + 0.5 stafflinethickness * dir (angle(z2 - z1)- 10);
413         pat = z1l --- z2l .. z9 .. z2r --- simple_serif (z1r, z1l, -40) .. cycle;
414         fill pat;
415         
416
417         draw_rest_bulb(2.5 staff_space , y2r , pat , 0.92);
418         draw_rest_bulb(1.5 staff_space , (1.5+0.20)*staff_space , pat , 0.96);
419         draw_rest_bulb(0.5 staff_space , (0.5+0.21)*staff_space , pat , 1.0);
420         draw_rest_bulb(-0.5 staff_space , (-0.5+0.22)*staff_space , pat , 1.04);
421         draw_rest_bulb(-1.5 staff_space , (-1.5+0.23)*staff_space , pat , 1.08);
422         penlabels (1, 2);
423         labels(9);
424
425         % draw_staff (-2,2,0.0);
426         fet_endchar;
427
428
429 endgroup;
430
431 fet_endgroup("rests")