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;
225 y3 - y2l = 0.25 staff_space;
226 x2r - x1 = 0.5 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);
241 z8 = (0, ycenter + 0.5 stafflinethickness);
243 z6 = whatever [z1l, z2l];
244 z6 = whatever [z2l, z4] + crook_thick * (crook_dir rotated -90);
245 crook_dir = normalize(z2l - z4);
247 y3 := ycenter +floor (- bulb_diam/2);
251 labels(3, 4, 5, 6, 7, 8, 9);
253 fill z2r -- z2l -- simple_serif (z1l, z1r, 40) -- cycle;
254 fill z2r{z2r-z1r} .. z9 .. z2l{dir(232)} .. tension 2
255 .. z4{left} .. tension 0.9 .. z7 %{dir(90 + 25)}
256 .. z5{left} .. z8 .. z3{right}
257 .. {curl 0.2}z6 -- cycle;
262 fet_beginchar("8th rest","3","eighthrest");
266 fet_beginchar("Classical quarter rest","2classical","clasquartrest");
268 currentpicture := currentpicture xscaled -1 shifted (w,0);
272 fet_beginchar("16th rest","4","sixteenthrest");
273 % draw_staff (-2, 2, 0.0);
274 save yshift, ballcorrection;
275 ballcorrection = 0.005 staff_space;
277 yshift# := - 2 staff_space#;
278 define_pixels(yshift);
280 save alpha,cw,h,w, height;
283 height# = 5/3staff_space#+staff_space#+7/4stafflinethickness#;
284 set_char_box(0, cw#+(height#-3/2staff_space#)/tand(alpha),
285 -yshift#, height# + yshift#);
290 y1 = yshift + 2.5 staff_space + flare/4 + ballcorrection;
292 z2-z1=whatever*dir alpha;
294 brush(z1,2/3stem,z2,stem);
296 z3-z1=whatever*dir alpha;
302 fet_beginchar("32th rest","5","thirtysecondrest");
303 % draw_staff (-2, 2, 0.0);
304 save yshift, ballcorrection;
305 ballcorrection = 0.005 staff_space;
307 yshift# := -2 staff_space#;
308 define_pixels(yshift);
313 h#=5/3staff_space#+2staff_space#+7/4stafflinethickness#;
315 set_char_box(0, cw#+(h#-3/2staff_space#)/tand(alpha),
316 -yshift#,yshift# +h#);
320 y1 = yshift + 3.5 staff_space + flare/4 + ballcorrection;
322 z2-z1=whatever*dir alpha;
324 brush(z1,2/3stem,z2,stem);
326 z3-z1=whatever*dir alpha;
329 z4-z1=whatever*dir alpha;
334 fet_beginchar("64th rest","6","sixtyfourthrest");
335 % draw_staff (-2, 2, 0.0);
336 save yshift, ballcorrection;
337 ballcorrection = 0.005 staff_space;
339 yshift# := -3 staff_space#;
340 define_pixels(yshift);
345 h#=5/3staff_space#+3staff_space#+7/4stafflinethickness#;
346 w#=cw#+(h#-3/2staff_space#)/tand(alpha);
347 set_char_box(0,w#,-yshift# ,yshift# + h#);
353 y1 = yshift + 4.5 staff_space + flare/4 + ballcorrection;
355 z2-z1=whatever*dir alpha;
357 brush (z1,2/3stem,z2,stem);
359 z3-z1=whatever*dir alpha;
362 z4-z1=whatever*dir alpha;
365 z5-z1=whatever*dir alpha;
371 fet_beginchar("128th rest","7","hundredtwentyeighthrest");
372 % draw_staff (-2, 2, 0.0);
373 save yshift, ballcorrection;
374 ballcorrection = 0.005 staff_space;
376 yshift# := -3 staff_space#;
377 define_pixels(yshift);
381 h#=5/3staff_space#+4staff_space#+7/4stafflinethickness#;
382 w#=cw#+(h#-3/2staff_space#)/tand(alpha);
383 set_char_box(0,w#, -yshift#,yshift# + h#);
387 y1 = yshift + 5.5 staff_space + flare/4 + ballcorrection;
389 z2-z1=whatever*dir alpha;
391 brush (z1,2/3stem,z2,stem);
393 z3-z1=whatever*dir alpha;
396 z4-z1=whatever*dir alpha;
399 z5-z1=whatever*dir alpha;
402 z6-z1=whatever*dir alpha;
421 % Neo-mensural longa and breve are identical with default longa and breve.
423 neomens_block_rest_x# = 2/5 staff_space#;
424 neomens_block_rest_y# = 1/1 staff_space#;
425 neomens_half_block_rest_y# = 5/8 staff_space#;
427 define_pixels(neomens_block_rest_x,
428 neomens_block_rest_y, neomens_half_block_rest_y);
430 def neomens_half_block_rest =
431 draw_block ((0,0), (neomens_block_rest_x, neomens_half_block_rest_y));
434 fet_beginchar("Neo-mensural maxima rest", "-3neo_mensural", "neomensmaximarest");
435 set_char_box(0, neomens_block_rest_x#,
436 neomens_block_rest_y#, 2 neomens_block_rest_y#);
437 draw_block ((0,-neomens_block_rest_y),
438 (neomens_block_rest_x, 2 neomens_block_rest_y));
441 fet_beginchar("Neo-mensural longa rest", "-2neo_mensural", "neomenslongarest");
442 set_char_box(0, neomens_block_rest_x#,
443 neomens_block_rest_y#, neomens_block_rest_y#);
444 draw_block ((0,-neomens_block_rest_y),
445 (neomens_block_rest_x, neomens_block_rest_y));
448 fet_beginchar("Neo-mensural breve rest", "-1neo_mensural", "neomensbreverest");
449 set_char_box(0, neomens_block_rest_x#,
450 0, neomens_block_rest_y#);
451 draw_block ((0,0), (neomens_block_rest_x, neomens_block_rest_y));
454 fet_beginchar("Neo-mensural whole rest", "0neo_mensural", "neomenssemibrevisrest");
455 set_char_box(0, neomens_block_rest_x#,
456 neomens_half_block_rest_y#, 0);
457 neomens_half_block_rest;
459 currentpicture shifted (0,- neomens_half_block_rest_y);
462 fet_beginchar("Neo-mensural half rest", "1neo_mensural", "neomensminimahalfrest");
463 set_char_box(0, neomens_block_rest_x#,
464 0, neomens_half_block_rest_y#);
465 neomens_half_block_rest;
468 neomensrestsize# = .8staff_space#;
470 fet_beginchar("Neo-mensural 4th rest","2neo_mensural","neomenssemiminimarest")
471 set_char_box(0,neomensrestsize#,0,neomensrestsize#);
472 pickup pencircle scaled 2 stafflinethickness;
483 fet_beginchar("Neo-mensural 8th rest","3neo_mensural","neomensfusarest")
484 set_char_box(0,neomensrestsize#,0,neomensrestsize#);
485 pickup pencircle scaled 2 stafflinethickness;
496 fet_beginchar("Neo-mensural 16th rest","4neo_mensural","neomenssemifusarest")
497 set_char_box(0,neomensrestsize#,0,staff_space#);
498 pickup pencircle scaled 2 stafflinethickness;
506 pickup pencircle scaled 2 stafflinethickness;
521 fet_endgroup("rests")