]> git.donarmstrong.com Git - lilypond.git/blob - mf/feta-eindelijk.mf
''
[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--2002 Jan Nieuwenhuizen <janneke@gnu.org>
8
9 fet_begingroup("rests");
10
11 begingroup
12
13 thick#:=1/16designsize;
14 define_blacker_pixels(thick);
15
16 rthin:=1/8*staff_space;
17 % rthick:=2rthin;
18 rthick:=2thick+rthin;
19
20 def shift_pic (expr pone, ptwo) =
21   currentpicture:=currentpicture shifted (round(pone),round(ptwo))
22 enddef;
23
24 % stuff for     8th,16th etc rests
25 %
26 save stem, ball_crook_stem, ball_crook_balldiam, flare;
27
28 % stem#:=1/8*staff_space#;
29 stem# = 1/5staff_space#;
30 % flare# = 2/3staff_space#;
31 flare# = 2/3staff_space# - 1/8stafflinethickness#;
32
33 define_pixels(stem,flare);
34
35 ball_crook_stem = stem;
36 ball_crook_balldiam =flare;
37
38
39 save block_rest_y, block_rest_x;
40
41 save breve_rest_y, breve_rest_x;
42
43 breve_rest_y# =  staff_space#;
44 breve_rest_x# = 3/5 staff_space#;
45 block_rest_y# = 5/8 staff_space#;
46 block_rest_x# = 3/2 staff_space#;
47
48 define_pixels(block_rest_y, block_rest_x);
49
50 def block_rest =
51         draw_block ((0,0), (block_rest_x, block_rest_y));
52         enddef;
53
54 fet_beginchar( "whole rest", "0", "wholerest");
55         set_char_box(0, block_rest_x#,
56                 block_rest_y#,  0);
57         block_rest;
58         currentpicture := currentpicture shifted (0,- block_rest_y);
59 fet_endchar;
60
61 fet_beginchar("half rest", "1", "halfrest");
62         set_char_box(0, block_rest_x#, 0, block_rest_y#);
63         block_rest;
64 fet_endchar;
65
66
67 %
68 % should use ledgerline thickness?
69 %
70 fet_beginchar( "whole rest (outside staff)", "0o", "outsidewholerest");
71         set_char_box(0, block_rest_x#,
72                 block_rest_y#, ledgerlinethickness#/2);
73         block_rest;
74         currentpicture := currentpicture shifted (0, - block_rest_y);
75         pickup pencircle scaled ledgerlinethickness;
76
77         y5 = y6 = 0;
78         lft x5 = - b - block_rest_y;
79         rt x6 = w + block_rest_y;
80         draw_gridline(z5,z6,ledgerlinethickness);
81 fet_endchar;
82
83 fet_beginchar("half rest (outside staff)", "1o", "outsidehalfrest");
84         set_char_box(0, block_rest_x#,
85                 ledgerlinethickness#/2, block_rest_y#);
86         block_rest;
87         pickup pencircle scaled ledgerlinethickness;
88         y5 = y6 = 0;
89         lft x5 = - b - block_rest_y ;  
90         rt x6 = w + block_rest_y;
91         draw_gridline (z5,z6,ledgerlinethickness);
92 fet_endchar;
93
94
95
96 define_pixels(breve_rest_y, breve_rest_x, multi_rest_x, multi_beam_height);
97
98
99 fet_beginchar("longa rest", "-2", "longarest");
100        set_char_box(0, breve_rest_x#, breve_rest_y#, breve_rest_y#);
101        draw_block ((0,-floor (breve_rest_y)), (breve_rest_x, floor (breve_rest_y)));
102 fet_endchar;
103
104 fet_beginchar("breve rest", "-1", "breverest");
105        set_char_box(0, breve_rest_x#, 0, breve_rest_y#);
106        draw_block ((0,0), (breve_rest_x, floor (breve_rest_y)));
107 fet_endchar;
108
109 tracingvariables := 1;
110
111 fet_beginchar("Quarter rest","2","quartrest");
112 %       draw_staff (-2, 2, 0.0);        
113         save alpha, yshift, height;
114         alpha:=-50;
115         yshift# = -1.25 staff_space#;
116         height# = 2.8125 staff_space#;
117         define_pixels (yshift, height);
118         save xcenter;
119         xcenter = -0.1 staff_space;
120         
121         set_char_box(0, 0.95 staff_space#,
122           -yshift#,
123           yshift# + height#);
124         
125         save ne,nw,se,sw; pair ne,nw,se,sw;
126         
127         se=dir alpha; nw=dir (alpha+180);
128         ne=dir (alpha+90); sw=dir (alpha-90);
129         penpos1(rthin,alpha+90);
130         penpos2(5/4rthick,alpha);
131         penpos4(5/4rthick,alpha);
132         penpos5(rthin,alpha+90);
133         penpos3(3/4rthick,alpha);
134 %       penpos6(5/8rthick,alpha);
135         penpos6(2/3rthick,alpha);
136         penpos7(1/2rthin,alpha+90);
137
138         z10=z2l+1/2rthin*sw;
139 %       z11=z4l+1/2rthin*sw;
140         z11=z4l+1/2rthin*sw+1/2rthin*se;
141         z12=z4r+1/2rthin*ne;
142 %       z13=z2r+1/2rthin*ne;
143         z13=z2r+1/2rthin*ne+1/2rthin*nw;
144
145         y1r = h;
146         x1l=xcenter +  1/3staff_space;
147         z2r=z1+staff_space*se;
148         z3=1/2[z2,z4];
149         x4= xcenter + 3/8staff_space;
150         y4= 0;
151         z5=z4l+1.3staff_space*se;
152         x6l=x4l;
153         y6l=y4r;
154         x7= xcenter + 2/5staff_space;
155         y7= -d;
156         
157         fill z1l{se}..{se}z10..z3l..z11{se}..{se}z5l..z5r{nw}..{nw}z12..z3r..z13{nw}..{nw}z1r.. cycle;
158         fill z5r{nw}..tension1.4..z6l..tension1.4..{se}z7l..z7r{nw}..tension1.4..z6r..tension1.4..{se}z5l..cycle;
159         penlabels(1,2,3,4,5,6,7);
160         penlabels(10,11,12,13);
161         
162 %         3/4 staff_space# + yshift#,
163 %         18/5staff_space# + yshift#)
164
165         fet_endchar;
166
167 def rest_crook(expr a, w) =
168         balled_crook(a, w, ball_crook_balldiam, ball_crook_stem)
169 enddef;
170
171 %
172 % Notes about 8th rest:  
173
174 % * 8th rest should be no wider than the black note head
175 %
176 % * The inside corner of the horizontal portion is usually a little blotted.
177 %
178 % * The top of the crook chops off the vertical brush
179
180 % * The crook widens a little
181 %
182 % * The bottom of the brush is slightly flat, as it has to align with
183 % stafflines if it is inside the staff.
184 %
185 % * The top of the brush usually is a little lower than the top of bulb.
186 %
187 % * The bulb can vary. Sometimes it is open (like in the clefs). Sometimes 
188 % it is closed, or even a flare.
189
190
191 def normalize (expr p) =
192         (p / length (p))
193 enddef ;
194
195 def draw_eighth_rest =
196         save width, bulb_diam, thin, thick;
197         save ycenter, crook_thick, crook_thin;
198         save crook_dir, lower_brush;
199         pair crook_dir;
200
201
202         width# := 1.0 staff_space#;
203         bulb_diam# := 0.64 staff_space#;
204         thin# := 1.1 stafflinethickness#;
205         thick# :=  2.2 stafflinethickness#;
206         crook_thick# := 1.8 stafflinethickness#;
207         crook_thin := 1.3 stafflinethickness;
208
209         lower_brush = 1.5 stafflinethickness;
210         ycenter := 0.5 staff_space;
211
212         define_pixels (width, bulb_diam, thin, thick, crook_thick);
213         set_char_box (0, width#,
214                 1.0 staff_space# + 0.5 stafflinethickness#, 0.5 staff_space# + bulb_diam#/2);
215
216         penpos1 (thick, 0);
217         penpos2 (thin, 0);
218
219         y1 = ycenter + - 1.5 staff_space ;
220 %       y9 = y5 -  lower_brush;
221         y2 = y5 -  lower_brush;
222        
223         x2r = width;
224
225         y3 - y2l = 0.25 staff_space;
226         x2r - x1 = 0.5 staff_space;
227
228         x3 = x1l ;
229
230
231         x4 = 1.02 bulb_diam ;
232         y4 := ceiling (ycenter - 2 stafflinethickness + crook_thin);
233
234         x5 = 0.5 bulb_diam - 0.25 stafflinethickness;
235         y5 = ycenter +bulb_diam/2;
236         
237         z9 = z2 + 0.46 stafflinethickness * dir (angle(z2 - z1)- 10);
238
239 %       z7 = %(bulb_diam/2,ycenter) + 0.23 staff_space * dir ( 35);
240         z7 = 0.5 [z4, z5] + (0.45 stafflinethickness,0.4 stafflinethickness);
241         z8 = (0, ycenter + 0.5 stafflinethickness);
242
243         z6 = whatever [z1l, z2l];
244         z6 = whatever [z2l, z4] + crook_thick * (crook_dir rotated -90);
245         crook_dir = normalize(z2l - z4);
246
247         y3 := ycenter +floor (- bulb_diam/2);
248
249
250         penlabels (1, 2);
251         labels(3, 4, 5, 6, 7, 8, 9);
252
253         fill z2r -- z2l -- simple_serif (z1l, z1r, 40) -- cycle;
254         fill z2r{z2r-z1r} .. z9 .. z2l{dir(232)} .. tension 2
255                 .. z4{left} .. tension 0.9 .. z7 %{dir(90 + 25)} 
256                 .. z5{left} .. z8 .. z3{right}
257                 .. {curl 0.2}z6 -- cycle;
258
259
260         enddef;
261
262 fet_beginchar("8th rest","3","eighthrest");
263         draw_eighth_rest;
264         fet_endchar;
265
266 fet_beginchar("Classical quarter rest","2classical","clasquartrest");
267         draw_eighth_rest;
268         currentpicture := currentpicture xscaled -1 shifted (w,0);
269         fet_endchar;
270
271
272 fet_beginchar("16th rest","4","sixteenthrest");
273 %       draw_staff (-2, 2, 0.0);
274         save yshift, ballcorrection;
275         ballcorrection = 0.005 staff_space;
276
277         yshift# := - 2 staff_space#;
278         define_pixels(yshift);
279
280         save alpha,cw,h,w, height;
281         alpha=74;
282         cw#=7/6staff_space#;
283         height# =  5/3staff_space#+staff_space#+7/4stafflinethickness#;
284         set_char_box(0, cw#+(height#-3/2staff_space#)/tand(alpha),
285                 -yshift#, height# + yshift#);
286
287         define_pixels(cw);
288         save x,y;
289         x1=w-stem/6;
290         y1 = yshift + 2.5 staff_space + flare/4 + ballcorrection;
291
292         z2-z1=whatever*dir alpha;
293         y2= yshift + stem/2;
294         brush(z1,2/3stem,z2,stem);
295         rest_crook (z1,cw);
296         z3-z1=whatever*dir alpha;
297         y3=y1-staff_space;
298         rest_crook (z3,cw);
299         penlabels(1,2);
300         fet_endchar;
301
302 fet_beginchar("32th rest","5","thirtysecondrest");
303 %       draw_staff (-2, 2, 0.0);
304         save yshift, ballcorrection;
305         ballcorrection = 0.005 staff_space;
306
307         yshift# := -2 staff_space#;
308         define_pixels(yshift);
309
310         save alpha,cw,h;
311         alpha=76;
312         cw#=7/6staff_space#;
313         h#=5/3staff_space#+2staff_space#+7/4stafflinethickness#;
314
315         set_char_box(0, cw#+(h#-3/2staff_space#)/tand(alpha),
316                 -yshift#,yshift# +h#);
317         define_pixels(cw);
318         save x,y;
319         x1=w-stem/6;
320         y1 = yshift + 3.5 staff_space + flare/4 + ballcorrection;
321
322         z2-z1=whatever*dir alpha;
323         y2=stem/2 + yshift;
324         brush(z1,2/3stem,z2,stem);
325         rest_crook (z1,cw);
326         z3-z1=whatever*dir alpha;
327         y3=y1-staff_space;
328         rest_crook (z3,cw);
329         z4-z1=whatever*dir alpha;
330         y4=y1-2staff_space;
331         rest_crook (z4,cw);
332         fet_endchar;
333
334 fet_beginchar("64th rest","6","sixtyfourthrest");
335 %       draw_staff (-2, 2, 0.0);
336         save yshift, ballcorrection;
337         ballcorrection = 0.005 staff_space;
338
339         yshift# := -3 staff_space#;
340         define_pixels(yshift);
341
342         save alpha,cw,h,w;
343         alpha=78;
344         cw#=7/6staff_space#;
345         h#=5/3staff_space#+3staff_space#+7/4stafflinethickness#;
346         w#=cw#+(h#-3/2staff_space#)/tand(alpha);
347         set_char_box(0,w#,-yshift# ,yshift# + h#);
348
349         define_pixels(cw);
350         save x,y;
351         x1=w-stem/6;
352
353         y1 = yshift + 4.5 staff_space + flare/4 + ballcorrection;
354
355         z2-z1=whatever*dir alpha;
356         y2=stem/2 + yshift;
357         brush (z1,2/3stem,z2,stem);
358         rest_crook (z1,cw);
359         z3-z1=whatever*dir alpha;
360         y3=y1-staff_space;
361         rest_crook (z3,cw);
362         z4-z1=whatever*dir alpha;
363         y4=y1-2staff_space;
364         rest_crook (z4,cw);
365         z5-z1=whatever*dir alpha;
366         y5=y1-3staff_space;
367         rest_crook (z5,cw);
368
369         fet_endchar;
370
371 fet_beginchar("128th rest","7","hundredtwentyeighthrest"); 
372 %       draw_staff (-2, 2, 0.0);
373         save yshift, ballcorrection;
374         ballcorrection = 0.005 staff_space;
375
376         yshift# := -3 staff_space#;
377         define_pixels(yshift);
378         save alpha,cw,h,w;
379         alpha=78;
380         cw#=7/6staff_space#;
381         h#=5/3staff_space#+4staff_space#+7/4stafflinethickness#;
382         w#=cw#+(h#-3/2staff_space#)/tand(alpha);
383         set_char_box(0,w#, -yshift#,yshift#  + h#);
384         define_pixels(cw);
385         save x,y;
386         x1=w-stem/6;
387         y1 = yshift + 5.5 staff_space + flare/4 + ballcorrection;
388
389         z2-z1=whatever*dir alpha;
390         y2=stem/2 + yshift;
391         brush (z1,2/3stem,z2,stem);
392         rest_crook (z1,cw);
393         z3-z1=whatever*dir alpha;
394         y3=y1-staff_space;
395         rest_crook (z3,cw);
396         z4-z1=whatever*dir alpha;
397         y4=y1-2staff_space;
398         rest_crook (z4,cw);
399         z5-z1=whatever*dir alpha;
400         y5=y1-3staff_space;
401         rest_crook (z5,cw);
402         z6-z1=whatever*dir alpha;
403         y6=y1-4staff_space;
404         rest_crook (z6,cw);
405         
406         fet_endchar;
407
408
409 endgroup;
410
411
412 %%%%%%%%
413 %
414 %
415 %
416 % MENSURAL NOTATION
417 %
418 %
419 %
420
421 % Neo-mensural longa and breve are identical with default longa and breve.
422
423 neomens_block_rest_x# = 2/5 staff_space#;
424 neomens_block_rest_y# = 1/1 staff_space#;
425 neomens_half_block_rest_y# = 5/8 staff_space#;
426
427 define_pixels(neomens_block_rest_x,
428               neomens_block_rest_y, neomens_half_block_rest_y);
429
430 def neomens_half_block_rest =
431         draw_block ((0,0), (neomens_block_rest_x, neomens_half_block_rest_y));
432         enddef;
433
434 fet_beginchar("Neo-mensural maxima rest", "-3neo_mensural", "neomensmaximarest");
435        set_char_box(0, neomens_block_rest_x#,
436                     neomens_block_rest_y#, 2 neomens_block_rest_y#);
437        draw_block ((0,-neomens_block_rest_y),
438                    (neomens_block_rest_x, 2 neomens_block_rest_y));
439 fet_endchar;
440
441 fet_beginchar("Neo-mensural longa rest", "-2neo_mensural", "neomenslongarest");
442        set_char_box(0, neomens_block_rest_x#,
443                     neomens_block_rest_y#, neomens_block_rest_y#);
444        draw_block ((0,-neomens_block_rest_y),
445                    (neomens_block_rest_x, neomens_block_rest_y));
446 fet_endchar;
447
448 fet_beginchar("Neo-mensural breve rest", "-1neo_mensural", "neomensbreverest");
449        set_char_box(0, neomens_block_rest_x#,
450                     0, neomens_block_rest_y#);
451        draw_block ((0,0), (neomens_block_rest_x, neomens_block_rest_y));
452 fet_endchar;
453
454 fet_beginchar("Neo-mensural whole rest", "0neo_mensural", "neomenssemibrevisrest");
455         set_char_box(0, neomens_block_rest_x#,
456                      neomens_half_block_rest_y#,  0);
457         neomens_half_block_rest;
458         currentpicture :=
459                 currentpicture shifted (0,- neomens_half_block_rest_y);
460 fet_endchar;
461
462 fet_beginchar("Neo-mensural half rest", "1neo_mensural", "neomensminimahalfrest");
463         set_char_box(0, neomens_block_rest_x#,
464                      0, neomens_half_block_rest_y#);
465         neomens_half_block_rest;
466 fet_endchar;
467
468 neomensrestsize# = .8staff_space#;
469
470 fet_beginchar("Neo-mensural 4th rest","2neo_mensural","neomenssemiminimarest")
471         set_char_box(0,neomensrestsize#,0,neomensrestsize#);
472         pickup pencircle scaled 2 stafflinethickness;
473         lft x1 = 0;
474         bot y1 = 0;
475         lft x2 = 0;
476         top y2 = h;
477         rt x3 = w;
478         bot y3 = h/2;
479         draw z1 .. z2;
480         draw z2 .. z3;
481 fet_endchar
482
483 fet_beginchar("Neo-mensural 8th rest","3neo_mensural","neomensfusarest")
484         set_char_box(0,neomensrestsize#,0,neomensrestsize#);
485         pickup pencircle scaled 2 stafflinethickness;
486         rt x1 = w;
487         bot y1 = 0;
488         rt x2 = w;
489         top y2 = h;
490         lft x3 = 0;
491         bot y3 = h/2;
492         draw z1 .. z2;
493         draw z2 .. z3;
494 fet_endchar
495
496 fet_beginchar("Neo-mensural 16th rest","4neo_mensural","neomenssemifusarest")
497         set_char_box(0,neomensrestsize#,0,staff_space#);
498         pickup pencircle scaled 2 stafflinethickness;
499         rt x1 = w;
500         bot y1 = 0;
501         rt x2 = w;
502         top y2 = h;
503
504         draw z1 .. z2;
505
506         pickup pencircle scaled 2 stafflinethickness;
507         rt x3 = w;
508         top y3 = h;
509         lft x4 = 0;
510         bot y4 = h/2;
511         rt x5 = w;
512         top y5 = 5/8h;
513         lft x6 = 0;
514         bot y6 = h/8;
515
516         draw z3 .. z4;
517         draw z5 .. z6;
518 fet_endchar
519
520
521 fet_endgroup("rests")