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--2004 Jan Nieuwenhuizen <janneke@gnu.org>
9 fet_begingroup("rests");
14 save block_rest_y, block_rest_x;
15 save breve_rest_y, breve_rest_x;
17 breve_rest_y# = staff_space#;
18 breve_rest_x# = 3/5 staff_space#;
19 block_rest_y# = 5/8 staff_space#;
20 block_rest_x# = 3/2 staff_space#;
22 define_pixels(block_rest_y, block_rest_x);
25 draw_block ((0,0), (block_rest_x, block_rest_y));
28 fet_beginchar( "whole rest", "0", "wholerest");
29 set_char_box(0, block_rest_x#,
32 currentpicture := currentpicture shifted (0,- block_rest_y);
35 fet_beginchar("half rest", "1", "halfrest");
36 set_char_box(0, block_rest_x#, 0, block_rest_y#);
42 % should use ledgerline thickness?
44 fet_beginchar( "whole rest (outside staff)", "0o", "outsidewholerest");
45 set_char_box(0, block_rest_x#,
46 block_rest_y#, ledgerlinethickness#/2);
48 currentpicture := currentpicture shifted (0, - block_rest_y);
49 pickup pencircle scaled ledgerlinethickness;
52 lft x5 = - b - block_rest_y;
53 rt x6 = w + block_rest_y;
54 draw_gridline(z5,z6,ledgerlinethickness);
57 fet_beginchar("half rest (outside staff)", "1o", "outsidehalfrest");
58 set_char_box(0, block_rest_x#,
59 ledgerlinethickness#/2, block_rest_y#);
61 pickup pencircle scaled ledgerlinethickness;
63 lft x5 = - b - block_rest_y ;
64 rt x6 = w + block_rest_y;
65 draw_gridline (z5,z6,ledgerlinethickness);
70 define_pixels(breve_rest_y, breve_rest_x, multi_rest_x, multi_beam_height);
72 fet_beginchar("maxima rest", "-3", "maximarest");
73 set_char_box(0, 3 breve_rest_x#, breve_rest_y#, breve_rest_y#);
74 draw_block ((0,-floor (breve_rest_y)), (breve_rest_x, floor (breve_rest_y)));
75 addto currentpicture also currentpicture shifted (2 breve_rest_x, 0);
78 fet_beginchar("longa rest", "-2", "longarest");
79 set_char_box(0, breve_rest_x#, breve_rest_y#, breve_rest_y#);
80 draw_block ((0,-floor (breve_rest_y)), (breve_rest_x, floor (breve_rest_y)));
83 fet_beginchar("breve rest", "-1", "breverest");
84 set_char_box(0, breve_rest_x#, 0, breve_rest_y#);
85 draw_block ((0,0), (breve_rest_x, floor (breve_rest_y)));
89 tracingvariables := 1;
91 fet_beginchar("Quarter rest","2","quartrest");
92 % draw_staff (-2, 2, 0.0);
93 save alpha, yshift, height;
97 thick# := 1/4 staff_space#;
98 define_blacker_pixels(thick);
100 rthin := 1.25 linethickness;
101 rthick := 2 thick+rthin;
105 yshift# = -1.25 staff_space#;
106 height# = 2.8125 staff_space#;
108 define_pixels (yshift, height);
110 xcenter = -0.1 staff_space;
112 set_char_box(0, 0.95 staff_space#,
116 save ne,nw, se, sw; pair ne, nw, se, sw;
118 se=dir alpha; nw=dir (alpha+180);
119 ne=dir (alpha+90); sw=dir (alpha-90);
120 penpos1(rthin, alpha+90);
121 penpos2(5/4rthick, alpha);
122 penpos4(5/4rthick, alpha);
123 penpos5(rthin, alpha+90);
124 penpos3(3/4rthick, alpha);
125 % penpos6(5/8rthick, alpha);
126 penpos6(2/3rthick, alpha);
127 penpos7(1/2rthin, alpha+90);
130 % z11=z4l+1/2rthin*sw;
131 z11=z4l+1/2rthin*sw+1/2rthin*se;
133 % z13=z2r+1/2rthin*ne;
134 z13=z2r+1/2rthin*ne+1/2rthin*nw;
137 x1l=xcenter + 1/3staff_space;
138 z2r=z1+staff_space*se;
140 x4= xcenter + 3/8staff_space;
142 z5=z4l+1.3staff_space*se;
145 x7= xcenter + 2/5staff_space;
148 fill z1l{se}..{se}z10..z3l..z11{se}..{se}z5l..z5r{nw}..{nw}z12..z3r..z13{nw}..{nw}z1r.. cycle;
149 fill z5r{nw}..tension1.4..z6l..tension1.4..{se}z7l..z7r{nw}..tension1.4..z6r..tension1.4..{se}z5l..cycle;
150 penlabels(1, 2, 3, 4, 5, 6, 7);
151 penlabels(10, 11, 12, 13);
155 def rest_crook(expr a, w) =
156 balled_crook(a, w, ball_crook_balldiam, ball_crook_stem)
160 % Notes about 8th rest:
162 % * 8th rest should be no wider than the black note head
164 % * The inside corner of the horizontal portion is usually a little blotted.
166 % * The top of the crook chops off the vertical brush
168 % * The crook widens a little
170 % * The bottom of the brush is slightly flat, as it has to align with
171 % stafflines if it is inside the staff.
173 % * The top of the brush usually is a little lower than the top of bulb.
175 % * The bulb can vary. Sometimes it is open (like in the clefs). Sometimes
176 % it is closed, or even a flare.
179 % from an email to Rune Zedeler:
182 % For example, the 8th rest was vaguely based on a book with trumpet
183 % studies by Duhem, and by Baerenreiters cello suites. I included my
184 % findings in a comment in the mf file. One of the things that I tried
185 % to do was make the rest a little lighter and narrower than the black
186 % note head. I think this looks better in polyphonic music, when the
187 % rest is below a head from a different voice.
191 save bulb_diam, thin, thick;
193 bulb_diam# := 0.64 staff_space#;
194 thin# := 1.4 linethickness# - 0.02 staff_space#;
195 thick# := 2.2 linethickness#;
196 crook_thin := 0.5 linethickness + 0.08 staff_space;
198 lower_brush := 1.5 linethickness;
200 define_pixels ( bulb_diam, thin, thick);
203 % PAT is a compact way to pass the brush shape to the routine.
206 def draw_rest_bulb(expr ycenter, ycut, pat, stretch) =
209 z1l = point 0 of pat;
210 z2l = point 1 of pat;
211 z2r = point 3 of pat;
212 z1r = point 4 of pat;
216 z10 = whatever[z2, z1] + left*bulb_diam*stretch;
219 z3 = z10+bulb_diam/2.15*dir(-72) ;
220 z5 = z10 + up*bulb_diam/2 + right*linethickness/3;
222 z7 = 0.5 [z4, z5] + crook_thin * (0.45 ,0.4 ) / 1.3;
223 x8 = x10-0.4bulb_diam;
224 y8 = y10 + 0.25 linethickness;
226 z6 = whatever [z1l, z2l];
227 z6 = z3 + whatever * dir(12);
229 z4 = z3 + whatever * (z6-z3)
230 + 1.1 crook_thin *(unitvector (z6 -z3) rotated 90);
231 x4 = x10+bulb_diam*.62 ;
234 (pt,whatever) = pat intersectiontimes ((0,ycut)--(w,ycut));
236 fill point pt of pat {-direction pt of pat} .. tension 2
237 .. z4{left} .. tension 0.9 .. z7
238 .. z5{left} .. z8 .. z3{right}
239 .. {curl 0.2} z6 {right} .. tension 10 .. {left} point pt of pat -- cycle;
241 labels(3, 4, 5, 6, 7, 8, 9, 10, 11);
246 def draw_eighth_rest =
253 width# := 1.0 staff_space#;
255 define_pixels (width);
256 set_char_box (0, width#,
257 1.0 staff_space# + 0.5 linethickness#, 0.5 staff_space# + bulb_diam#/2);
263 y2 = h - lower_brush;
265 z2 = z1 + whatever*dir(72);
266 z9 = z2 + 0.5 linethickness * dir (angle(z2 - z1)- 10);
267 pat = z1l --- z2l .. z9 .. z2r --- simple_serif (z1r, z1l, -40) .. cycle;
271 draw_rest_bulb (0.5 staff_space , y2r , pat , 1.0);
275 % draw_staff (-2,2,0.0);
279 fet_beginchar("Classical quarter rest","2classical","clasquartrest");
281 currentpicture := currentpicture xscaled -1 shifted (w,0);
284 fet_beginchar("8th rest","3","eighthrest");
290 % TODO: the X dimensions of the rests are fucked up:
291 % they can collide with augmentation dots.
294 fet_beginchar("16th rest","4","sixteenthrest");
301 width# := 1.2 staff_space#;
303 define_pixels (width);
304 set_char_box (0, width#,
305 2.0 staff_space# + 0.5 linethickness#, 0.5 staff_space# + bulb_diam#/2);
310 y1 = -2 staff_space ;
311 y2 = h - lower_brush;
313 z2 = z1 + whatever*dir(74);
314 z9 = z2 + 0.5 linethickness * dir (angle(z2 - z1)- 10);
315 pat = z1l --- z2l .. z9 .. z2r --- simple_serif (z1r, z1l, -40) .. cycle;
319 draw_rest_bulb(0.5 staff_space , y2r , pat , 0.98);
320 draw_rest_bulb(-0.5 staff_space , (-0.5+0.2)*staff_space , pat , 1.02);
324 % draw_staff (-2,2,0.0);
327 fet_beginchar("32th rest","5","thirtysecondrest");
334 width# := 1.3 staff_space#;
336 define_pixels (width);
337 set_char_box (0, width#,
338 2.0 staff_space# + 0.5 linethickness#, 1.5 staff_space# + bulb_diam#/2);
343 y1 = -2 staff_space ;
344 y2 = h - lower_brush;
346 z2 = z1 + whatever*dir(76);
347 z9 = z2 + 0.5 linethickness * dir (angle(z2 - z1)- 10);
348 pat = z1l --- z2l .. z9 .. z2r --- simple_serif (z1r, z1l, -40) .. cycle;
352 draw_rest_bulb(1.5 staff_space , y2r , pat , 0.96);
353 draw_rest_bulb(0.5 staff_space , (0.5+0.2)*staff_space , pat , 1.00);
354 draw_rest_bulb(-0.5 staff_space , (-0.5+0.21)*staff_space , pat , 1.04);
358 % draw_staff (-2,2,0.0);
361 fet_beginchar("64th rest","6","sixtyfourthrest");
368 width# := 1.4 staff_space#;
370 define_pixels (width);
371 set_char_box (0, width#,
372 3.0 staff_space# + 0.5 linethickness#, 1.5 staff_space# + bulb_diam#/2);
377 y1 = -3 staff_space ;
378 y2 = h - lower_brush;
380 z2 = z1 + whatever*dir(78);
381 z9 = z2 + 0.5 linethickness * dir (angle(z2 - z1)- 10);
382 pat = z1l --- z2l .. z9 .. z2r --- simple_serif (z1r, z1l, -40) .. cycle;
386 draw_rest_bulb(1.5 staff_space , y2r , pat , 0.94);
387 draw_rest_bulb(0.5 staff_space , (0.5+0.20)*staff_space , pat , 0.98);
388 draw_rest_bulb(-0.5 staff_space , (-0.5+0.21)*staff_space , pat , 1.02);
389 draw_rest_bulb(-1.5 staff_space , (-1.5+0.22)*staff_space , pat , 1.06);
393 % draw_staff (-2,2,0.0);
396 fet_beginchar("128th rest","7","hundredtwentyeighthrest");
403 width# = 1.5 staff_space#;
405 define_pixels (width);
406 set_char_box (0, width#,
407 3.0 staff_space# + 0.5 linethickness#, 2.5 staff_space# + bulb_diam#/2);
412 y1 = -3 staff_space ;
413 y2 = h - lower_brush;
415 z2 = z1 + whatever*dir(80);
416 z9 = z2 + 0.5 linethickness * dir (angle(z2 - z1)- 10);
417 pat = z1l --- z2l .. z9 .. z2r --- simple_serif (z1r, z1l, -40) .. cycle;
421 draw_rest_bulb(2.5 staff_space , y2r , pat , 0.92);
422 draw_rest_bulb(1.5 staff_space , (1.5+0.20)*staff_space , pat , 0.96);
423 draw_rest_bulb(0.5 staff_space , (0.5+0.21)*staff_space , pat , 1.0);
424 draw_rest_bulb(-0.5 staff_space , (-0.5+0.22)*staff_space , pat , 1.04);
425 draw_rest_bulb(-1.5 staff_space , (-1.5+0.23)*staff_space , pat , 1.08);
429 % draw_staff (-2,2,0.0);
435 fet_endgroup("rests")