1 % Feta (not the Font-En-Tja) music font -- piano pedal markings
2 % This file is part of LilyPond, the GNU music typesetter.
4 % Copyright (C) 2000--2010 Jan Nieuwenhuizen <janneke@gnu.org>
8 % LilyPond is free software: you can redistribute it and/or modify
9 % it under the terms of the GNU General Public License as published by
10 % the Free Software Foundation, either version 3 of the License, or
11 % (at your option) any later version.
13 % LilyPond is distributed in the hope that it will be useful,
14 % but WITHOUT ANY WARRANTY; without even the implied warranty of
15 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 % GNU General Public License for more details.
18 % You should have received a copy of the GNU General Public License
19 % along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
23 % Pe = -0.034 pedalh == -0.07 staff-space
24 % ed = -0.27 pedalh == -0.53 staff-space
27 fet_begingroup ("pedal");
32 penh# = 0.7 linethickness#;
33 penw# = 2 penh# + 0.14 staff_space#;
34 define_pixels (penh, penw);
36 pedalh# = 2 staff_space#;
37 pedalbh# = 4/7 pedalh#;
38 define_pixels (pedalh, pedalbh);
41 fet_beginchar ("Pedal asterisk", "*");
42 save bulb, p, radius, thin, inner_r;
45 set_char_box (0, 7/9 pedalh#, 0, 7/9 pedalh#);
47 z0 = (1/2 w, h - 1/2 w);
49 thin = 0.8 linethickness;
52 0.9 thin + bulb = (radius * pi * 2) / 8;
54 pickup pencircle scaled penh;
60 z1 = z0 + (0, radius);
65 z4l = z0 + inner_r * dir (90 + 360/16);
66 z4r = z0 + inner_r * dir (90 - 360/16);
71 penlabels (0, 1, 2, 3, 4);
77 .. z4l{dir (180 + 360/16)};
84 .. z4l{dir (180 + 360/16)})
85 rotatedaround (z0, 360/8 i));
92 pickup pencircle scaled (7/8 inner_r);
98 %% ugh. rounded corners!
100 fet_beginchar ("Pedal dash", "M");
103 dash_thickness# := penw#;
104 define_whole_vertical_blacker_pixels (dash_thickness);
106 set_char_box (0, 3 penw#, 0, pedalbh#);
108 penpos1 (dash_thickness, 60);
109 penpos2 (dash_thickness, 60);
111 z1l = (0, vround (2/3 h - 1/2 penw));
112 z2r = (w, vround (y1l + 1.2 penw));
116 penstroke z1e{dir 40}
117 ..tension 1.2.. z2e{dir 40};
121 fet_beginchar ("Pedal dot", ".");
122 set_char_box (0, penw#, 0, penw#);
124 pickup pencircle scaled penw;
126 drawdot (hround (1/2 penw), vround (1/2 penw));
130 def draw_pedal_P (expr show_labels) =
134 penpos1 (hround penh, 0);
136 penpos3 (penw, pedalpha);
137 penpos4 (1.2 penh, -pedalpha);
138 penpos5 (penh, -pedalpha);
139 penpos6 (penh, 180 - pedalpha);
140 penpos7 (penh, 180 - pedalpha);
142 penpos9 (4/3 penw, 50);
143 penpos10 (1.4 penw, 50);
144 penpos11 (penh, 90 + pedalpha);
146 z1r = (hround 0.6 w, h);
147 x2l = hround (x1l - penw) + xpart feta_offset;
148 y2 = vround (0.7 h) + ypart feta_offset;
149 x3r = hround (x2l + 2 penw);
151 z4l = z5r + 1/4 (z3r - z5r);
155 z7l = z6r + 1/3 (z8r - z6r);
156 z8r = z5r + 3/5 (z3r - z5r);
159 x10l = w - tand (90 - pedalpha) * y11l;
164 % don't stick out at the top
165 z1' = round (0.9 [z2, z1]) + (xpart feta_offset, 0);
168 % shift start point of pen stroke to avoid overlapping contours
171 z8'r = z8l + whatever * (z3r - z8l);
173 penpos12 (hround penh, 0);
174 penpos13 (penw, -90 - pedbeta);
175 penpos14 (vround penh, 90);
176 penpos15 (penw, -90 + pedbeta);
177 penpos16 (penh, 180 + pedbeta);
179 z12r = (hround (5/9 x1 + 1/2 hround penh), y2);
180 z13l = (1/2 x12r, y15r);
182 z15l = (1/2 [x16, w], y2l + 0.5 penw);
186 % We now do a correction to `center' the stem horizontally. While
187 % this is not the most elegant solution, it is definitely the
191 horz_corr = 1/5 [x12, x16] - x2l;
192 x2 := x2 + horz_corr;
193 x2l := x2l + horz_corr;
194 x2r := x2r + horz_corr;
199 ..tension 2.5.. {dir (225)}z4e;
201 soft_end_penstroke z8'e{right}
202 ..tension 1.5.. z9e{dir (-pedalpha)}
204 ..tension 2.5.. z11e;
207 ..tension 1.5.. z5r{left}
210 ..tension 1.5.. z8r{right}
213 soft_penstroke z12e{down}
214 ..tension 1.1.. z13e{dir (180 - pedbeta)}
215 ..tension 1.1.. z14e{right}
216 ..tension 1.1.. z15e{dir (180 + pedbeta)}
217 ..tension 1.1.. z16e{dir (90 + pedbeta)};
220 penlabels (range 1 thru 16);
227 def draw_pedal_d (expr show_labels) =
231 penpos1 (vround penh, -10 - 90);
232 penpos2 (hround penw, 190);
233 penpos3 (vround (2 penh), 90);
234 penpos4 (hround (3/4 penw), 0);
239 z2 = (w - 1/2 hround penw, 1/2 pedalbh + penh);
240 z4l = (hround (1/3 w), 1/2 pedalbh);
241 z5l = (2/3 w, pedalbh);
242 z3l = (hround x5l, 0);
245 penlabels (1, 2, 3, 4, 5);
248 soft_start_penstroke z1e{dir (-10)}
249 ..tension 1.1.. z2e{dir (-90 + 10)}
250 ..tension 1.1.. z3e{left}
251 ..tension 1.1.. z4e{up}
252 ..tension 1.1.. z5e{dir (-70 + 90)};
257 def draw_pedal_e (expr show_labels) =
261 penpos1 (penh, pedalpha - 90);
262 penpos2 (penh, pedalpha - 90);
263 penpos3 (3/5 penw, pedalpha);
264 penpos4 (1.2 penh, 90 + pedalpha);
265 penpos5 (2/3 penw, 180);
266 penpos6 (penw, 180 + pedalpha);
267 penpos7 (2/3 penw, -90 - 20);
268 penpos8 (penh, pedalpha - 90);
270 z1l = (0, 1/5 pedalh);
271 % this helps to make the path go through z2 at low resolutions
272 z2 = round (z1 + dir pedalpha * penw) + feta_offset;
280 z7l = (x6l + penh, y6l);
289 ..tension 1.5.. z6e{dir - pedalpha}
294 penlabels (range 1 thru 8);
300 fet_beginchar ("Pedal P", "P");
301 set_char_box (0, 5/6 pedalh#, 0, pedalh#);
307 fet_beginchar ("Pedal d", "d");
308 set_char_box (0, 2/3 pedalh#, 0, 7/8 pedalh#);
314 fet_beginchar ("Pedal e", "e");
315 set_char_box (0, 2/5 pedalh#, 0, pedalbh#);
321 fet_beginchar ("Pedal Ped", "Ped");
322 P_width# = 5/6 pedalh#;
323 e_width# = 2/5 pedalh#;
324 d_width# = 2/3 pedalh#;
325 define_pixels (P_width, e_width, d_width);
328 d_height = 7/8 pedalh;
330 % Pe = -0.034 pedalh == -0.07 staff-space
331 % ed = -0.27 pedalh == -0.53 staff-space
332 Pe_kern# = -0.034 pedalh#;
333 ed_kern# = -0.27 pedalh#;
334 define_pixels (Pe_kern, ed_kern);
337 h := vround d_height;
339 currentpicture := currentpicture
340 shifted (hround (e_width + ed_kern), 0);
343 h := vround e_height;
345 currentpicture := currentpicture
346 shifted (hround (P_width + Pe_kern), 0);
352 set_char_box (0, P_width# + Pe_kern# + e_width# + ed_kern# + d_width#,
357 fet_endgroup ("pedal");