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