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--2010 Jan Nieuwenhuizen <janneke@gnu.org>
6 % LilyPond 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.
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);
129 fet_beginchar ("Quarter rest", "2");
130 save alpha, yshift, height;
133 yshift# := -1.25 staff_space#;
134 height# := 2.8125 staff_space#;
135 define_pixels (yshift, height);
138 thick := 1/4 staff_space;
139 rthin := 1.25 linethickness;
140 xcenter := -0.1 staff_space;
141 rthick := 2 thick + rthin;
143 set_char_box (0, 0.95 staff_space#, -yshift#, yshift# + height#);
149 ne = dir (alpha + 90);
150 nw = dir (alpha + 180);
151 sw = dir (alpha + 270);
153 penpos1 (rthin, alpha + 90);
154 penpos2 (5/4 rthick, alpha);
155 penpos4 (5/4 rthick, alpha);
156 penpos5 (rthin, alpha + 90);
157 penpos3 (3/4 rthick, alpha);
158 % penpos6 (5/8 rthick, alpha);
159 penpos6 (2/3 rthick, alpha);
160 penpos7 (1/2 rthin, alpha + 90);
162 z10 = z2l + 1/2 rthin * sw;
163 % z11 = z4l + 1/2 rthin * sw;
164 z11 = z4l + 1/2 rthin * sw + 1/2 rthin * se;
165 z12 = z4r + 1/2 rthin * ne;
166 % z13 = z2r + 1/2 rthin * ne;
167 z13 = z2r + 1/2 rthin * ne + 1/2 rthin * nw;
170 x1l = xcenter + 1/3 staff_space;
171 z2r = z1 + staff_space * se;
173 x4 = xcenter + 3/8 staff_space;
176 z5 = round (z4l + 1.3 staff_space * se) + feta_offset;
179 x6r := hround x6r + xpart feta_offset;
180 y6r := vround y6r + ypart feta_offset;
181 x7 = hround (xcenter + 2/5 staff_space) + xpart feta_offset;
190 (u, v) = before intersectiontimes after;
195 .. subpath (0, u) of before
196 .. subpath (v, infinity) of after
197 ..tension1.4.. {se}z7l
200 ..tension1.4.. {se}z5l
208 penlabels (1, 2, 3, 4, 5, 6, 7);
209 penlabels (10, 11, 12, 13);
211 draw_staff (-2, 2, 0);
216 % Notes about 8th rest:
218 % * 8th rest should be no wider than the black note head
220 % * The inside corner of the horizontal portion is usually a little blotted.
222 % * The top of the crook chops off the vertical brush
224 % * The crook widens a little
226 % * The bottom of the brush is slightly flat, as it has to align with
227 % stafflines if it is inside the staff.
229 % * The top of the brush usually is a little lower than the top of bulb.
231 % * The bulb can vary. Sometimes it is open (like in the clefs). Sometimes
232 % it is closed, or even a flare.
235 % from an email to Rune Zedeler:
238 % For example, the 8th rest was vaguely based on a book with trumpet
239 % studies by Duhem, and by Baerenreiters cello suites. I included my
240 % findings in a comment in the mf file. One of the things that I tried
241 % to do was make the rest a little lighter and narrower than the black
242 % note head. I think this looks better in polyphonic music, when the
243 % rest is below a head from a different voice.
246 save bulb_diam, thin, thick;
248 bulb_diam# := 0.64 staff_space#;
249 thin# := 1.4 linethickness# - 0.02 staff_space#;
250 thick# := 2.2 linethickness#;
252 crook_thin := 0.5 linethickness + 0.08 staff_space;
253 lower_brush := 1.5 linethickness;
255 define_pixels (bulb_diam);
256 define_whole_blacker_pixels (thin, thick);
260 % PAT is a compact way to pass the brush shape to the routine.
263 def draw_rest_bulb (expr ycenter, ycut, pat, stretch, show_labels) =
267 z1l = point 0 of pat;
268 z2l = point 1 of pat;
269 z2r = point 3 of pat;
270 z1r = point 4 of pat;
274 z10 = whatever [z2, z1] + left * bulb_diam * stretch;
276 % this enforces similar bulb shapes for lower resolutions
279 z3 = z10 + bulb_diam / 2.15 * dir (-72);
281 z5 = z10 + up * bulb_diam / 2 + right * linethickness / 3;
284 z7 = 0.5 [z4, z5] + crook_thin * (0.45, 0.4) / 1.3;
285 x8 = hround (x10 - 0.4 bulb_diam);
286 y8 = y10 + 0.25 linethickness;
288 z6 = whatever [z1l, z2l];
289 z6 = z3 + whatever * dir (12);
291 z4 = z3 + whatever * (z6 - z3)
292 + 1.1 crook_thin * (unitvector (z6 - z3) rotated 90);
293 x4 = x10 + bulb_diam * .62;
296 (pt, whatever) = pat intersectiontimes ((0, ycut) -- (w, ycut));
299 res = point pt of pat {-direction pt of pat}
300 ..tension 2.. z4{left}
308 labels (3, 4, 5, 6, 7, 8, 10);
316 def draw_eighth_rest (expr show_labels) =
321 set_char_box (0, 1.0 staff_space#,
322 1.0 staff_space# + 0.5 linethickness#,
323 0.5 staff_space# + bulb_diam# / 2);
328 y1 = -staff_space_rounded;
329 y2 = h - vround lower_brush;
331 z2 = z1 + whatever * dir (72);
332 z9 = z2 + 0.5 linethickness * dir (angle (z2 - z1) - 10);
350 bulb = draw_rest_bulb (0.5 staff_space, y2r, pat, 1.0, show_labels);
352 fill simple_serif (z1l, z1r, 40)
359 draw_staff (-2, 2, 0);
363 fet_beginchar ("Classical quarter rest", "2classical");
364 draw_eighth_rest (0);
365 currentpicture := currentpicture xscaled -1 shifted (w, 0);
369 fet_beginchar ("8th rest", "3");
370 draw_eighth_rest (1);
375 % TODO: the X dimensions of the rests are fucked up:
376 % they can collide with augmentation dots.
379 fet_beginchar ("16th rest", "4");
381 save pat, bulb_a, bulb_b;
382 path pat, bulb_a, bulb_b;
384 set_char_box (0, 1.2 staff_space#,
385 2.0 staff_space# + 0.5 linethickness#,
386 0.5 staff_space# + bulb_diam# / 2);
391 y1 = -2 staff_space_rounded;
392 y2 = h - vround lower_brush;
394 z2 = z1 + whatever * dir (74);
395 z9 = z2 + 0.5 linethickness * dir (angle (z2 - z1) - 10);
408 bulb_a = draw_rest_bulb (.5 staff_space,
410 bulb_b = draw_rest_bulb (.5 staff_space - staff_space_rounded,
411 hround ((-0.5 + 0.2) * staff_space),
414 fill simple_serif (z1l, z1r, 40)
425 draw_staff (-2, 2, 0);
429 fet_beginchar ("32th rest", "5");
431 save pat, bulb_a, bulb_b, bulb_c;
432 path pat, bulb_a, bulb_b, bulb_c;
434 set_char_box (0, 1.3 staff_space#,
435 2.0 staff_space# + 0.5 linethickness#,
436 1.5 staff_space# + bulb_diam# / 2);
441 y1 = -2 staff_space_rounded;
442 y2 = h - vround lower_brush;
444 z2 = z1 + whatever * dir (76);
445 z9 = z2 + 0.5 linethickness * dir (angle (z2 - z1) - 10);
458 bulb_a = draw_rest_bulb (.5 staff_space + staff_space_rounded,
460 bulb_b = draw_rest_bulb (.5 staff_space,
461 hround ((0.5 + 0.2) * staff_space),
463 bulb_c = draw_rest_bulb (.5 staff_space - staff_space_rounded,
464 hround ((-0.5 + 0.21) * staff_space),
467 fill simple_serif (z1l, z1r, 40)
479 draw_staff (-2, 2, 0);
483 fet_beginchar ("64th rest", "6");
485 save pat, bulb_a, bulb_b, bulb_c, bulb_d;
486 path pat, bulb_a, bulb_b, bulb_c, bulb_d;
488 set_char_box (0, 1.4 staff_space#,
489 3.0 staff_space# + 0.5 linethickness#,
490 1.5 staff_space# + bulb_diam# / 2);
495 y1 = -3 staff_space_rounded;
496 y2 = h - vround lower_brush;
498 z2 = z1 + whatever * dir (78);
499 z9 = z2 + 0.5 linethickness * dir (angle (z2 - z1) - 10);
512 bulb_a = draw_rest_bulb (.5 staff_space + staff_space_rounded,
514 bulb_b = draw_rest_bulb (.5 staff_space,
515 hround ((0.5 + 0.20) * staff_space),
517 bulb_c = draw_rest_bulb (.5 staff_space - staff_space_rounded,
518 hround ((-0.5 + 0.21) * staff_space),
520 bulb_d = draw_rest_bulb (.5 staff_space - 2 staff_space_rounded,
521 hround ((-1.5 + 0.22) * staff_space),
524 fill simple_serif (z1l, z1r, 40)
537 draw_staff (-2, 2, 0);
541 fet_beginchar ("128th rest", "7");
543 save pat, bulb_a, bulb_b, bulb_c, bulb_d, bulb_e;
544 path pat, bulb_a, bulb_b, bulb_c, bulb_d, bulb_e;
546 set_char_box (0, 1.5 staff_space#,
547 3.0 staff_space# + 0.5 linethickness#,
548 2.5 staff_space# + bulb_diam# / 2);
553 y1 = -3 staff_space_rounded;
554 y2 = h - vround lower_brush;
556 z2 = z1 + whatever * dir (80);
557 z9 = z2 + 0.5 linethickness * dir (angle (z2 - z1)- 10);
570 bulb_a = draw_rest_bulb (.5 staff_space + 2 staff_space_rounded,
572 bulb_b = draw_rest_bulb (.5 staff_space + staff_space_rounded,
573 hround ((1.5 + 0.20) * staff_space),
575 bulb_c = draw_rest_bulb (.5 staff_space,
576 hround ((0.5 + 0.21) * staff_space),
578 bulb_d = draw_rest_bulb (.5 staff_space - staff_space_rounded,
579 hround ((-0.5 + 0.22) * staff_space),
581 bulb_e = draw_rest_bulb (.5 staff_space - 2 staff_space_rounded,
582 hround ((-1.5 + 0.23) * staff_space),
585 fill simple_serif (z1l, z1r, 40)
599 draw_staff (-2, 2, 0);
603 fet_endgroup ("rests");