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