1 % Feta (not the Font-En-Tja) music font -- rest symbols -*-Fundamental-*-
2 % This file is part of LilyPond, the GNU music typesetter.
4 % Copyright (C) 1997--2012 Jan Nieuwenhuizen <janneke@gnu.org>
6 % The LilyPond font is free software: you can redistribute it and/or modify
7 % it under the terms of the GNU General Public License as published by
8 % the Free Software Foundation, either version 3 of the License, or
9 % (at your option) any later version, or under the SIL Open Font License.
11 % LilyPond is distributed in the hope that it will be useful,
12 % but WITHOUT ANY WARRANTY; without even the implied warranty of
13 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 % GNU General Public License for more details.
16 % You should have received a copy of the GNU General Public License
17 % along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
19 fet_begingroup ("rests");
21 save block_rest_y, block_rest_x;
22 save breve_rest_y, breve_rest_x;
24 breve_rest_y# = staff_space#;
25 breve_rest_x# = 3/5 staff_space#;
26 block_rest_y# = 5/8 staff_space#;
27 block_rest_x# = 3/2 staff_space#;
29 define_whole_pixels (block_rest_y, block_rest_x);
30 define_whole_pixels (breve_rest_y, breve_rest_x);
34 draw_block ((0, 0), (block_rest_x, block_rest_y));
38 fet_beginchar ("whole rest", "0");
39 set_char_box (0, block_rest_x#,
43 currentpicture := currentpicture
44 shifted (0, -block_rest_y + feta_space_shift);
46 draw_staff (-2, 2, 0);
50 fet_beginchar ("half rest", "1");
51 set_char_box (0, block_rest_x#, 0, block_rest_y#);
55 draw_staff (-2, 2, 0);
60 % should use ledgerline thickness?
62 fet_beginchar ("whole rest (outside staff)", "0o");
63 set_char_box (0, block_rest_x#,
64 block_rest_y#, ledgerlinethickness# / 2);
67 currentpicture := currentpicture shifted (0, -block_rest_y);
69 pickup pencircle scaled ledgerlinethickness;
72 lft x5 = -b - block_rest_y;
73 rt x6 = w + block_rest_y;
74 draw_gridline (z5, z6, ledgerlinethickness_rounded);
76 draw_staff (-2, 2, -3);
80 fet_beginchar ("half rest (outside staff)", "1o");
81 set_char_box (0, block_rest_x#,
82 ledgerlinethickness# / 2, block_rest_y#);
86 pickup pencircle scaled ledgerlinethickness;
89 lft x5 = -b - block_rest_y;
90 rt x6 = w + block_rest_y;
92 draw_gridline (z5, z6, ledgerlinethickness_rounded);
94 draw_staff (-2, 2, 3);
98 fet_beginchar ("maxima rest", "M3");
99 set_char_box (0, 3 breve_rest_x#, breve_rest_y#, breve_rest_y#);
101 draw_block ((0, -breve_rest_y + feta_shift),
102 (breve_rest_x, breve_rest_y));
104 addto currentpicture also currentpicture shifted (2 breve_rest_x, 0);
106 draw_staff (-2, 2, 0);
110 fet_beginchar ("longa rest", "M2");
111 set_char_box (0, breve_rest_x#, breve_rest_y#, breve_rest_y#);
113 draw_block ((0, -breve_rest_y + feta_shift),
114 (breve_rest_x, breve_rest_y));
116 draw_staff (-2, 2, 0);
120 fet_beginchar ("breve rest", "M1");
121 set_char_box (0, breve_rest_x#, 0, breve_rest_y#);
123 draw_block ((0, 0), (breve_rest_x, breve_rest_y));
125 draw_staff (-2, 2, 0);
128 fet_beginchar ("breve rest (outside staff)", "M1o");
129 set_char_box (0, breve_rest_x#,
130 ledgerlinethickness# / 2, breve_rest_y#);
132 draw_block ((0, 0), (breve_rest_x, breve_rest_y));
134 pickup pencircle scaled ledgerlinethickness;
136 y5 = y6 = breve_rest_y;
137 lft x5 = -b - breve_rest_y / 2;
138 rt x6 = w + breve_rest_y / 2;
140 draw_gridline (z5, z6, ledgerlinethickness_rounded);
141 draw_gridline ((x5, 0), (x6, 0), ledgerlinethickness_rounded);
143 draw_staff (-2, 2, 3);
147 fet_beginchar ("Quarter rest", "2");
148 save alpha, yshift, height;
151 yshift# := -1.25 staff_space#;
152 height# := 2.8125 staff_space#;
153 define_pixels (yshift, height);
156 thick := 1/4 staff_space;
157 rthin := 1.25 linethickness;
158 xcenter := -0.1 staff_space;
159 rthick := 2 thick + rthin;
161 set_char_box (0, 0.95 staff_space#, -yshift#, yshift# + height#);
167 ne = dir (alpha + 90);
168 nw = dir (alpha + 180);
169 sw = dir (alpha + 270);
171 penpos1 (rthin, alpha + 90);
172 penpos2 (5/4 rthick, alpha);
173 penpos4 (5/4 rthick, alpha);
174 penpos5 (rthin, alpha + 90);
175 penpos3 (3/4 rthick, alpha);
176 % penpos6 (5/8 rthick, alpha);
177 penpos6 (2/3 rthick, alpha);
178 penpos7 (1/2 rthin, alpha + 90);
180 z10 = z2l + 1/2 rthin * sw;
181 % z11 = z4l + 1/2 rthin * sw;
182 z11 = z4l + 1/2 rthin * sw + 1/2 rthin * se;
183 z12 = z4r + 1/2 rthin * ne;
184 % z13 = z2r + 1/2 rthin * ne;
185 z13 = z2r + 1/2 rthin * ne + 1/2 rthin * nw;
188 x1l = xcenter + 1/3 staff_space;
189 z2r = z1 + staff_space * se;
191 x4 = xcenter + 3/8 staff_space;
194 z5 = round (z4l + 1.3 staff_space * se) + feta_offset;
197 x6r := hround x6r + xpart feta_offset;
198 y6r := vround y6r + ypart feta_offset;
199 x7 = hround (xcenter + 2/5 staff_space) + xpart feta_offset;
208 (u, v) = before intersectiontimes after;
213 .. subpath (0, u) of before
214 .. subpath (v, infinity) of after
215 ..tension1.4.. {se}z7l
218 ..tension1.4.. {se}z5l
226 penlabels (1, 2, 3, 4, 5, 6, 7);
227 penlabels (10, 11, 12, 13);
229 draw_staff (-2, 2, 0);
234 % Notes about 8th rest:
236 % * 8th rest should be no wider than the black note head
238 % * The inside corner of the horizontal portion is usually a little blotted.
240 % * The top of the crook chops off the vertical brush
242 % * The crook widens a little
244 % * The bottom of the brush is slightly flat, as it has to align with
245 % stafflines if it is inside the staff.
247 % * The top of the brush usually is a little lower than the top of bulb.
249 % * The bulb can vary. Sometimes it is open (like in the clefs). Sometimes
250 % it is closed, or even a flare.
253 % from an email to Rune Zedeler:
256 % For example, the 8th rest was vaguely based on a book with trumpet
257 % studies by Duhem, and by Baerenreiters cello suites. I included my
258 % findings in a comment in the mf file. One of the things that I tried
259 % to do was make the rest a little lighter and narrower than the black
260 % note head. I think this looks better in polyphonic music, when the
261 % rest is below a head from a different voice.
264 save bulb_diam, thin, thick;
266 bulb_diam# := 0.64 staff_space#;
267 thin# := 1.4 linethickness# - 0.02 staff_space#;
268 thick# := 2.2 linethickness#;
270 crook_thin := 0.5 linethickness + 0.08 staff_space;
271 lower_brush := 1.5 linethickness;
273 define_pixels (bulb_diam);
274 define_whole_blacker_pixels (thin, thick);
278 % PAT is a compact way to pass the brush shape to the routine.
281 def draw_rest_bulb (expr ycenter, ycut, pat, stretch, show_labels) =
285 z1l = point 0 of pat;
286 z2l = point 1 of pat;
287 z2r = point 3 of pat;
288 z1r = point 4 of pat;
292 z10 = whatever [z2, z1] + left * bulb_diam * stretch;
294 % this enforces similar bulb shapes for lower resolutions
297 z3 = z10 + bulb_diam / 2.15 * dir (-72);
299 z5 = z10 + up * bulb_diam / 2 + right * linethickness / 3;
302 z7 = 0.5 [z4, z5] + crook_thin * (0.45, 0.4) / 1.3;
303 x8 = hround (x10 - 0.4 bulb_diam);
304 y8 = y10 + 0.25 linethickness;
306 z6 = whatever [z1l, z2l];
307 z6 = z3 + whatever * dir (12);
309 z4 = z3 + whatever * (z6 - z3)
310 + 1.1 crook_thin * (unitvector (z6 - z3) rotated 90);
311 x4 = x10 + bulb_diam * .62;
314 (pt, whatever) = pat intersectiontimes ((0, ycut) -- (w, ycut));
317 res = point pt of pat {-direction pt of pat}
318 ..tension 2.. z4{left}
326 labels (3, 4, 5, 6, 7, 8, 10);
334 def draw_eighth_rest (expr show_labels) =
339 set_char_box (0, 1.0 staff_space#,
340 1.0 staff_space# + 0.5 linethickness#,
341 0.5 staff_space# + bulb_diam# / 2);
346 y1 = -staff_space_rounded;
347 y2 = h - vround lower_brush;
349 z2 = z1 + whatever * dir (72);
350 z9 = z2 + 0.5 linethickness * dir (angle (z2 - z1) - 10);
368 bulb = draw_rest_bulb (0.5 staff_space, y2r, pat, 1.0, show_labels);
370 fill simple_serif (z1l, z1r, 40)
377 draw_staff (-2, 2, 0);
381 fet_beginchar ("Classical quarter rest", "2classical");
382 draw_eighth_rest (0);
383 currentpicture := currentpicture xscaled -1 shifted (w, 0);
387 fet_beginchar ("8th rest", "3");
388 draw_eighth_rest (1);
393 % TODO: the X dimensions of the rests are fucked up:
394 % they can collide with augmentation dots.
397 fet_beginchar ("16th rest", "4");
399 save pat, bulb_a, bulb_b;
400 path pat, bulb_a, bulb_b;
402 set_char_box (0, 1.2 staff_space#,
403 2.0 staff_space# + 0.5 linethickness#,
404 0.5 staff_space# + bulb_diam# / 2);
409 y1 = -2 staff_space_rounded;
410 y2 = h - vround lower_brush;
412 z2 = z1 + whatever * dir (74);
413 z9 = z2 + 0.5 linethickness * dir (angle (z2 - z1) - 10);
426 bulb_a = draw_rest_bulb (.5 staff_space,
428 bulb_b = draw_rest_bulb (.5 staff_space - staff_space_rounded,
429 hround ((-0.5 + 0.2) * staff_space),
432 fill simple_serif (z1l, z1r, 40)
443 draw_staff (-2, 2, 0);
447 fet_beginchar ("32th rest", "5");
449 save pat, bulb_a, bulb_b, bulb_c;
450 path pat, bulb_a, bulb_b, bulb_c;
452 set_char_box (0, 1.3 staff_space#,
453 2.0 staff_space# + 0.5 linethickness#,
454 1.5 staff_space# + bulb_diam# / 2);
459 y1 = -2 staff_space_rounded;
460 y2 = h - vround lower_brush;
462 z2 = z1 + whatever * dir (76);
463 z9 = z2 + 0.5 linethickness * dir (angle (z2 - z1) - 10);
476 bulb_a = draw_rest_bulb (.5 staff_space + staff_space_rounded,
478 bulb_b = draw_rest_bulb (.5 staff_space,
479 hround ((0.5 + 0.2) * staff_space),
481 bulb_c = draw_rest_bulb (.5 staff_space - staff_space_rounded,
482 hround ((-0.5 + 0.21) * staff_space),
485 fill simple_serif (z1l, z1r, 40)
497 draw_staff (-2, 2, 0);
501 fet_beginchar ("64th rest", "6");
503 save pat, bulb_a, bulb_b, bulb_c, bulb_d;
504 path pat, bulb_a, bulb_b, bulb_c, bulb_d;
506 set_char_box (0, 1.4 staff_space#,
507 3.0 staff_space# + 0.5 linethickness#,
508 1.5 staff_space# + bulb_diam# / 2);
513 y1 = -3 staff_space_rounded;
514 y2 = h - vround lower_brush;
516 z2 = z1 + whatever * dir (78);
517 z9 = z2 + 0.5 linethickness * dir (angle (z2 - z1) - 10);
530 bulb_a = draw_rest_bulb (.5 staff_space + staff_space_rounded,
532 bulb_b = draw_rest_bulb (.5 staff_space,
533 hround ((0.5 + 0.20) * staff_space),
535 bulb_c = draw_rest_bulb (.5 staff_space - staff_space_rounded,
536 hround ((-0.5 + 0.21) * staff_space),
538 bulb_d = draw_rest_bulb (.5 staff_space - 2 staff_space_rounded,
539 hround ((-1.5 + 0.22) * staff_space),
542 fill simple_serif (z1l, z1r, 40)
555 draw_staff (-2, 2, 0);
559 fet_beginchar ("128th rest", "7");
561 save pat, bulb_a, bulb_b, bulb_c, bulb_d, bulb_e;
562 path pat, bulb_a, bulb_b, bulb_c, bulb_d, bulb_e;
564 set_char_box (0, 1.5 staff_space#,
565 3.0 staff_space# + 0.5 linethickness#,
566 2.5 staff_space# + bulb_diam# / 2);
571 y1 = -3 staff_space_rounded;
572 y2 = h - vround lower_brush;
574 z2 = z1 + whatever * dir (80);
575 z9 = z2 + 0.5 linethickness * dir (angle (z2 - z1)- 10);
588 bulb_a = draw_rest_bulb (.5 staff_space + 2 staff_space_rounded,
590 bulb_b = draw_rest_bulb (.5 staff_space + staff_space_rounded,
591 hround ((1.5 + 0.20) * staff_space),
593 bulb_c = draw_rest_bulb (.5 staff_space,
594 hround ((0.5 + 0.21) * staff_space),
596 bulb_d = draw_rest_bulb (.5 staff_space - staff_space_rounded,
597 hround ((-0.5 + 0.22) * staff_space),
599 bulb_e = draw_rest_bulb (.5 staff_space - 2 staff_space_rounded,
600 hround ((-1.5 + 0.23) * staff_space),
603 fill simple_serif (z1l, z1r, 40)
617 draw_staff (-2, 2, 0);
621 fet_endgroup ("rests");