1 % feta-eindelijk.mf -- implement rest symbols -*-Fundamental-*-
3 % part of LilyPond's pretty-but-neat music font
5 % source file of the Feta (not the Font-En-Tja) music font
7 % (c) 1997--2003 Jan Nieuwenhuizen <janneke@gnu.org>
9 fet_begingroup("rests");
13 thick#:=1/16designsize;
14 define_blacker_pixels(thick);
16 rthin:=1/8*staff_space;
20 def shift_pic (expr pone, ptwo) =
21 currentpicture:=currentpicture shifted (round(pone),round(ptwo))
24 % stuff for 8th,16th etc rests
26 save stem, ball_crook_stem, ball_crook_balldiam, flare;
28 % stem#:=1/8*staff_space#;
29 stem# = 1/5staff_space#;
30 % flare# = 2/3staff_space#;
31 flare# = 2/3staff_space# - 1/8stafflinethickness#;
33 define_pixels(stem,flare);
35 ball_crook_stem = stem;
36 ball_crook_balldiam =flare;
39 save block_rest_y, block_rest_x;
41 save breve_rest_y, breve_rest_x;
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#;
48 define_pixels(block_rest_y, block_rest_x);
51 draw_block ((0,0), (block_rest_x, block_rest_y));
54 fet_beginchar( "whole rest", "0", "wholerest");
55 set_char_box(0, block_rest_x#,
58 currentpicture := currentpicture shifted (0,- block_rest_y);
61 fet_beginchar("half rest", "1", "halfrest");
62 set_char_box(0, block_rest_x#, 0, block_rest_y#);
68 % should use ledgerline thickness?
70 fet_beginchar( "whole rest (outside staff)", "0o", "outsidewholerest");
71 set_char_box(0, block_rest_x#,
72 block_rest_y#, ledgerlinethickness#/2);
74 currentpicture := currentpicture shifted (0, - block_rest_y);
75 pickup pencircle scaled ledgerlinethickness;
78 lft x5 = - b - block_rest_y;
79 rt x6 = w + block_rest_y;
80 draw_gridline(z5,z6,ledgerlinethickness);
83 fet_beginchar("half rest (outside staff)", "1o", "outsidehalfrest");
84 set_char_box(0, block_rest_x#,
85 ledgerlinethickness#/2, block_rest_y#);
87 pickup pencircle scaled ledgerlinethickness;
89 lft x5 = - b - block_rest_y ;
90 rt x6 = w + block_rest_y;
91 draw_gridline (z5,z6,ledgerlinethickness);
96 define_pixels(breve_rest_y, breve_rest_x, multi_rest_x, multi_beam_height);
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);
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)));
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)));
115 tracingvariables := 1;
117 fet_beginchar("Quarter rest","2","quartrest");
118 % draw_staff (-2, 2, 0.0);
119 save alpha, yshift, height;
121 yshift# = -1.25 staff_space#;
122 height# = 2.8125 staff_space#;
123 define_pixels (yshift, height);
125 xcenter = -0.1 staff_space;
127 set_char_box(0, 0.95 staff_space#,
131 save ne,nw,se,sw; pair ne,nw,se,sw;
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);
145 % z11=z4l+1/2rthin*sw;
146 z11=z4l+1/2rthin*sw+1/2rthin*se;
148 % z13=z2r+1/2rthin*ne;
149 z13=z2r+1/2rthin*ne+1/2rthin*nw;
152 x1l=xcenter + 1/3staff_space;
153 z2r=z1+staff_space*se;
155 x4= xcenter + 3/8staff_space;
157 z5=z4l+1.3staff_space*se;
160 x7= xcenter + 2/5staff_space;
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);
168 % 3/4 staff_space# + yshift#,
169 % 18/5staff_space# + yshift#)
173 def rest_crook(expr a, w) =
174 balled_crook(a, w, ball_crook_balldiam, ball_crook_stem)
178 % Notes about 8th rest:
180 % * 8th rest should be no wider than the black note head
182 % * The inside corner of the horizontal portion is usually a little blotted.
184 % * The top of the crook chops off the vertical brush
186 % * The crook widens a little
188 % * The bottom of the brush is slightly flat, as it has to align with
189 % stafflines if it is inside the staff.
191 % * The top of the brush usually is a little lower than the top of bulb.
193 % * The bulb can vary. Sometimes it is open (like in the clefs). Sometimes
194 % it is closed, or even a flare.
197 % from an email to Rune Zedeler:
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.
210 def draw_rest_bulb(expr ycenter, ycut, pat, stretch) =
213 z1l = point 0 of pat;
214 z2l = point 1 of pat;
215 z2r = point 3 of pat;
216 z1r = point 4 of pat;
220 z10 = whatever[z2, z1] + left*bulb_diam*stretch;
223 z3 = z10+bulb_diam/2.15*dir(-72) ;
226 x4 = x10+bulb_diam*.62 ;
227 y4 := ceiling (y10 - 2 stafflinethickness + crook_thin);
229 z5 = z10 + up*bulb_diam/2 + right*stafflinethickness/3;
232 z7 = 0.5 [z4, z5] + (0.45 stafflinethickness,0.4 stafflinethickness);
233 x8 = x10-0.4bulb_diam;
234 y8 = y10 + 0.25 stafflinethickness;
236 z6 = whatever [z1l, z2l];
237 z6 = z3+whatever * dir(12);
239 (pt,whatever) = pat intersectiontimes ((0,ycut)--(w,ycut));
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;
246 labels(3, 4, 5, 6, 7, 8, 9, 10);
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;
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;
265 lower_brush := 1.5 stafflinethickness;
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);
275 y2 = h - lower_brush;
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;
283 draw_rest_bulb(0.5 staff_space , y2r , pat , 1.0);
287 % draw_staff (-2,2,0.0);
291 fet_beginchar("Classical quarter rest","2classical","clasquartrest");
293 currentpicture := currentpicture xscaled -1 shifted (w,0);
296 fet_beginchar("8th rest","3","eighthrest");
302 % TODO: the X dimensions of the rests are fucked up:
303 % they can collide with augmentation dots.
306 fet_beginchar("16th rest","4","sixteenthrest");
307 save width, bulb_diam, thin, thick;
308 save ycenter, crook_thick, crook_thin;
309 save crook_dir, lower_brush, pat;
313 width# := 1.2 staff_space#;
314 bulb_diam# := 0.64 staff_space#;
315 thin# := 1.2 stafflinethickness#;
316 thick# := 2.2 stafflinethickness#;
317 crook_thick# := 1.8 stafflinethickness#;
318 crook_thin := 1.3 stafflinethickness;
320 lower_brush := 1.5 stafflinethickness;
322 define_pixels (width, bulb_diam, thin, thick, crook_thick);
323 set_char_box (0, width#,
324 2.0 staff_space# + 0.5 stafflinethickness#, 0.5 staff_space# + bulb_diam#/2);
329 y1 = -2 staff_space ;
330 y2 = h - lower_brush;
332 z2 = z1 + whatever*dir(74);
333 z9 = z2 + 0.5 stafflinethickness * dir (angle(z2 - z1)- 10);
334 pat = z1l --- z2l .. z9 .. z2r --- simple_serif (z1r, z1l, -40) .. cycle;
338 draw_rest_bulb(0.5 staff_space , y2r , pat , 0.98);
339 draw_rest_bulb(-0.5 staff_space , (-0.5+0.2)*staff_space , pat , 1.02);
343 % draw_staff (-2,2,0.0);
346 fet_beginchar("32th rest","5","thirtysecondrest");
347 save width, bulb_diam, thin, thick;
348 save ycenter, crook_thick, crook_thin;
349 save crook_dir, lower_brush, pat;
353 width# := 1.3 staff_space#;
354 bulb_diam# := 0.64 staff_space#;
355 thin# := 1.2 stafflinethickness#;
356 thick# := 2.2 stafflinethickness#;
357 crook_thick# := 1.8 stafflinethickness#;
358 crook_thin := 1.3 stafflinethickness;
360 lower_brush := 1.5 stafflinethickness;
362 define_pixels (width, bulb_diam, thin, thick, crook_thick);
363 set_char_box (0, width#,
364 2.0 staff_space# + 0.5 stafflinethickness#, 1.5 staff_space# + bulb_diam#/2);
369 y1 = -2 staff_space ;
370 y2 = h - lower_brush;
372 z2 = z1 + whatever*dir(76);
373 z9 = z2 + 0.5 stafflinethickness * dir (angle(z2 - z1)- 10);
374 pat = z1l --- z2l .. z9 .. z2r --- simple_serif (z1r, z1l, -40) .. cycle;
378 draw_rest_bulb(1.5 staff_space , y2r , pat , 0.96);
379 draw_rest_bulb(0.5 staff_space , (0.5+0.2)*staff_space , pat , 1.00);
380 draw_rest_bulb(-0.5 staff_space , (-0.5+0.21)*staff_space , pat , 1.04);
384 % draw_staff (-2,2,0.0);
387 fet_beginchar("64th rest","6","sixtyfourthrest");
388 save width, bulb_diam, thin, thick;
389 save ycenter, crook_thick, crook_thin;
390 save crook_dir, lower_brush, pat;
394 width# := 1.4 staff_space#;
395 bulb_diam# := 0.64 staff_space#;
396 thin# := 1.2 stafflinethickness#;
397 thick# := 2.2 stafflinethickness#;
398 crook_thick# := 1.8 stafflinethickness#;
399 crook_thin := 1.3 stafflinethickness;
401 lower_brush := 1.5 stafflinethickness;
403 define_pixels (width, bulb_diam, thin, thick, crook_thick);
404 set_char_box (0, width#,
405 3.0 staff_space# + 0.5 stafflinethickness#, 1.5 staff_space# + bulb_diam#/2);
410 y1 = -3 staff_space ;
411 y2 = h - lower_brush;
413 z2 = z1 + whatever*dir(78);
414 z9 = z2 + 0.5 stafflinethickness * dir (angle(z2 - z1)- 10);
415 pat = z1l --- z2l .. z9 .. z2r --- simple_serif (z1r, z1l, -40) .. cycle;
419 draw_rest_bulb(1.5 staff_space , y2r , pat , 0.94);
420 draw_rest_bulb(0.5 staff_space , (0.5+0.20)*staff_space , pat , 0.98);
421 draw_rest_bulb(-0.5 staff_space , (-0.5+0.21)*staff_space , pat , 1.02);
422 draw_rest_bulb(-1.5 staff_space , (-1.5+0.22)*staff_space , pat , 1.06);
426 % draw_staff (-2,2,0.0);
429 fet_beginchar("128th rest","7","hundredtwentyeighthrest");
430 save width, bulb_diam, thin, thick;
431 save ycenter, crook_thick, crook_thin;
432 save crook_dir, lower_brush, pat;
436 width# = 1.5 staff_space#;
437 bulb_diam# := 0.64 staff_space#;
438 thin# := 1.2 stafflinethickness#;
439 thick# := 2.2 stafflinethickness#;
440 crook_thick# := 1.8 stafflinethickness#;
441 crook_thin := 1.3 stafflinethickness;
443 lower_brush := 1.5 stafflinethickness;
445 define_pixels (width, bulb_diam, thin, thick, crook_thick);
446 set_char_box (0, width#,
447 3.0 staff_space# + 0.5 stafflinethickness#, 2.5 staff_space# + bulb_diam#/2);
452 y1 = -3 staff_space ;
453 y2 = h - lower_brush;
455 z2 = z1 + whatever*dir(80);
456 z9 = z2 + 0.5 stafflinethickness * dir (angle(z2 - z1)- 10);
457 pat = z1l --- z2l .. z9 .. z2r --- simple_serif (z1r, z1l, -40) .. cycle;
461 draw_rest_bulb(2.5 staff_space , y2r , pat , 0.92);
462 draw_rest_bulb(1.5 staff_space , (1.5+0.20)*staff_space , pat , 0.96);
463 draw_rest_bulb(0.5 staff_space , (0.5+0.21)*staff_space , pat , 1.0);
464 draw_rest_bulb(-0.5 staff_space , (-0.5+0.22)*staff_space , pat , 1.04);
465 draw_rest_bulb(-1.5 staff_space , (-1.5+0.23)*staff_space , pat , 1.08);
469 % draw_staff (-2,2,0.0);
475 fet_endgroup("rests")