]> git.donarmstrong.com Git - lilypond.git/blob - mf/feta-pendaal.mf
Prepare glyph shapes for mf2pt1 conversion.
[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--2004 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 p;
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         penpos 1 (bulb, 180);
48         penpos 2 (bulb, 0);
49         penpos 3 (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 (1, 2, 3, 4);
63
64         p := z3r{up}
65              .. z1l{up}
66              .. z2l{down}
67              .. z3l{down}
68              .. z4l{dir (180 + 360/16)};
69         for i = 1 upto 7:
70                 p := p
71                      .. ((z3r{up}
72                          .. z1l{up}
73                          .. z2l{down}
74                          .. z3l{down}
75                          .. z4l{dir (180 + 360/16)}) rotatedaround (z0,
76                                                                     360/8 i));
77         endfor;
78
79         p := p
80              .. cycle;
81         fill p;
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", "-")
92         set_char_box (0, 3 penw#, 0, pedalbh#);
93
94         pickup pencircle scaled penh;
95
96         penpos1 (penw, 60);
97         penpos2 (penw, 60);
98
99         z1l = (0, 2/3 h - 1/2 penw);
100         z2r = (w, y1l + 1.2 penw);
101
102         penlabels (1, 2);
103
104         penstroke z1e{dir 40}
105                   ..tension 1.2.. z2e{dir 40};
106 fet_endchar;
107
108
109 fet_beginchar ("Pedal dot", ".")
110         set_char_box (0, penw#, 0, penw#);
111
112         pickup pencircle scaled penw;
113
114         drawdot (1/2 penw, 1/2 penw);
115 fet_endchar;
116
117
118 def draw_pedal_P (expr show_labels) =
119 begingroup;
120         clearxy;
121
122         penpos1 (penh, 0);
123         penpos2 (penw, 55);
124         penpos3 (penw, pedalpha);
125         penpos4 (1.2 penh, -pedalpha);
126         penpos5 (penh, -pedalpha);
127         penpos6 (penh, 180 - pedalpha);
128         penpos7 (2 penh, 180 - pedalpha);
129         penpos8 (penh, 90);
130         penpos9 (4/3 penw, 50);
131         penpos10 (1.4 penw, 50);
132         penpos11 (penh, 90 + pedalpha);
133
134         z1r = (0.6 w, h);
135         x2l = x1l - penw;
136         y2 = 0.7 h;
137         x3r = x2l + 2 penw;
138         y3r = 0.4 h;
139         z4l = z5r + 1/4 (z3r - z5r);
140         x5 = 1/4 w;
141         y5r = 0;
142         z6 = z5;
143         z7 = z6r + 1/3 (z8r - z6r);
144         z8r = z5r + 3/5 (z3r - z5r);
145         x9l = x10l - penh;
146         y9l = 1/4 penh;
147         x10l = w - tand (90 - pedalpha) * y11l;
148         y10l = 1/4 penh;
149         x11l = w;
150         y11 = 1/5 h;
151
152         z1' = 0.9 [z2, z1];
153         penpos1' (penh, 0);
154
155         if show_labels = 1:
156                 penlabels (range 1 thru 11);
157                 penlabels (1');
158         fi;
159
160         soft_penstroke z1'e
161                        ..tension 2.5.. z2e
162                        ..tension 1.5.. z3e
163                        ..tension 2.5.. z4e
164                        ..tension 1.5.. z5e
165                        .. z6e
166                        ..tension 1.5.. z7e
167                        ..tension 1.5.. z8e{right}
168                        ..tension 1.5.. z9e{dir - pedalpha}
169                        .. z10e
170                        ..tension 2.5.. z11e;
171
172         penpos12 (penh, 0);
173         penpos13 (penw, -90 - pedbeta);
174         penpos14 (penh, 90);
175         penpos15 (penw, -90 + pedbeta);
176         penpos16 (penh, 180 + pedbeta);
177
178         z12 = (5/9 x1, y2);
179         z13l = (1/2 x12r, y15r);
180         z14r = z1r;
181         z15l = (1/2 [x16, w], y2l + 0.5 penw);
182         x16 = 1/4 [x1, w];
183         y16r = y2r;
184
185         if show_labels = 1:
186                 penlabels (range 12 thru 16);
187         fi;
188
189         soft_penstroke z12e{down}
190                        ..tension 1.1.. z13e{dir (180 - pedbeta)}
191                        ..tension 1.1.. z14e{right}
192                        ..tension 1.1.. z15e{dir (180 + pedbeta)}
193                        ..tension 1.1.. z16e{dir (90 + pedbeta)};
194 endgroup;
195 enddef;
196
197
198 def draw_pedal_d (expr show_labels) =
199 begingroup;
200         clearxy;
201
202         penpos1 (penh, -10 - 90);
203         penpos2 (penw, 190);
204         penpos3 (2 penh, 90);
205         penpos4 (3/4 penw, 0);
206         penpos5 (penh, -70);
207
208         x1r = 0;
209         y1l = h;
210         z2 = (w - 1/2 penw, 1/2 pedalbh + penh);
211         z3l = (x5l, 0);
212         z4l = (1/3 w, 1/2 pedalbh);
213         z5l = (2/3 w, pedalbh);
214
215         if show_labels = 1:
216                 penlabels (1, 2, 3, 4, 5);
217         fi;
218
219         soft_penstroke z1e{dir (-10)}
220                        ..tension 1.1.. z2e{dir (-90 + 10)}
221                        ..tension 1.1.. z3e{left}
222                        ..tension 1.1.. z4e{up}
223                        ..tension 1.1.. z5e{dir (-70 + 90)};
224 endgroup;
225 enddef;
226
227
228 def draw_pedal_e (expr show_labels) =
229 begingroup;
230         clearxy;
231
232         penpos1 (penh, pedalpha - 90);
233         penpos2 (penh, pedalpha - 90);
234         penpos3 (3/5 penw, pedalpha);
235         penpos4 (1.2 penh, 90 + pedalpha);
236         penpos5 (2/3 penw, 180);
237         penpos6 (penw, 180 + pedalpha);
238         penpos7 (2/3 penw, -90 - 20);
239         penpos8 (penh, pedalpha - 90);
240
241         z1l = (0, 1/5 pedalh);
242         z2 = z1 + dir pedalpha * penw;
243         z3 = (3/5 w, 8/9 h);
244         z4 = (2/9 w,  y3);
245         x5r = 0;
246         y5 = y2;
247         x6 = 3/8 w;
248         y6r = 1/2 penh;
249         z7l = (x6l + penh, y6l);
250         x8r = w;
251         y8 = 1/5 pedalh;
252
253         if show_labels = 1:
254                 penlabels (range 1 thru 8);
255         fi;
256
257         soft_penstroke z1e
258                        --- z2e
259                        ..tension 1.1.. z3e
260                        ..tension 1.05.. z4e
261                        ..tension 1.1.. z5e
262                        ..tension 1.5.. z6e{dir - pedalpha}
263                        ..tension 1.1.. z7e
264                        ..tension 2.5.. z8e;
265 endgroup;
266 enddef;
267
268
269 fet_beginchar ("Pedal P", "P")
270         set_char_box (0, 5/6 pedalh#, 0, pedalh#);
271
272         draw_pedal_P (1);
273 fet_endchar;
274
275
276 fet_beginchar ("Pedal d", "d")
277         set_char_box (0, 2/3 pedalh#, 0, 7/8 pedalh#);
278
279         draw_pedal_d (1);
280 fet_endchar;
281
282
283 fet_beginchar ("Pedal e", "e")
284         set_char_box (0, 2/5 pedalh#, 0, pedalbh#);
285
286         draw_pedal_e (1);
287 fet_endchar;
288
289
290 fet_beginchar ("Pedal Ped", "Ped")
291         P_width# = 5/6 pedalh#;
292         e_width# = 2/5 pedalh#;
293         d_width# = 2/3 pedalh#;
294         define_pixels (P_width, e_width, d_width);
295
296         e_height# = pedalbh#;
297         d_height# = 7/8 pedalh#;
298         define_pixels (e_height, d_height);
299
300         % Pe = -0.034 pedalh == -0.07 staff-space
301         % ed = -0.27 pedalh == -0.53 staff-space
302         Pe_kern# = -0.034 pedalh#;
303         ed_kern# = -0.27 pedalh#;
304         define_pixels (Pe_kern, ed_kern);
305
306         w := d_width;
307         h := d_height;
308         draw_pedal_d (0);
309         currentpicture := currentpicture shifted (e_width + ed_kern, 0);
310
311         w := e_width;
312         h := e_height;
313         draw_pedal_e (0);
314         currentpicture := currentpicture shifted (P_width + Pe_kern, 0);
315
316         w := P_width;
317         h := pedalh;
318         draw_pedal_P (0);
319
320         set_char_box (0, P_width# + Pe_kern# + e_width# + ed_kern# + d_width#,
321                       0, pedalh#);
322 fet_endchar;
323
324
325 fet_endgroup ("pedal")