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 block_rest_y# = 5/8 staff_space#;
42 block_rest_x# = 3/2 staff_space#;
44 define_pixels(block_rest_y, block_rest_x);
47 draw_block ((0,0), (block_rest_x, block_rest_y));
50 fet_beginchar( "whole rest", "0", "wholerest");
51 set_char_box(0, block_rest_x#,
54 currentpicture := currentpicture shifted (0,- block_rest_y);
57 fet_beginchar("half rest", "1", "halfrest");
58 set_char_box(0, block_rest_x#, 0, block_rest_y#);
64 % should use ledgerline thickness?
66 fet_beginchar( "whole rest (outside staff)", "0o", "outsidewholerest");
67 set_char_box(0, block_rest_x#,
68 block_rest_y#, ledgerlinethickness#/2);
70 currentpicture := currentpicture shifted (0, - block_rest_y);
71 pickup pencircle scaled ledgerlinethickness;
74 lft x5 = - b - block_rest_y;
75 rt x6 = w + block_rest_y;
76 draw_gridline(z5,z6,ledgerlinethickness);
79 fet_beginchar("half rest (outside staff)", "1o", "outsidehalfrest");
80 set_char_box(0, block_rest_x#,
81 ledgerlinethickness#/2, block_rest_y#);
83 pickup pencircle scaled ledgerlinethickness;
85 lft x5 = - b - block_rest_y ;
86 rt x6 = w + block_rest_y;
87 draw_gridline (z5,z6,ledgerlinethickness);
91 save breve_rest_y, breve_rest_x;
93 breve_rest_y# = staff_space#;
94 breve_rest_x# = 3/5 staff_space#;
95 multi_rest_x# = 4 staff_space#;
96 multi_beam_height# = 1/3 staff_space#;
98 define_pixels(breve_rest_y, breve_rest_x, multi_rest_x, multi_beam_height);
100 fet_beginchar("breve rest", "-1", "breverest");
101 set_char_box(0, breve_rest_x#, 0, breve_rest_y#);
102 draw_block ((0,0), (breve_rest_x, breve_rest_y));
105 fet_beginchar("longa rest", "-2", "longarest");
106 set_char_box(0, breve_rest_x#, breve_rest_y#, breve_rest_y#);
107 draw_block ((0,-breve_rest_y), (breve_rest_x, breve_rest_y));
110 tracingvariables := 1;
112 fet_beginchar("multi rest", "-4", "multirest");
113 set_char_box(multi_rest_x#, multi_rest_x#,
114 breve_rest_y#, breve_rest_y#);
115 draw_block ((- b, - multi_beam_height),
116 (w, multi_beam_height));
117 draw_block ((- b,-breve_rest_y),
118 (rthin - b, breve_rest_y));
119 draw_block ((w - rthin,-breve_rest_y),
123 fet_beginchar("Quarter rest","2","quartrest");
124 % draw_staff (-2, 2, 0.0);
125 save alpha, yshift, height;
127 yshift# = -1.25 staff_space#;
128 height# = 2.8125 staff_space#;
129 define_pixels (yshift, height);
132 set_char_box(0, 27/25staff_space#,
136 save ne,nw,se,sw; pair ne,nw,se,sw;
138 se=dir alpha; nw=dir (alpha+180);
139 ne=dir (alpha+90); sw=dir (alpha-90);
140 penpos1(rthin,alpha+90);
141 penpos2(5/4rthick,alpha);
142 penpos4(5/4rthick,alpha);
143 penpos5(rthin,alpha+90);
144 penpos3(3/4rthick,alpha);
145 % penpos6(5/8rthick,alpha);
146 penpos6(2/3rthick,alpha);
147 penpos7(1/2rthin,alpha+90);
150 % z11=z4l+1/2rthin*sw;
151 z11=z4l+1/2rthin*sw+1/2rthin*se;
153 % z13=z2r+1/2rthin*ne;
154 z13=z2r+1/2rthin*ne+1/2rthin*nw;
158 z2r=z1+staff_space*se;
162 z5=z4l+1.3staff_space*se;
168 fill z1l{se}..{se}z10..z3l..z11{se}..{se}z5l..z5r{nw}..{nw}z12..z3r..z13{nw}..{nw}z1r.. cycle;
169 fill z5r{nw}..tension1.4..z6l..tension1.4..{se}z7l..z7r{nw}..tension1.4..z6r..tension1.4..{se}z5l..cycle;
170 penlabels(1,2,3,4,5,6,7);
171 penlabels(10,11,12,13);
173 % 3/4 staff_space# + yshift#,
174 % 18/5staff_space# + yshift#)
178 def rest_crook(expr a, w) =
179 balled_crook(a, w, ball_crook_balldiam, ball_crook_stem)
184 % todo: document rest.
188 def draw_eighth_rest =
189 save width, bulb_diam, thin, thick;
190 save ycenter, crook_thick;
195 width# := 1.0 staff_space#;
196 bulb_diam# := 0.6 staff_space#;
197 thin# := 1.0 stafflinethickness#;
198 thick# := 2.0 stafflinethickness#;
199 crook_thick# := 1.6 stafflinethickness#;
201 ycenter := 0.5 staff_space;
203 define_pixels (width, bulb_diam, thin, thick, crook_thick);
204 set_char_box (0, width#,
205 1.0 staff_space# + 0.5 stafflinethickness#, 0.5 staff_space# + bulb_diam#/2);
210 y1 = ycenter + - 1.5 staff_space ;
211 y2 = y5 - 2.0 stafflinethickness;
214 y3 - y2l = 0.25 staff_space;
215 x2r - x1 = 0.5 staff_space;
218 y3 := ycenter +floor (- bulb_diam/2);
220 x4 = 1.02 bulb_diam ;
221 y4 = ycenter - stafflinethickness;
224 y5 = ycenter +bulb_diam/2;
226 crook_dir = (z2l - z4) / length(z2l - z4);
228 z6 = whatever [z1l, z2l];
229 z6 = whatever [z2l, z4] + crook_thick * (crook_dir rotated -90);
231 z7 = (bulb_diam/2,ycenter) + 0.26 staff_space * dir ( 35);
234 z9 = z2 + 0.46 stafflinethickness * dir (angle(z2 - z1)- 10);
237 labels(3, 4, 5, 6, 7, 8, 9);
239 fill z2r -- z2l -- simple_serif (z1l, z1r, 40) -- cycle;
240 fill z2r{z2r-z1r} .. z9 .. z2l{dir(232)} .. tension 2
241 .. z4{left} .. z7{dir(90 + 25)}
242 .. z5{left} .. z8 .. z3{right}
243 .. {curl 0.2}z6 -- cycle;
248 fet_beginchar("8th rest","3","eighthrest");
252 fet_beginchar("Classical quarter rest","2classical","clasquartrest");
254 currentpicture := currentpicture xscaled -1 shifted (w,0);
258 fet_beginchar("16th rest","4","sixteenthrest");
259 % draw_staff (-2, 2, 0.0);
260 save yshift, ballcorrection;
261 ballcorrection = 0.005 staff_space;
263 yshift# := - 2 staff_space#;
264 define_pixels(yshift);
266 save alpha,cw,h,w, height;
269 height# = 5/3staff_space#+staff_space#+7/4stafflinethickness#;
270 set_char_box(0, cw#+(height#-3/2staff_space#)/tand(alpha),
271 -yshift#, height# + yshift#);
276 y1 = yshift + 2.5 staff_space + flare/4 + ballcorrection;
278 z2-z1=whatever*dir alpha;
280 brush(z1,2/3stem,z2,stem);
282 z3-z1=whatever*dir alpha;
288 fet_beginchar("32th rest","5","thirtysecondrest");
289 % draw_staff (-2, 2, 0.0);
290 save yshift, ballcorrection;
291 ballcorrection = 0.005 staff_space;
293 yshift# := -2 staff_space#;
294 define_pixels(yshift);
299 h#=5/3staff_space#+2staff_space#+7/4stafflinethickness#;
301 set_char_box(0, cw#+(h#-3/2staff_space#)/tand(alpha),
302 -yshift#,yshift# +h#);
306 y1 = yshift + 3.5 staff_space + flare/4 + ballcorrection;
308 z2-z1=whatever*dir alpha;
310 brush(z1,2/3stem,z2,stem);
312 z3-z1=whatever*dir alpha;
315 z4-z1=whatever*dir alpha;
320 fet_beginchar("64th rest","6","sixtyfourthrest");
321 % draw_staff (-2, 2, 0.0);
322 save yshift, ballcorrection;
323 ballcorrection = 0.005 staff_space;
325 yshift# := -3 staff_space#;
326 define_pixels(yshift);
331 h#=5/3staff_space#+3staff_space#+7/4stafflinethickness#;
332 w#=cw#+(h#-3/2staff_space#)/tand(alpha);
333 set_char_box(0,w#,-yshift# ,yshift# + h#);
339 y1 = yshift + 4.5 staff_space + flare/4 + ballcorrection;
341 z2-z1=whatever*dir alpha;
343 brush (z1,2/3stem,z2,stem);
345 z3-z1=whatever*dir alpha;
348 z4-z1=whatever*dir alpha;
351 z5-z1=whatever*dir alpha;
357 fet_beginchar("128th rest","7","hundredtwentyeighthrest");
358 % draw_staff (-2, 2, 0.0);
359 save yshift, ballcorrection;
360 ballcorrection = 0.005 staff_space;
362 yshift# := -3 staff_space#;
363 define_pixels(yshift);
367 h#=5/3staff_space#+4staff_space#+7/4stafflinethickness#;
368 w#=cw#+(h#-3/2staff_space#)/tand(alpha);
369 set_char_box(0,w#, -yshift#,yshift# + h#);
373 y1 = yshift + 5.5 staff_space + flare/4 + ballcorrection;
375 z2-z1=whatever*dir alpha;
377 brush (z1,2/3stem,z2,stem);
379 z3-z1=whatever*dir alpha;
382 z4-z1=whatever*dir alpha;
385 z5-z1=whatever*dir alpha;
388 z6-z1=whatever*dir alpha;
407 % Neo-mensural longa and breve are identical with default longa and breve.
409 neomens_block_rest_x# = 2/5 staff_space#;
410 neomens_block_rest_y# = 1/1 staff_space#;
411 neomens_half_block_rest_y# = 5/8 staff_space#;
413 define_pixels(neomens_block_rest_x,
414 neomens_block_rest_y, neomens_half_block_rest_y);
416 def neomens_half_block_rest =
417 draw_block ((0,0), (neomens_block_rest_x, neomens_half_block_rest_y));
420 fet_beginchar("Neo-mensural longa rest", "-2neo_mensural", "neomenslongarest");
421 set_char_box(0, neomens_block_rest_x#,
422 neomens_block_rest_y#, neomens_block_rest_y#);
423 draw_block ((0,-neomens_block_rest_y),
424 (neomens_block_rest_x, neomens_block_rest_y));
427 fet_beginchar("Neo-mensural breve rest", "-1neo_mensural", "neomensbreverest");
428 set_char_box(0, neomens_block_rest_x#,
429 0, neomens_block_rest_y#);
430 draw_block ((0,0), (neomens_block_rest_x, neomens_block_rest_y));
433 fet_beginchar("Neo-mensural whole rest", "0neo_mensural", "neomenssemibrevisrest");
434 set_char_box(0, neomens_block_rest_x#,
435 neomens_half_block_rest_y#, 0);
436 neomens_half_block_rest;
438 currentpicture shifted (0,- neomens_half_block_rest_y);
441 fet_beginchar("Neo-mensural half rest", "1neo_mensural", "neomensminimahalfrest");
442 set_char_box(0, neomens_block_rest_x#,
443 0, neomens_half_block_rest_y#);
444 neomens_half_block_rest;
447 neomensrestsize# = .8staff_space#;
449 fet_beginchar("Neo-mensural 4th rest","2neo_mensural","neomenssemiminimarest")
450 set_char_box(0,neomensrestsize#,0,neomensrestsize#);
451 pickup pencircle scaled 2 stafflinethickness;
462 fet_beginchar("Neo-mensural 8th rest","3neo_mensural","neomensfusarest")
463 set_char_box(0,neomensrestsize#,0,neomensrestsize#);
464 pickup pencircle scaled 2 stafflinethickness;
475 fet_beginchar("Neo-mensural 16th rest","4neo_mensural","neomenssemifusarest")
476 set_char_box(0,neomensrestsize#,0,staff_space#);
477 pickup pencircle scaled 2 stafflinethickness;
485 pickup pencircle scaled 2 stafflinethickness;
500 fet_endgroup("rests")