]> git.donarmstrong.com Git - lilypond.git/blob - mf/feta-pendaal.mf
Run `make grand-replace'.
[lilypond.git] / mf / feta-pendaal.mf
1 % -*- Fundamental -*-  (emacs-20 mf mode mucks
2 % feta-pendaal.mf -- piano pedal markings
3 %
4 % part of LilyPond's pretty-but-neat music font
5 %
6 % source file of the Feta (not the Font-En-Tja) music font
7 %
8 % (c) 2000--2008 Jan Nieuwenhuizen <janneke@gnu.org>
9 %
10 % Voor Cup
11
12 % Kerning
13 %
14 % Pe = -0.034 pedalh == -0.07 staff-space
15 % ed = -0.27 pedalh == -0.53 staff-space
16
17
18 fet_begingroup ("pedal");
19
20 pedalpha = 40;
21 pedbeta = 25;
22
23 penh# = 0.7 linethickness#;
24 penw# = 2 penh# + 0.14 staff_space#;
25 define_pixels (penh, penw);
26
27 pedalh# = 2 staff_space#;
28 pedalbh# = 4/7 pedalh#;
29 define_pixels (pedalh, pedalbh);
30
31
32 fet_beginchar ("Pedal asterisk", "*");
33         save bulb, p, radius, thin, inner_r;
34         path pat;
35
36         set_char_box (0, 7/9 pedalh#, 0, pedalh#);
37
38         z0 = (1/2 w, h - 1/2 w);
39
40         thin = 0.8 linethickness;
41
42         bulb + 2 radius = w;
43         0.9 thin + bulb = (radius * pi * 2) / 8;
44
45         pickup pencircle scaled penh;
46
47         penpos1 (bulb, 180);
48         penpos2 (bulb, 0);
49         penpos3 (thin, 0);
50
51         z1 = z0 + (0, radius);
52         z2 = z1;
53
54         inner_r = .45 radius;
55
56         z4l = z0 + inner_r * dir (90 + 360/16);
57         z4r = z0 + inner_r * dir (90 - 360/16);
58
59         z4 = .5 [z4l, z4r];
60         z3 = .75 [z1, z4];
61
62         penlabels (0, 1, 2, 3, 4);
63
64         pat := z3r{up}
65                .. z1l{up}
66                .. z2l{down}
67                .. z3l{down}
68                .. z4l{dir (180 + 360/16)};
69         for i = 1 upto 7:
70                 pat := pat
71                        .. ((z3r{up}
72                            .. z1l{up}
73                            .. z2l{down}
74                            .. z3l{down}
75                            .. z4l{dir (180 + 360/16)})
76                                 rotatedaround (z0, 360/8 i));
77         endfor;
78
79         pat := pat
80                .. cycle;
81         fill pat;
82
83         pickup pencircle scaled (7/8 inner_r);
84
85         undrawdot z0;
86 fet_endchar;
87
88
89 %% ugh. rounded corners!
90
91 fet_beginchar ("Pedal dash", "M");
92         save dash_thickness;
93
94         dash_thickness# := penw#;
95         define_whole_vertical_blacker_pixels (dash_thickness);
96
97         set_char_box (0, 3 penw#, 0, pedalbh#);
98
99         penpos1 (dash_thickness, 60);
100         penpos2 (dash_thickness, 60);
101
102         z1l = (0, vround (2/3 h - 1/2 penw));
103         z2r = (w, vround (y1l + 1.2 penw));
104
105         penlabels (1, 2, 3);
106
107         penstroke z1e{dir 40}
108                   ..tension 1.2.. z2e{dir 40};
109 fet_endchar;
110
111
112 fet_beginchar ("Pedal dot", ".");
113         set_char_box (0, penw#, 0, penw#);
114
115         pickup pencircle scaled penw;
116
117         drawdot (hround (1/2 penw), vround (1/2 penw));
118 fet_endchar;
119
120
121 def draw_pedal_P (expr show_labels) =
122 begingroup;
123         clearxy;
124
125         penpos1 (hround penh, 0);
126         penpos2 (penw, 55);
127         penpos3 (penw, pedalpha);
128         penpos4 (1.2 penh, -pedalpha);
129         penpos5 (penh, -pedalpha);
130         penpos6 (penh, 180 - pedalpha);
131         penpos7 (penh, 180 - pedalpha);
132         penpos8 (penh, 90);
133         penpos9 (4/3 penw, 50);
134         penpos10 (1.4 penw, 50);
135         penpos11 (penh, 90 + pedalpha);
136
137         z1r = (hround 0.6 w, h);
138         x2l = hround (x1l - penw) + xpart feta_offset;
139         y2 = vround (0.7 h) + ypart feta_offset;
140         x3r = hround (x2l + 2 penw);
141         y3r = 0.4 h;
142         z4l = z5r + 1/4 (z3r - z5r);
143         x5 = 1/4 w;
144         y5r = 0;
145         z6 = z5;
146         z7l = z6r + 1/3 (z8r - z6r);
147         z8r = z5r + 3/5 (z3r - z5r);
148         x9l = x10l - penh;
149         y9l = 1/4 penh;
150         x10l = w - tand (90 - pedalpha) * y11l;
151         y10l = 1/4 penh;
152         x11l = w;
153         y11 = 1/5 h;
154
155         % don't stick out at the top
156         z1' = round (0.9 [z2, z1]) + (xpart feta_offset, 0);
157         penpos1' (penh, 0);
158
159         % shift start point of pen stroke to avoid overlapping contours
160         z8'l = z8l;
161         y8'r = y8r;
162         z8'r = z8l + whatever * (z3r - z8l);
163
164         penpos12 (hround penh, 0);
165         penpos13 (penw, -90 - pedbeta);
166         penpos14 (vround penh, 90);
167         penpos15 (penw, -90 + pedbeta);
168         penpos16 (penh, 180 + pedbeta);
169
170         z12r = (hround (5/9 x1 + 1/2 hround penh), y2);
171         z13l = (1/2 x12r, y15r);
172         z14r = z1r;
173         z15l = (1/2 [x16, w], y2l + 0.5 penw);
174         x16 = 1/4 [x1, w];
175         y16r = y2r;
176
177         % We now do a correction to `center' the stem horizontally.  While
178         % this is not the most elegant solution, it is definitely the
179         % easiest...
180
181         save horz_corr;
182         horz_corr = 1/5 [x12, x16] - x2l;
183         x2 := x2 + horz_corr;
184         x2l := x2l + horz_corr;
185         x2r := x2r + horz_corr; 
186
187         penstroke z1'e
188                   ..tension 2.5.. z2e
189                   ..tension 1.5.. z3e
190                   ..tension 2.5.. {dir (225)}z4e;
191
192         soft_end_penstroke z8'e{right}
193                            ..tension 1.5.. z9e{dir (-pedalpha)}
194                            .. z10e
195                            ..tension 2.5.. z11e;
196
197         fill z4r{dir (225)}
198              ..tension 1.5.. z5r{left}
199              .. z6r
200              ..tension 1.5.. z7r
201              ..tension 1.5.. z8r{right}
202              -- cycle;
203
204         soft_penstroke z12e{down}
205                        ..tension 1.1.. z13e{dir (180 - pedbeta)}
206                        ..tension 1.1.. z14e{right}
207                        ..tension 1.1.. z15e{dir (180 + pedbeta)}
208                        ..tension 1.1.. z16e{dir (90 + pedbeta)};
209
210         if show_labels = 1:
211                 penlabels (range 1 thru 16);
212                 penlabels (1', 8');
213         fi;
214 endgroup;
215 enddef;
216
217
218 def draw_pedal_d (expr show_labels) =
219 begingroup;
220         clearxy;
221
222         penpos1 (vround penh, -10 - 90);
223         penpos2 (hround penw, 190);
224         penpos3 (vround (2 penh), 90);
225         penpos4 (hround (3/4 penw), 0);
226         penpos5 (penh, -70);
227
228         x1r = 0;
229         y1l = h;
230         z2 = (w - 1/2 hround penw, 1/2 pedalbh + penh);
231         z4l = (hround (1/3 w), 1/2 pedalbh);
232         z5l = (2/3 w, pedalbh);
233         z3l = (hround x5l, 0);
234
235         if show_labels = 1:
236                 penlabels (1, 2, 3, 4, 5);
237         fi;
238
239         soft_start_penstroke z1e{dir (-10)}
240                              ..tension 1.1.. z2e{dir (-90 + 10)}
241                              ..tension 1.1.. z3e{left}
242                              ..tension 1.1.. z4e{up}
243                              ..tension 1.1.. z5e{dir (-70 + 90)};
244 endgroup;
245 enddef;
246
247
248 def draw_pedal_e (expr show_labels) =
249 begingroup;
250         clearxy;
251
252         penpos1 (penh, pedalpha - 90);
253         penpos2 (penh, pedalpha - 90);
254         penpos3 (3/5 penw, pedalpha);
255         penpos4 (1.2 penh, 90 + pedalpha);
256         penpos5 (2/3 penw, 180);
257         penpos6 (penw, 180 + pedalpha);
258         penpos7 (2/3 penw, -90 - 20);
259         penpos8 (penh, pedalpha - 90);
260
261         z1l = (0, 1/5 pedalh);
262         % this helps to make the path go through z2 at low resolutions
263         z2 = round (z1 + dir pedalpha * penw) + feta_offset;
264         z3 = (3/5 w, 8/9 h);
265         z4 = (2/9 w,  y3);
266         x4r := hround x4r;
267         x5r = 0;
268         y5 = y2;
269         x6 = 3/8 w;
270         y6r = 1/2 penh;
271         z7l = (x6l + penh, y6l);
272         x8r = w;
273         y8 = 1/5 pedalh;
274
275         soft_penstroke z1e
276                        -- z2e{z2 - z1}
277                        ..tension 1.1.. z3e
278                        ..tension 1.05.. z4e
279                        ..tension 1.1.. z5e
280                        ..tension 1.5.. z6e{dir - pedalpha}
281                        ..tension 1.1.. z7e
282                        ..tension 2.5.. z8e;
283
284         if show_labels = 1:
285                 penlabels (range 1 thru 8);
286         fi;
287 endgroup;
288 enddef;
289
290
291 fet_beginchar ("Pedal P", "P");
292         set_char_box (0, 5/6 pedalh#, 0, pedalh#);
293
294         draw_pedal_P (1);
295 fet_endchar;
296
297
298 fet_beginchar ("Pedal d", "d");
299         set_char_box (0, 2/3 pedalh#, 0, 7/8 pedalh#);
300
301         draw_pedal_d (1);
302 fet_endchar;
303
304
305 fet_beginchar ("Pedal e", "e");
306         set_char_box (0, 2/5 pedalh#, 0, pedalbh#);
307
308         draw_pedal_e (1);
309 fet_endchar;
310
311
312 fet_beginchar ("Pedal Ped", "Ped");
313         P_width# = 5/6 pedalh#;
314         e_width# = 2/5 pedalh#;
315         d_width# = 2/3 pedalh#;
316         define_pixels (P_width, e_width, d_width);
317
318         e_height = pedalbh;
319         d_height = 7/8 pedalh;
320
321         % Pe = -0.034 pedalh == -0.07 staff-space
322         % ed = -0.27 pedalh == -0.53 staff-space
323         Pe_kern# = -0.034 pedalh#;
324         ed_kern# = -0.27 pedalh#;
325         define_pixels (Pe_kern, ed_kern);
326
327         w := hround d_width;
328         h := vround d_height;
329         draw_pedal_d (0);
330         currentpicture := currentpicture
331                             shifted (hround (e_width + ed_kern), 0);
332
333         w := hround e_width;
334         h := vround e_height;
335         draw_pedal_e (0);
336         currentpicture := currentpicture
337                             shifted (hround (P_width + Pe_kern), 0);
338
339         w := hround P_width;
340         h := vround pedalh;
341         draw_pedal_P (0);
342
343         set_char_box (0, P_width# + Pe_kern# + e_width# + ed_kern# + d_width#,
344                       0, pedalh#);
345 fet_endchar;
346
347
348 fet_endgroup ("pedal");