]> git.donarmstrong.com Git - lilypond.git/blob - mf/feta-eindelijk.mf
* VERSION (MY_PATCH_LEVEL): make 1.7.0
[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 fet_beginchar("maxima rest", "-3", "maximarest");
99         set_char_box(0, 3 breve_rest_x#, breve_rest_y#, breve_rest_y#);
100         draw_block ((0,-floor (breve_rest_y)), (breve_rest_x, floor (breve_rest_y)));
101         addto currentpicture also currentpicture shifted (2 breve_rest_x, 0);
102 fet_endchar;
103
104 fet_beginchar("longa rest", "-2", "longarest");
105         set_char_box(0, breve_rest_x#, breve_rest_y#, breve_rest_y#);
106         draw_block ((0,-floor (breve_rest_y)), (breve_rest_x, floor (breve_rest_y)));
107 fet_endchar;
108
109 fet_beginchar("breve rest", "-1", "breverest");
110         set_char_box(0, breve_rest_x#, 0, breve_rest_y#);
111         draw_block ((0,0), (breve_rest_x, floor (breve_rest_y)));
112 fet_endchar;
113
114
115 tracingvariables := 1;
116
117 fet_beginchar("Quarter rest","2","quartrest");
118 %       draw_staff (-2, 2, 0.0);        
119         save alpha, yshift, height;
120         alpha:=-50;
121         yshift# = -1.25 staff_space#;
122         height# = 2.8125 staff_space#;
123         define_pixels (yshift, height);
124         save xcenter;
125         xcenter = -0.1 staff_space;
126         
127         set_char_box(0, 0.95 staff_space#,
128           -yshift#,
129           yshift# + height#);
130         
131         save ne,nw,se,sw; pair ne,nw,se,sw;
132         
133         se=dir alpha; nw=dir (alpha+180);
134         ne=dir (alpha+90); sw=dir (alpha-90);
135         penpos1(rthin,alpha+90);
136         penpos2(5/4rthick,alpha);
137         penpos4(5/4rthick,alpha);
138         penpos5(rthin,alpha+90);
139         penpos3(3/4rthick,alpha);
140 %       penpos6(5/8rthick,alpha);
141         penpos6(2/3rthick,alpha);
142         penpos7(1/2rthin,alpha+90);
143
144         z10=z2l+1/2rthin*sw;
145 %       z11=z4l+1/2rthin*sw;
146         z11=z4l+1/2rthin*sw+1/2rthin*se;
147         z12=z4r+1/2rthin*ne;
148 %       z13=z2r+1/2rthin*ne;
149         z13=z2r+1/2rthin*ne+1/2rthin*nw;
150
151         y1r = h;
152         x1l=xcenter +  1/3staff_space;
153         z2r=z1+staff_space*se;
154         z3=1/2[z2,z4];
155         x4= xcenter + 3/8staff_space;
156         y4= 0;
157         z5=z4l+1.3staff_space*se;
158         x6l=x4l;
159         y6l=y4r;
160         x7= xcenter + 2/5staff_space;
161         y7= -d;
162         
163         fill z1l{se}..{se}z10..z3l..z11{se}..{se}z5l..z5r{nw}..{nw}z12..z3r..z13{nw}..{nw}z1r.. cycle;
164         fill z5r{nw}..tension1.4..z6l..tension1.4..{se}z7l..z7r{nw}..tension1.4..z6r..tension1.4..{se}z5l..cycle;
165         penlabels(1,2,3,4,5,6,7);
166         penlabels(10,11,12,13);
167         
168 %         3/4 staff_space# + yshift#,
169 %         18/5staff_space# + yshift#)
170
171         fet_endchar;
172
173 def rest_crook(expr a, w) =
174         balled_crook(a, w, ball_crook_balldiam, ball_crook_stem)
175 enddef;
176
177 %
178 % Notes about 8th rest:  
179
180 % * 8th rest should be no wider than the black note head
181 %
182 % * The inside corner of the horizontal portion is usually a little blotted.
183 %
184 % * The top of the crook chops off the vertical brush
185
186 % * The crook widens a little
187 %
188 % * The bottom of the brush is slightly flat, as it has to align with
189 % stafflines if it is inside the staff.
190 %
191 % * The top of the brush usually is a little lower than the top of bulb.
192 %
193 % * The bulb can vary. Sometimes it is open (like in the clefs). Sometimes 
194 % it is closed, or even a flare.
195
196
197 % from an email to Rune Zedeler:
198 %
199
200 % For example, the 8th rest was vaguely based on a book with trumpet
201 % studies by Duhem, and by Baerenreiters cello suites. I included my
202 % findings in a comment in the mf file.  One of the things that I tried
203 % to do was make the rest a little lighter and narrower than the black
204 % note head. I think this looks better in polyphonic music, when the
205 % rest is below a head from a different voice.
206 %
207 %
208
209
210 def draw_rest_bulb(expr ycenter, ycut, pat, stretch) =
211 begingroup;
212         save x,y,pt;
213         z1l = point 0 of pat;
214         z2l = point 1 of pat;
215         z2r = point 3 of pat;
216         z1r = point 4 of pat;
217         z1 = 0.5[z1l,z1r];
218         z2 = 0.5[z2l,z2r];
219         y10 = ycenter;
220         z10 = whatever[z2, z1] + left*bulb_diam*stretch;
221
222
223         z3 = z10+bulb_diam/2.15*dir(-72) ;
224
225
226         x4 = x10+bulb_diam*.62 ;
227         y4 := ceiling (y10 - 2 stafflinethickness + crook_thin);
228
229         z5 = z10 + up*bulb_diam/2 + right*stafflinethickness/3;
230         
231
232         z7 = 0.5 [z4, z5] + (0.45 stafflinethickness,0.4 stafflinethickness);
233         x8 = x10-0.4bulb_diam;
234         y8 = y10 + 0.25 stafflinethickness;
235
236         z6 = whatever [z1l, z2l];
237         z6 = z3+whatever * dir(12);
238
239         (pt,whatever) = pat intersectiontimes ((0,ycut)--(w,ycut));
240
241         fill point pt of pat {-direction pt of pat} .. tension 2
242                 .. z4{left} .. tension 0.9 .. z7
243                 .. z5{left} .. z8 .. z3{right}
244                 .. {curl 0.2} z6 {right} .. tension 10 .. {left} point pt of pat -- cycle;
245
246         labels(3, 4, 5, 6, 7, 8, 9, 10);
247
248 endgroup;
249 enddef;
250
251 def draw_eighth_rest =
252         save width, bulb_diam, thin, thick;
253         save ycenter, crook_thick, crook_thin;
254         save crook_dir, lower_brush, pat;
255         pair crook_dir;
256         path pat;
257
258         width# := 1.0 staff_space#;
259         bulb_diam# := 0.64 staff_space#;
260         thin# := 1.2 stafflinethickness#;
261         thick# :=  2.2 stafflinethickness#;
262         crook_thick# := 1.8 stafflinethickness#;
263         crook_thin := 1.3 stafflinethickness;
264
265         lower_brush := 1.5 stafflinethickness;
266
267         define_pixels (width, bulb_diam, thin, thick, crook_thick);
268         set_char_box (0, width#,
269                 1.0 staff_space# + 0.5 stafflinethickness#, 0.5 staff_space# + bulb_diam#/2);
270
271         penpos1 (thick, 0);
272         penpos2 (thin, 10);
273
274         y1 = - staff_space ;
275         y2 = h -  lower_brush;
276         x2r = width;
277         z2 = z1 + whatever*dir(72);
278         z9 = z2 + 0.5 stafflinethickness * dir (angle(z2 - z1)- 10);
279         pat = z1l --- z2l .. z9 .. z2r --- simple_serif (z1r, z1l, -40) .. cycle;
280         fill pat;
281         
282
283         draw_rest_bulb(0.5 staff_space , y2r , pat , 1.0);
284         penlabels (1, 2);
285         labels(9);
286
287         % draw_staff (-2,2,0.0);
288
289         enddef;
290
291 fet_beginchar("Classical quarter rest","2classical","clasquartrest");
292         draw_eighth_rest;
293         currentpicture := currentpicture xscaled -1 shifted (w,0);
294         fet_endchar;
295
296 fet_beginchar("8th rest","3","eighthrest");
297         draw_eighth_rest;
298         fet_endchar;
299
300 fet_beginchar("16th rest","4","sixteenthrest");
301         save width, bulb_diam, thin, thick;
302         save ycenter, crook_thick, crook_thin;
303         save crook_dir, lower_brush, pat;
304         pair crook_dir;
305         path pat;
306
307         width# := 1.2 staff_space#;
308         bulb_diam# := 0.64 staff_space#;
309         thin# := 1.2 stafflinethickness#;
310         thick# :=  2.2 stafflinethickness#;
311         crook_thick# := 1.8 stafflinethickness#;
312         crook_thin := 1.3 stafflinethickness;
313
314         lower_brush := 1.5 stafflinethickness;
315
316         define_pixels (width, bulb_diam, thin, thick, crook_thick);
317         set_char_box (0, width#,
318                 2.0 staff_space# + 0.5 stafflinethickness#, 0.5 staff_space# + bulb_diam#/2);
319
320         penpos1 (thick, 0);
321         penpos2 (thin, 10);
322
323         y1 = -2 staff_space ;
324         y2 = h -  lower_brush;
325         x2r = width;
326         z2 = z1 + whatever*dir(74);
327         z9 = z2 + 0.5 stafflinethickness * dir (angle(z2 - z1)- 10);
328         pat = z1l --- z2l .. z9 .. z2r --- simple_serif (z1r, z1l, -40) .. cycle;
329         fill pat;
330         
331
332         draw_rest_bulb(0.5 staff_space , y2r , pat , 0.98);
333         draw_rest_bulb(-0.5 staff_space , (-0.5+0.2)*staff_space , pat , 1.02);
334         penlabels (1, 2);
335         labels(9);
336
337         % draw_staff (-2,2,0.0);
338         fet_endchar;
339
340 fet_beginchar("32th rest","5","thirtysecondrest");
341         save width, bulb_diam, thin, thick;
342         save ycenter, crook_thick, crook_thin;
343         save crook_dir, lower_brush, pat;
344         pair crook_dir;
345         path pat;
346
347         width# := 1.3 staff_space#;
348         bulb_diam# := 0.64 staff_space#;
349         thin# := 1.2 stafflinethickness#;
350         thick# :=  2.2 stafflinethickness#;
351         crook_thick# := 1.8 stafflinethickness#;
352         crook_thin := 1.3 stafflinethickness;
353
354         lower_brush := 1.5 stafflinethickness;
355
356         define_pixels (width, bulb_diam, thin, thick, crook_thick);
357         set_char_box (0, width#,
358                 2.0 staff_space# + 0.5 stafflinethickness#, 1.5 staff_space# + bulb_diam#/2);
359
360         penpos1 (thick, 0);
361         penpos2 (thin, 10);
362
363         y1 = -2 staff_space ;
364         y2 = h -  lower_brush;
365         x2r = width;
366         z2 = z1 + whatever*dir(76);
367         z9 = z2 + 0.5 stafflinethickness * dir (angle(z2 - z1)- 10);
368         pat = z1l --- z2l .. z9 .. z2r --- simple_serif (z1r, z1l, -40) .. cycle;
369         fill pat;
370         
371
372         draw_rest_bulb(1.5 staff_space , y2r , pat , 0.96);
373         draw_rest_bulb(0.5 staff_space , (0.5+0.2)*staff_space , pat , 1.00);
374         draw_rest_bulb(-0.5 staff_space , (-0.5+0.21)*staff_space , pat , 1.04);
375         penlabels (1, 2);
376         labels(9);
377
378         % draw_staff (-2,2,0.0);
379         fet_endchar;
380
381 fet_beginchar("64th rest","6","sixtyfourthrest");
382         save width, bulb_diam, thin, thick;
383         save ycenter, crook_thick, crook_thin;
384         save crook_dir, lower_brush, pat;
385         pair crook_dir;
386         path pat;
387
388         width# := 1.4 staff_space#;
389         bulb_diam# := 0.64 staff_space#;
390         thin# := 1.2 stafflinethickness#;
391         thick# :=  2.2 stafflinethickness#;
392         crook_thick# := 1.8 stafflinethickness#;
393         crook_thin := 1.3 stafflinethickness;
394
395         lower_brush := 1.5 stafflinethickness;
396
397         define_pixels (width, bulb_diam, thin, thick, crook_thick);
398         set_char_box (0, width#,
399                 3.0 staff_space# + 0.5 stafflinethickness#, 1.5 staff_space# + bulb_diam#/2);
400
401         penpos1 (thick, 0);
402         penpos2 (thin, 10);
403
404         y1 = -3 staff_space ;
405         y2 = h -  lower_brush;
406         x2r = width;
407         z2 = z1 + whatever*dir(78);
408         z9 = z2 + 0.5 stafflinethickness * dir (angle(z2 - z1)- 10);
409         pat = z1l --- z2l .. z9 .. z2r --- simple_serif (z1r, z1l, -40) .. cycle;
410         fill pat;
411         
412
413         draw_rest_bulb(1.5 staff_space , y2r , pat , 0.94);
414         draw_rest_bulb(0.5 staff_space , (0.5+0.20)*staff_space , pat , 0.98);
415         draw_rest_bulb(-0.5 staff_space , (-0.5+0.21)*staff_space , pat , 1.02);
416         draw_rest_bulb(-1.5 staff_space , (-1.5+0.22)*staff_space , pat , 1.06);
417         penlabels (1, 2);
418         labels(9);
419
420         % draw_staff (-2,2,0.0);
421         fet_endchar;
422
423 fet_beginchar("128th rest","7","hundredtwentyeighthrest");
424         save width, bulb_diam, thin, thick;
425         save ycenter, crook_thick, crook_thin;
426         save crook_dir, lower_brush, pat;
427         pair crook_dir;
428         path pat;
429
430         width# = 1.5 staff_space#;
431         bulb_diam# := 0.64 staff_space#;
432         thin# := 1.2 stafflinethickness#;
433         thick# :=  2.2 stafflinethickness#;
434         crook_thick# := 1.8 stafflinethickness#;
435         crook_thin := 1.3 stafflinethickness;
436
437         lower_brush := 1.5 stafflinethickness;
438
439         define_pixels (width, bulb_diam, thin, thick, crook_thick);
440         set_char_box (0, width#,
441                 3.0 staff_space# + 0.5 stafflinethickness#, 2.5 staff_space# + bulb_diam#/2);
442
443         penpos1 (thick, 0);
444         penpos2 (thin, 10);
445
446         y1 = -3 staff_space ;
447         y2 = h -  lower_brush;
448         x2r = width;
449         z2 = z1 + whatever*dir(80);
450         z9 = z2 + 0.5 stafflinethickness * dir (angle(z2 - z1)- 10);
451         pat = z1l --- z2l .. z9 .. z2r --- simple_serif (z1r, z1l, -40) .. cycle;
452         fill pat;
453         
454
455         draw_rest_bulb(2.5 staff_space , y2r , pat , 0.92);
456         draw_rest_bulb(1.5 staff_space , (1.5+0.20)*staff_space , pat , 0.96);
457         draw_rest_bulb(0.5 staff_space , (0.5+0.21)*staff_space , pat , 1.0);
458         draw_rest_bulb(-0.5 staff_space , (-0.5+0.22)*staff_space , pat , 1.04);
459         draw_rest_bulb(-1.5 staff_space , (-1.5+0.23)*staff_space , pat , 1.08);
460         penlabels (1, 2);
461         labels(9);
462
463         % draw_staff (-2,2,0.0);
464         fet_endchar;
465
466
467 endgroup;
468
469
470 %%%%%%%%
471 %
472 %
473 %
474 % MENSURAL NOTATION
475 %
476 %
477 %
478
479 % Neo-mensural longa and breve are identical with default longa and breve.
480
481 neomens_block_rest_x# = 2/5 staff_space#;
482 neomens_block_rest_y# = 1/1 staff_space#;
483 neomens_half_block_rest_y# = 5/8 staff_space#;
484
485 define_pixels(neomens_block_rest_x,
486               neomens_block_rest_y, neomens_half_block_rest_y);
487
488 def neomens_half_block_rest =
489         draw_block ((0,0), (neomens_block_rest_x, neomens_half_block_rest_y));
490         enddef;
491
492 fet_beginchar("Neo-mensural maxima rest", "-3neo_mensural", "neomensmaximarest");
493        set_char_box(0, neomens_block_rest_x#,
494                     neomens_block_rest_y#, 2 neomens_block_rest_y#);
495        draw_block ((0,-neomens_block_rest_y),
496                    (neomens_block_rest_x, 2 neomens_block_rest_y));
497 fet_endchar;
498
499 fet_beginchar("Neo-mensural longa rest", "-2neo_mensural", "neomenslongarest");
500        set_char_box(0, neomens_block_rest_x#,
501                     neomens_block_rest_y#, neomens_block_rest_y#);
502        draw_block ((0,-neomens_block_rest_y),
503                    (neomens_block_rest_x, neomens_block_rest_y));
504 fet_endchar;
505
506 fet_beginchar("Neo-mensural breve rest", "-1neo_mensural", "neomensbreverest");
507        set_char_box(0, neomens_block_rest_x#,
508                     0, neomens_block_rest_y#);
509        draw_block ((0,0), (neomens_block_rest_x, neomens_block_rest_y));
510 fet_endchar;
511
512 fet_beginchar("Neo-mensural whole rest", "0neo_mensural", "neomenssemibrevisrest");
513         set_char_box(0, neomens_block_rest_x#,
514                      neomens_half_block_rest_y#,  0);
515         neomens_half_block_rest;
516         currentpicture :=
517                 currentpicture shifted (0,- neomens_half_block_rest_y);
518 fet_endchar;
519
520 fet_beginchar("Neo-mensural half rest", "1neo_mensural", "neomensminimahalfrest");
521         set_char_box(0, neomens_block_rest_x#,
522                      0, neomens_half_block_rest_y#);
523         neomens_half_block_rest;
524 fet_endchar;
525
526 neomensrestsize# = 0.8 staff_space#;
527
528 fet_beginchar("Neo-mensural 4th rest","2neo_mensural","neomenssemiminimarest")
529         set_char_box(0,neomensrestsize#,0,neomensrestsize#);
530         pickup pencircle scaled 2 stafflinethickness;
531         lft x1 = 0;
532         bot y1 = 0;
533         lft x2 = 0;
534         top y2 = h;
535         rt x3 = w;
536         bot y3 = h/2;
537         draw z1 .. z2;
538         draw z2 .. z3;
539 fet_endchar
540
541 fet_beginchar("Neo-mensural 8th rest","3neo_mensural","neomensfusarest")
542         set_char_box(0,neomensrestsize#,0,neomensrestsize#);
543         pickup pencircle scaled 2 stafflinethickness;
544         rt x1 = w;
545         bot y1 = 0;
546         rt x2 = w;
547         top y2 = h;
548         lft x3 = 0;
549         bot y3 = h/2;
550         draw z1 .. z2;
551         draw z2 .. z3;
552 fet_endchar
553
554 fet_beginchar("Neo-mensural 16th rest","4neo_mensural","neomenssemifusarest")
555         set_char_box(0,neomensrestsize#,0,staff_space#);
556         pickup pencircle scaled 2 stafflinethickness;
557         rt x1 = w;
558         bot y1 = 0;
559         rt x2 = w;
560         top y2 = h;
561
562         draw z1 .. z2;
563
564         pickup pencircle scaled 2 stafflinethickness;
565         rt x3 = w;
566         top y3 = h;
567         lft x4 = 0;
568         bot y4 = h/2;
569         rt x5 = w;
570         top y5 = 5/8h;
571         lft x6 = 0;
572         bot y6 = h/8;
573
574         draw z3 .. z4;
575         draw z5 .. z6;
576 fet_endchar
577
578
579 fet_endgroup("rests")