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--2002 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);
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)));
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)));
109 tracingvariables := 1;
111 fet_beginchar("Quarter rest","2","quartrest");
112 % draw_staff (-2, 2, 0.0);
113 save alpha, yshift, height;
115 yshift# = -1.25 staff_space#;
116 height# = 2.8125 staff_space#;
117 define_pixels (yshift, height);
119 xcenter = -0.1 staff_space;
121 set_char_box(0, 0.95 staff_space#,
125 save ne,nw,se,sw; pair ne,nw,se,sw;
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);
139 % z11=z4l+1/2rthin*sw;
140 z11=z4l+1/2rthin*sw+1/2rthin*se;
142 % z13=z2r+1/2rthin*ne;
143 z13=z2r+1/2rthin*ne+1/2rthin*nw;
146 x1l=xcenter + 1/3staff_space;
147 z2r=z1+staff_space*se;
149 x4= xcenter + 3/8staff_space;
151 z5=z4l+1.3staff_space*se;
154 x7= xcenter + 2/5staff_space;
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);
162 % 3/4 staff_space# + yshift#,
163 % 18/5staff_space# + yshift#)
167 def rest_crook(expr a, w) =
168 balled_crook(a, w, ball_crook_balldiam, ball_crook_stem)
172 % Notes about 8th rest:
174 % * 8th rest should be no wider than the black note head
176 % * The inside corner of the horizontal portion is usually a little blotted.
178 % * The top of the crook chops off the vertical brush
180 % * The crook widens a little
182 % * The bottom of the brush is slightly flat, as it has to align with
183 % stafflines if it is inside the staff.
185 % * The top of the brush usually is a little lower than the top of bulb.
187 % * The bulb can vary. Sometimes it is open (like in the clefs). Sometimes
188 % it is closed, or even a flare.
191 def normalize (expr p) =
195 def draw_eighth_rest =
196 save width, bulb_diam, thin, thick;
197 save ycenter, crook_thick, crook_thin;
198 save crook_dir, lower_brush;
202 width# := 1.0 staff_space#;
203 bulb_diam# := 0.64 staff_space#;
204 thin# := 1.1 stafflinethickness#;
205 thick# := 2.2 stafflinethickness#;
206 crook_thick# := 1.8 stafflinethickness#;
207 crook_thin := 1.3 stafflinethickness;
209 lower_brush = 1.5 stafflinethickness;
210 ycenter := 0.5 staff_space;
212 define_pixels (width, bulb_diam, thin, thick, crook_thick);
213 set_char_box (0, width#,
214 1.0 staff_space# + 0.5 stafflinethickness#, 0.5 staff_space# + bulb_diam#/2);
219 y1 = ycenter + - 1.5 staff_space ;
220 % y9 = y5 - lower_brush;
221 y2 = y5 - lower_brush;
226 x2r - x1 = 0.5 staff_space;
228 x3 = x1l - 0.045 staff_space ;
231 x4 = 1.02 bulb_diam ;
232 y4 := ceiling (ycenter - 2 stafflinethickness + crook_thin);
234 x5 = 0.5 bulb_diam - 0.25 stafflinethickness;
235 y5 = ycenter +bulb_diam/2;
237 z9 = z2 + 0.46 stafflinethickness * dir (angle(z2 - z1)- 10);
239 % z7 = %(bulb_diam/2,ycenter) + 0.23 staff_space * dir ( 35);
240 z7 = 0.5 [z4, z5] + (0.45 stafflinethickness,0.4 stafflinethickness);
242 y8 = ycenter + 0.25 stafflinethickness;
244 z6 = whatever [z1l, z2l];
245 z6 = whatever [z2l, z4] + crook_thick * (crook_dir rotated -90);
246 crook_dir = normalize(z2l - z4);
248 y3 := ycenter +floor (- 0.45 bulb_diam);
252 labels(3, 4, 5, 6, 7, 8, 9);
254 fill z2r -- z2l -- simple_serif (z1l, z1r, 40) -- cycle;
255 fill z2r{z2r-z1r} .. z9 .. z2l{dir(232)} .. tension 2
256 .. z4{left} .. tension 0.9 .. z7 %{dir(90 + 25)}
257 .. z5{left} .. z8 .. z3{right}
258 .. {curl 0.2}z6 -- cycle;
260 % draw_staff (-2,2,0.0);
264 fet_beginchar("8th rest","3","eighthrest");
268 fet_beginchar("Classical quarter rest","2classical","clasquartrest");
270 currentpicture := currentpicture xscaled -1 shifted (w,0);
274 fet_beginchar("16th rest","4","sixteenthrest");
275 % draw_staff (-2, 2, 0.0);
276 save yshift, ballcorrection;
277 ballcorrection = 0.005 staff_space;
279 yshift# := - 2 staff_space#;
280 define_pixels(yshift);
282 save alpha,cw,h,w, height;
285 height# = 5/3staff_space#+staff_space#+7/4stafflinethickness#;
286 set_char_box(0, cw#+(height#-3/2staff_space#)/tand(alpha),
287 -yshift#, height# + yshift#);
292 y1 = yshift + 2.5 staff_space + flare/4 + ballcorrection;
294 z2-z1=whatever*dir alpha;
296 brush(z1,2/3stem,z2,stem);
298 z3-z1=whatever*dir alpha;
304 fet_beginchar("32th rest","5","thirtysecondrest");
305 % draw_staff (-2, 2, 0.0);
306 save yshift, ballcorrection;
307 ballcorrection = 0.005 staff_space;
309 yshift# := -2 staff_space#;
310 define_pixels(yshift);
315 h#=5/3staff_space#+2staff_space#+7/4stafflinethickness#;
317 set_char_box(0, cw#+(h#-3/2staff_space#)/tand(alpha),
318 -yshift#,yshift# +h#);
322 y1 = yshift + 3.5 staff_space + flare/4 + ballcorrection;
324 z2-z1=whatever*dir alpha;
326 brush(z1,2/3stem,z2,stem);
328 z3-z1=whatever*dir alpha;
331 z4-z1=whatever*dir alpha;
336 fet_beginchar("64th rest","6","sixtyfourthrest");
337 % draw_staff (-2, 2, 0.0);
338 save yshift, ballcorrection;
339 ballcorrection = 0.005 staff_space;
341 yshift# := -3 staff_space#;
342 define_pixels(yshift);
347 h#=5/3staff_space#+3staff_space#+7/4stafflinethickness#;
348 w#=cw#+(h#-3/2staff_space#)/tand(alpha);
349 set_char_box(0,w#,-yshift# ,yshift# + h#);
355 y1 = yshift + 4.5 staff_space + flare/4 + ballcorrection;
357 z2-z1=whatever*dir alpha;
359 brush (z1,2/3stem,z2,stem);
361 z3-z1=whatever*dir alpha;
364 z4-z1=whatever*dir alpha;
367 z5-z1=whatever*dir alpha;
373 fet_beginchar("128th rest","7","hundredtwentyeighthrest");
374 % draw_staff (-2, 2, 0.0);
375 save yshift, ballcorrection;
376 ballcorrection = 0.005 staff_space;
378 yshift# := -3 staff_space#;
379 define_pixels(yshift);
383 h#=5/3staff_space#+4staff_space#+7/4stafflinethickness#;
384 w#=cw#+(h#-3/2staff_space#)/tand(alpha);
385 set_char_box(0,w#, -yshift#,yshift# + h#);
389 y1 = yshift + 5.5 staff_space + flare/4 + ballcorrection;
391 z2-z1=whatever*dir alpha;
393 brush (z1,2/3stem,z2,stem);
395 z3-z1=whatever*dir alpha;
398 z4-z1=whatever*dir alpha;
401 z5-z1=whatever*dir alpha;
404 z6-z1=whatever*dir alpha;
423 % Neo-mensural longa and breve are identical with default longa and breve.
425 neomens_block_rest_x# = 2/5 staff_space#;
426 neomens_block_rest_y# = 1/1 staff_space#;
427 neomens_half_block_rest_y# = 5/8 staff_space#;
429 define_pixels(neomens_block_rest_x,
430 neomens_block_rest_y, neomens_half_block_rest_y);
432 def neomens_half_block_rest =
433 draw_block ((0,0), (neomens_block_rest_x, neomens_half_block_rest_y));
436 fet_beginchar("Neo-mensural maxima rest", "-3neo_mensural", "neomensmaximarest");
437 set_char_box(0, neomens_block_rest_x#,
438 neomens_block_rest_y#, 2 neomens_block_rest_y#);
439 draw_block ((0,-neomens_block_rest_y),
440 (neomens_block_rest_x, 2 neomens_block_rest_y));
443 fet_beginchar("Neo-mensural longa rest", "-2neo_mensural", "neomenslongarest");
444 set_char_box(0, neomens_block_rest_x#,
445 neomens_block_rest_y#, neomens_block_rest_y#);
446 draw_block ((0,-neomens_block_rest_y),
447 (neomens_block_rest_x, neomens_block_rest_y));
450 fet_beginchar("Neo-mensural breve rest", "-1neo_mensural", "neomensbreverest");
451 set_char_box(0, neomens_block_rest_x#,
452 0, neomens_block_rest_y#);
453 draw_block ((0,0), (neomens_block_rest_x, neomens_block_rest_y));
456 fet_beginchar("Neo-mensural whole rest", "0neo_mensural", "neomenssemibrevisrest");
457 set_char_box(0, neomens_block_rest_x#,
458 neomens_half_block_rest_y#, 0);
459 neomens_half_block_rest;
461 currentpicture shifted (0,- neomens_half_block_rest_y);
464 fet_beginchar("Neo-mensural half rest", "1neo_mensural", "neomensminimahalfrest");
465 set_char_box(0, neomens_block_rest_x#,
466 0, neomens_half_block_rest_y#);
467 neomens_half_block_rest;
470 neomensrestsize# = .8staff_space#;
472 fet_beginchar("Neo-mensural 4th rest","2neo_mensural","neomenssemiminimarest")
473 set_char_box(0,neomensrestsize#,0,neomensrestsize#);
474 pickup pencircle scaled 2 stafflinethickness;
485 fet_beginchar("Neo-mensural 8th rest","3neo_mensural","neomensfusarest")
486 set_char_box(0,neomensrestsize#,0,neomensrestsize#);
487 pickup pencircle scaled 2 stafflinethickness;
498 fet_beginchar("Neo-mensural 16th rest","4neo_mensural","neomenssemifusarest")
499 set_char_box(0,neomensrestsize#,0,staff_space#);
500 pickup pencircle scaled 2 stafflinethickness;
508 pickup pencircle scaled 2 stafflinethickness;
523 fet_endgroup("rests")