]> git.donarmstrong.com Git - lilypond.git/blob - mf/feta-eindelijk.mf
4549a17f35a2f18e5be2beca7553b8142042829c
[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 % from an email to Rune Zedeler:
192 %
193
194 % For example, the 8th rest was vaguely based on a book with trumpet
195 % studies by Duhem, and by Baerenreiters cello suites. I included my
196 % findings in a comment in the mf file.  One of the things that I tried
197 % to do was make the rest a little lighter and narrower than the black
198 % note head. I think this looks better in polyphonic music, when the
199 % rest is below a head from a different voice.
200 %
201 %
202
203
204 def draw_rest_bulb(expr ycenter, ycut, pat, stretch) =
205 begingroup;
206         save x,y,pt;
207         z1l = point 0 of pat;
208         z2l = point 1 of pat;
209         z2r = point 3 of pat;
210         z1r = point 4 of pat;
211         z1 = 0.5[z1l,z1r];
212         z2 = 0.5[z2l,z2r];
213         y10 = ycenter;
214         z10 = whatever[z2, z1] + left*bulb_diam*stretch;
215
216
217         z3 = z10+bulb_diam/2.15*dir(-72) ;
218
219
220         x4 = x10+bulb_diam*.62 ;
221         y4 := ceiling (y10 - 2 stafflinethickness + crook_thin);
222
223         z5 = z10 + up*bulb_diam/2 + right*stafflinethickness/3;
224         
225
226         z7 = 0.5 [z4, z5] + (0.45 stafflinethickness,0.4 stafflinethickness);
227         x8 = x10-0.4bulb_diam;
228         y8 = y10 + 0.25 stafflinethickness;
229
230         z6 = whatever [z1l, z2l];
231         z6 = z3+whatever * dir(12);
232
233         (pt,whatever) = pat intersectiontimes ((0,ycut)--(w,ycut));
234
235         fill point pt of pat {-direction pt of pat} .. tension 2
236                 .. z4{left} .. tension 0.9 .. z7
237                 .. z5{left} .. z8 .. z3{right}
238                 .. {curl 0.2} z6 {right} .. tension 10 .. {left} point pt of pat -- cycle;
239
240         labels(3, 4, 5, 6, 7, 8, 9, 10);
241
242 endgroup;
243 enddef;
244
245 def draw_eighth_rest =
246         save width, bulb_diam, thin, thick;
247         save ycenter, crook_thick, crook_thin;
248         save crook_dir, lower_brush, pat;
249         pair crook_dir;
250         path pat;
251
252         width# := 1.0 staff_space#;
253         bulb_diam# := 0.64 staff_space#;
254         thin# := 1.2 stafflinethickness#;
255         thick# :=  2.2 stafflinethickness#;
256         crook_thick# := 1.8 stafflinethickness#;
257         crook_thin := 1.3 stafflinethickness;
258
259         lower_brush := 1.5 stafflinethickness;
260
261         define_pixels (width, bulb_diam, thin, thick, crook_thick);
262         set_char_box (0, width#,
263                 1.0 staff_space# + 0.5 stafflinethickness#, 0.5 staff_space# + bulb_diam#/2);
264
265         penpos1 (thick, 0);
266         penpos2 (thin, 10);
267
268         y1 = - staff_space ;
269         y2 = h -  lower_brush;
270         x2r = width;
271         z2 = z1 + whatever*dir(72);
272         z9 = z2 + 0.5 stafflinethickness * dir (angle(z2 - z1)- 10);
273         pat = z1l --- z2l .. z9 .. z2r --- simple_serif (z1r, z1l, -40) .. cycle;
274         fill pat;
275         
276
277         draw_rest_bulb(0.5 staff_space , y2r , pat , 1.0);
278         penlabels (1, 2);
279         labels(9);
280
281         % draw_staff (-2,2,0.0);
282
283         enddef;
284
285 fet_beginchar("Classical quarter rest","2classical","clasquartrest");
286         draw_eighth_rest;
287         currentpicture := currentpicture xscaled -1 shifted (w,0);
288         fet_endchar;
289
290 fet_beginchar("8th rest","3","eighthrest");
291         draw_eighth_rest;
292         fet_endchar;
293
294 fet_beginchar("16th rest","4","sixteenthrest");
295         save width, bulb_diam, thin, thick;
296         save ycenter, crook_thick, crook_thin;
297         save crook_dir, lower_brush, pat;
298         pair crook_dir;
299         path pat;
300
301         width# := 1.2 staff_space#;
302         bulb_diam# := 0.64 staff_space#;
303         thin# := 1.2 stafflinethickness#;
304         thick# :=  2.2 stafflinethickness#;
305         crook_thick# := 1.8 stafflinethickness#;
306         crook_thin := 1.3 stafflinethickness;
307
308         lower_brush := 1.5 stafflinethickness;
309
310         define_pixels (width, bulb_diam, thin, thick, crook_thick);
311         set_char_box (0, width#,
312                 2.0 staff_space# + 0.5 stafflinethickness#, 0.5 staff_space# + bulb_diam#/2);
313
314         penpos1 (thick, 0);
315         penpos2 (thin, 10);
316
317         y1 = -2 staff_space ;
318         y2 = h -  lower_brush;
319         x2r = width;
320         z2 = z1 + whatever*dir(74);
321         z9 = z2 + 0.5 stafflinethickness * dir (angle(z2 - z1)- 10);
322         pat = z1l --- z2l .. z9 .. z2r --- simple_serif (z1r, z1l, -40) .. cycle;
323         fill pat;
324         
325
326         draw_rest_bulb(0.5 staff_space , y2r , pat , 0.98);
327         draw_rest_bulb(-0.5 staff_space , (-0.5+0.2)*staff_space , pat , 1.02);
328         penlabels (1, 2);
329         labels(9);
330
331         % draw_staff (-2,2,0.0);
332         fet_endchar;
333
334 fet_beginchar("32th rest","5","thirtysecondrest");
335         save width, bulb_diam, thin, thick;
336         save ycenter, crook_thick, crook_thin;
337         save crook_dir, lower_brush, pat;
338         pair crook_dir;
339         path pat;
340
341         width# := 1.3 staff_space#;
342         bulb_diam# := 0.64 staff_space#;
343         thin# := 1.2 stafflinethickness#;
344         thick# :=  2.2 stafflinethickness#;
345         crook_thick# := 1.8 stafflinethickness#;
346         crook_thin := 1.3 stafflinethickness;
347
348         lower_brush := 1.5 stafflinethickness;
349
350         define_pixels (width, bulb_diam, thin, thick, crook_thick);
351         set_char_box (0, width#,
352                 2.0 staff_space# + 0.5 stafflinethickness#, 1.5 staff_space# + bulb_diam#/2);
353
354         penpos1 (thick, 0);
355         penpos2 (thin, 10);
356
357         y1 = -2 staff_space ;
358         y2 = h -  lower_brush;
359         x2r = width;
360         z2 = z1 + whatever*dir(76);
361         z9 = z2 + 0.5 stafflinethickness * dir (angle(z2 - z1)- 10);
362         pat = z1l --- z2l .. z9 .. z2r --- simple_serif (z1r, z1l, -40) .. cycle;
363         fill pat;
364         
365
366         draw_rest_bulb(1.5 staff_space , y2r , pat , 0.96);
367         draw_rest_bulb(0.5 staff_space , (0.5+0.2)*staff_space , pat , 1.00);
368         draw_rest_bulb(-0.5 staff_space , (-0.5+0.21)*staff_space , pat , 1.04);
369         penlabels (1, 2);
370         labels(9);
371
372         % draw_staff (-2,2,0.0);
373         fet_endchar;
374
375 fet_beginchar("64th rest","6","sixtyfourthrest");
376         save width, bulb_diam, thin, thick;
377         save ycenter, crook_thick, crook_thin;
378         save crook_dir, lower_brush, pat;
379         pair crook_dir;
380         path pat;
381
382         width# := 1.4 staff_space#;
383         bulb_diam# := 0.64 staff_space#;
384         thin# := 1.2 stafflinethickness#;
385         thick# :=  2.2 stafflinethickness#;
386         crook_thick# := 1.8 stafflinethickness#;
387         crook_thin := 1.3 stafflinethickness;
388
389         lower_brush := 1.5 stafflinethickness;
390
391         define_pixels (width, bulb_diam, thin, thick, crook_thick);
392         set_char_box (0, width#,
393                 3.0 staff_space# + 0.5 stafflinethickness#, 1.5 staff_space# + bulb_diam#/2);
394
395         penpos1 (thick, 0);
396         penpos2 (thin, 10);
397
398         y1 = -3 staff_space ;
399         y2 = h -  lower_brush;
400         x2r = width;
401         z2 = z1 + whatever*dir(78);
402         z9 = z2 + 0.5 stafflinethickness * dir (angle(z2 - z1)- 10);
403         pat = z1l --- z2l .. z9 .. z2r --- simple_serif (z1r, z1l, -40) .. cycle;
404         fill pat;
405         
406
407         draw_rest_bulb(1.5 staff_space , y2r , pat , 0.94);
408         draw_rest_bulb(0.5 staff_space , (0.5+0.20)*staff_space , pat , 0.98);
409         draw_rest_bulb(-0.5 staff_space , (-0.5+0.21)*staff_space , pat , 1.02);
410         draw_rest_bulb(-1.5 staff_space , (-1.5+0.22)*staff_space , pat , 1.06);
411         penlabels (1, 2);
412         labels(9);
413
414         % draw_staff (-2,2,0.0);
415         fet_endchar;
416
417 fet_beginchar("128th rest","7","hundredtwentyeighthrest");
418         save width, bulb_diam, thin, thick;
419         save ycenter, crook_thick, crook_thin;
420         save crook_dir, lower_brush, pat;
421         pair crook_dir;
422         path pat;
423
424         width# = 1.5 staff_space#;
425         bulb_diam# := 0.64 staff_space#;
426         thin# := 1.2 stafflinethickness#;
427         thick# :=  2.2 stafflinethickness#;
428         crook_thick# := 1.8 stafflinethickness#;
429         crook_thin := 1.3 stafflinethickness;
430
431         lower_brush := 1.5 stafflinethickness;
432
433         define_pixels (width, bulb_diam, thin, thick, crook_thick);
434         set_char_box (0, width#,
435                 3.0 staff_space# + 0.5 stafflinethickness#, 2.5 staff_space# + bulb_diam#/2);
436
437         penpos1 (thick, 0);
438         penpos2 (thin, 10);
439
440         y1 = -3 staff_space ;
441         y2 = h -  lower_brush;
442         x2r = width;
443         z2 = z1 + whatever*dir(80);
444         z9 = z2 + 0.5 stafflinethickness * dir (angle(z2 - z1)- 10);
445         pat = z1l --- z2l .. z9 .. z2r --- simple_serif (z1r, z1l, -40) .. cycle;
446         fill pat;
447         
448
449         draw_rest_bulb(2.5 staff_space , y2r , pat , 0.92);
450         draw_rest_bulb(1.5 staff_space , (1.5+0.20)*staff_space , pat , 0.96);
451         draw_rest_bulb(0.5 staff_space , (0.5+0.21)*staff_space , pat , 1.0);
452         draw_rest_bulb(-0.5 staff_space , (-0.5+0.22)*staff_space , pat , 1.04);
453         draw_rest_bulb(-1.5 staff_space , (-1.5+0.23)*staff_space , pat , 1.08);
454         penlabels (1, 2);
455         labels(9);
456
457         % draw_staff (-2,2,0.0);
458         fet_endchar;
459
460
461 endgroup;
462
463
464 %%%%%%%%
465 %
466 %
467 %
468 % MENSURAL NOTATION
469 %
470 %
471 %
472
473 % Neo-mensural longa and breve are identical with default longa and breve.
474
475 neomens_block_rest_x# = 2/5 staff_space#;
476 neomens_block_rest_y# = 1/1 staff_space#;
477 neomens_half_block_rest_y# = 5/8 staff_space#;
478
479 define_pixels(neomens_block_rest_x,
480               neomens_block_rest_y, neomens_half_block_rest_y);
481
482 def neomens_half_block_rest =
483         draw_block ((0,0), (neomens_block_rest_x, neomens_half_block_rest_y));
484         enddef;
485
486 fet_beginchar("Neo-mensural maxima rest", "-3neo_mensural", "neomensmaximarest");
487        set_char_box(0, neomens_block_rest_x#,
488                     neomens_block_rest_y#, 2 neomens_block_rest_y#);
489        draw_block ((0,-neomens_block_rest_y),
490                    (neomens_block_rest_x, 2 neomens_block_rest_y));
491 fet_endchar;
492
493 fet_beginchar("Neo-mensural longa rest", "-2neo_mensural", "neomenslongarest");
494        set_char_box(0, neomens_block_rest_x#,
495                     neomens_block_rest_y#, neomens_block_rest_y#);
496        draw_block ((0,-neomens_block_rest_y),
497                    (neomens_block_rest_x, neomens_block_rest_y));
498 fet_endchar;
499
500 fet_beginchar("Neo-mensural breve rest", "-1neo_mensural", "neomensbreverest");
501        set_char_box(0, neomens_block_rest_x#,
502                     0, neomens_block_rest_y#);
503        draw_block ((0,0), (neomens_block_rest_x, neomens_block_rest_y));
504 fet_endchar;
505
506 fet_beginchar("Neo-mensural whole rest", "0neo_mensural", "neomenssemibrevisrest");
507         set_char_box(0, neomens_block_rest_x#,
508                      neomens_half_block_rest_y#,  0);
509         neomens_half_block_rest;
510         currentpicture :=
511                 currentpicture shifted (0,- neomens_half_block_rest_y);
512 fet_endchar;
513
514 fet_beginchar("Neo-mensural half rest", "1neo_mensural", "neomensminimahalfrest");
515         set_char_box(0, neomens_block_rest_x#,
516                      0, neomens_half_block_rest_y#);
517         neomens_half_block_rest;
518 fet_endchar;
519
520 neomensrestsize# = 0.8 staff_space#;
521
522 fet_beginchar("Neo-mensural 4th rest","2neo_mensural","neomenssemiminimarest")
523         set_char_box(0,neomensrestsize#,0,neomensrestsize#);
524         pickup pencircle scaled 2 stafflinethickness;
525         lft x1 = 0;
526         bot y1 = 0;
527         lft x2 = 0;
528         top y2 = h;
529         rt x3 = w;
530         bot y3 = h/2;
531         draw z1 .. z2;
532         draw z2 .. z3;
533 fet_endchar
534
535 fet_beginchar("Neo-mensural 8th rest","3neo_mensural","neomensfusarest")
536         set_char_box(0,neomensrestsize#,0,neomensrestsize#);
537         pickup pencircle scaled 2 stafflinethickness;
538         rt x1 = w;
539         bot y1 = 0;
540         rt x2 = w;
541         top y2 = h;
542         lft x3 = 0;
543         bot y3 = h/2;
544         draw z1 .. z2;
545         draw z2 .. z3;
546 fet_endchar
547
548 fet_beginchar("Neo-mensural 16th rest","4neo_mensural","neomenssemifusarest")
549         set_char_box(0,neomensrestsize#,0,staff_space#);
550         pickup pencircle scaled 2 stafflinethickness;
551         rt x1 = w;
552         bot y1 = 0;
553         rt x2 = w;
554         top y2 = h;
555
556         draw z1 .. z2;
557
558         pickup pencircle scaled 2 stafflinethickness;
559         rt x3 = w;
560         top y3 = h;
561         lft x4 = 0;
562         bot y4 = h/2;
563         rt x5 = w;
564         top y5 = 5/8h;
565         lft x6 = 0;
566         bot y6 = h/8;
567
568         draw z3 .. z4;
569         draw z5 .. z6;
570 fet_endchar
571
572
573 fet_endgroup("rests")