]> 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
226         x2r - x1 = 0.5 staff_space;
227
228         x3 = x1l - 0.045 staff_space ;
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         x8 = 0;
242         y8 = ycenter + 0.25 stafflinethickness;
243
244         z6 = whatever [z1l, z2l];
245         z6 = whatever [z2l, z4] + crook_thick * (crook_dir rotated -90);
246         crook_dir = normalize(z2l - z4);
247
248         y3 := ycenter +floor (- 0.45 bulb_diam);
249
250
251         penlabels (1, 2);
252         labels(3, 4, 5, 6, 7, 8, 9);
253
254         fill z2r -- z2l -- simple_serif (z1l, z1r, 40) -- cycle;
255         fill z2r{z2r-z1r} .. z9 .. z2l{dir(232)} .. tension 2
256                 .. z4{left} .. tension 0.9 .. z7 %{dir(90 + 25)} 
257                 .. z5{left} .. z8 .. z3{right}
258                 .. {curl 0.2}z6 -- cycle;
259
260 %       draw_staff (-2,2,0.0);
261
262         enddef;
263
264 fet_beginchar("8th rest","3","eighthrest");
265         draw_eighth_rest;
266         fet_endchar;
267
268 fet_beginchar("Classical quarter rest","2classical","clasquartrest");
269         draw_eighth_rest;
270         currentpicture := currentpicture xscaled -1 shifted (w,0);
271         fet_endchar;
272
273
274 fet_beginchar("16th rest","4","sixteenthrest");
275 %       draw_staff (-2, 2, 0.0);
276         save yshift, ballcorrection;
277         ballcorrection = 0.005 staff_space;
278
279         yshift# := - 2 staff_space#;
280         define_pixels(yshift);
281
282         save alpha,cw,h,w, height;
283         alpha=74;
284         cw#=7/6staff_space#;
285         height# =  5/3staff_space#+staff_space#+7/4stafflinethickness#;
286         set_char_box(0, cw#+(height#-3/2staff_space#)/tand(alpha),
287                 -yshift#, height# + yshift#);
288
289         define_pixels(cw);
290         save x,y;
291         x1=w-stem/6;
292         y1 = yshift + 2.5 staff_space + flare/4 + ballcorrection;
293
294         z2-z1=whatever*dir alpha;
295         y2= yshift + stem/2;
296         brush(z1,2/3stem,z2,stem);
297         rest_crook (z1,cw);
298         z3-z1=whatever*dir alpha;
299         y3=y1-staff_space;
300         rest_crook (z3,cw);
301         penlabels(1,2);
302         fet_endchar;
303
304 fet_beginchar("32th rest","5","thirtysecondrest");
305 %       draw_staff (-2, 2, 0.0);
306         save yshift, ballcorrection;
307         ballcorrection = 0.005 staff_space;
308
309         yshift# := -2 staff_space#;
310         define_pixels(yshift);
311
312         save alpha,cw,h;
313         alpha=76;
314         cw#=7/6staff_space#;
315         h#=5/3staff_space#+2staff_space#+7/4stafflinethickness#;
316
317         set_char_box(0, cw#+(h#-3/2staff_space#)/tand(alpha),
318                 -yshift#,yshift# +h#);
319         define_pixels(cw);
320         save x,y;
321         x1=w-stem/6;
322         y1 = yshift + 3.5 staff_space + flare/4 + ballcorrection;
323
324         z2-z1=whatever*dir alpha;
325         y2=stem/2 + yshift;
326         brush(z1,2/3stem,z2,stem);
327         rest_crook (z1,cw);
328         z3-z1=whatever*dir alpha;
329         y3=y1-staff_space;
330         rest_crook (z3,cw);
331         z4-z1=whatever*dir alpha;
332         y4=y1-2staff_space;
333         rest_crook (z4,cw);
334         fet_endchar;
335
336 fet_beginchar("64th rest","6","sixtyfourthrest");
337 %       draw_staff (-2, 2, 0.0);
338         save yshift, ballcorrection;
339         ballcorrection = 0.005 staff_space;
340
341         yshift# := -3 staff_space#;
342         define_pixels(yshift);
343
344         save alpha,cw,h,w;
345         alpha=78;
346         cw#=7/6staff_space#;
347         h#=5/3staff_space#+3staff_space#+7/4stafflinethickness#;
348         w#=cw#+(h#-3/2staff_space#)/tand(alpha);
349         set_char_box(0,w#,-yshift# ,yshift# + h#);
350
351         define_pixels(cw);
352         save x,y;
353         x1=w-stem/6;
354
355         y1 = yshift + 4.5 staff_space + flare/4 + ballcorrection;
356
357         z2-z1=whatever*dir alpha;
358         y2=stem/2 + yshift;
359         brush (z1,2/3stem,z2,stem);
360         rest_crook (z1,cw);
361         z3-z1=whatever*dir alpha;
362         y3=y1-staff_space;
363         rest_crook (z3,cw);
364         z4-z1=whatever*dir alpha;
365         y4=y1-2staff_space;
366         rest_crook (z4,cw);
367         z5-z1=whatever*dir alpha;
368         y5=y1-3staff_space;
369         rest_crook (z5,cw);
370
371         fet_endchar;
372
373 fet_beginchar("128th rest","7","hundredtwentyeighthrest"); 
374 %       draw_staff (-2, 2, 0.0);
375         save yshift, ballcorrection;
376         ballcorrection = 0.005 staff_space;
377
378         yshift# := -3 staff_space#;
379         define_pixels(yshift);
380         save alpha,cw,h,w;
381         alpha=78;
382         cw#=7/6staff_space#;
383         h#=5/3staff_space#+4staff_space#+7/4stafflinethickness#;
384         w#=cw#+(h#-3/2staff_space#)/tand(alpha);
385         set_char_box(0,w#, -yshift#,yshift#  + h#);
386         define_pixels(cw);
387         save x,y;
388         x1=w-stem/6;
389         y1 = yshift + 5.5 staff_space + flare/4 + ballcorrection;
390
391         z2-z1=whatever*dir alpha;
392         y2=stem/2 + yshift;
393         brush (z1,2/3stem,z2,stem);
394         rest_crook (z1,cw);
395         z3-z1=whatever*dir alpha;
396         y3=y1-staff_space;
397         rest_crook (z3,cw);
398         z4-z1=whatever*dir alpha;
399         y4=y1-2staff_space;
400         rest_crook (z4,cw);
401         z5-z1=whatever*dir alpha;
402         y5=y1-3staff_space;
403         rest_crook (z5,cw);
404         z6-z1=whatever*dir alpha;
405         y6=y1-4staff_space;
406         rest_crook (z6,cw);
407         
408         fet_endchar;
409
410
411 endgroup;
412
413
414 %%%%%%%%
415 %
416 %
417 %
418 % MENSURAL NOTATION
419 %
420 %
421 %
422
423 % Neo-mensural longa and breve are identical with default longa and breve.
424
425 neomens_block_rest_x# = 2/5 staff_space#;
426 neomens_block_rest_y# = 1/1 staff_space#;
427 neomens_half_block_rest_y# = 5/8 staff_space#;
428
429 define_pixels(neomens_block_rest_x,
430               neomens_block_rest_y, neomens_half_block_rest_y);
431
432 def neomens_half_block_rest =
433         draw_block ((0,0), (neomens_block_rest_x, neomens_half_block_rest_y));
434         enddef;
435
436 fet_beginchar("Neo-mensural maxima rest", "-3neo_mensural", "neomensmaximarest");
437        set_char_box(0, neomens_block_rest_x#,
438                     neomens_block_rest_y#, 2 neomens_block_rest_y#);
439        draw_block ((0,-neomens_block_rest_y),
440                    (neomens_block_rest_x, 2 neomens_block_rest_y));
441 fet_endchar;
442
443 fet_beginchar("Neo-mensural longa rest", "-2neo_mensural", "neomenslongarest");
444        set_char_box(0, neomens_block_rest_x#,
445                     neomens_block_rest_y#, neomens_block_rest_y#);
446        draw_block ((0,-neomens_block_rest_y),
447                    (neomens_block_rest_x, neomens_block_rest_y));
448 fet_endchar;
449
450 fet_beginchar("Neo-mensural breve rest", "-1neo_mensural", "neomensbreverest");
451        set_char_box(0, neomens_block_rest_x#,
452                     0, neomens_block_rest_y#);
453        draw_block ((0,0), (neomens_block_rest_x, neomens_block_rest_y));
454 fet_endchar;
455
456 fet_beginchar("Neo-mensural whole rest", "0neo_mensural", "neomenssemibrevisrest");
457         set_char_box(0, neomens_block_rest_x#,
458                      neomens_half_block_rest_y#,  0);
459         neomens_half_block_rest;
460         currentpicture :=
461                 currentpicture shifted (0,- neomens_half_block_rest_y);
462 fet_endchar;
463
464 fet_beginchar("Neo-mensural half rest", "1neo_mensural", "neomensminimahalfrest");
465         set_char_box(0, neomens_block_rest_x#,
466                      0, neomens_half_block_rest_y#);
467         neomens_half_block_rest;
468 fet_endchar;
469
470 neomensrestsize# = .8staff_space#;
471
472 fet_beginchar("Neo-mensural 4th rest","2neo_mensural","neomenssemiminimarest")
473         set_char_box(0,neomensrestsize#,0,neomensrestsize#);
474         pickup pencircle scaled 2 stafflinethickness;
475         lft x1 = 0;
476         bot y1 = 0;
477         lft x2 = 0;
478         top y2 = h;
479         rt x3 = w;
480         bot y3 = h/2;
481         draw z1 .. z2;
482         draw z2 .. z3;
483 fet_endchar
484
485 fet_beginchar("Neo-mensural 8th rest","3neo_mensural","neomensfusarest")
486         set_char_box(0,neomensrestsize#,0,neomensrestsize#);
487         pickup pencircle scaled 2 stafflinethickness;
488         rt x1 = w;
489         bot y1 = 0;
490         rt x2 = w;
491         top y2 = h;
492         lft x3 = 0;
493         bot y3 = h/2;
494         draw z1 .. z2;
495         draw z2 .. z3;
496 fet_endchar
497
498 fet_beginchar("Neo-mensural 16th rest","4neo_mensural","neomenssemifusarest")
499         set_char_box(0,neomensrestsize#,0,staff_space#);
500         pickup pencircle scaled 2 stafflinethickness;
501         rt x1 = w;
502         bot y1 = 0;
503         rt x2 = w;
504         top y2 = h;
505
506         draw z1 .. z2;
507
508         pickup pencircle scaled 2 stafflinethickness;
509         rt x3 = w;
510         top y3 = h;
511         lft x4 = 0;
512         bot y4 = h/2;
513         rt x5 = w;
514         top y5 = 5/8h;
515         lft x6 = 0;
516         bot y6 = h/8;
517
518         draw z3 .. z4;
519         draw z5 .. z6;
520 fet_endchar
521
522
523 fet_endgroup("rests")