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