]> git.donarmstrong.com Git - lilypond.git/blob - mf/feta-schrift.mf
release: 0.1.22
[lilypond.git] / mf / feta-schrift.mf
1 %
2 % scripts
3 %
4
5
6 fet_begingroup("scripts")
7
8
9 def draw_fermata =
10         save alpha, radius, crook_thinness, crook_fatness, dot_diam;
11         
12         % [Wanske] and some  Baerenreiter editions
13         % suggest ca 80 degrees iso half-circle
14         alpha := 10;
15
16         radius# = 1.25 interline#;
17         crook_thinness# = 1.5stafflinethickness#;
18         crook_fatness# = 4 stafflinethickness#;
19
20         radius# + crook_fatness#/2 = h#;
21         radius# + crook_thinness#/2 = w#;
22         set_char_box(w#, w#, crook_thinness#/2, h#);
23         
24         define_pixels(radius, crook_thinness, crook_fatness);
25         dot_diam = 4/3 crook_fatness;
26
27
28         penpos1(crook_thinness, 0);
29         penpos2(crook_fatness, -90);
30         z1 = (-radius,0);
31         z2 = (0, radius);
32
33         fill z1l{dir (-alpha-90)}..{dir (90-alpha)}z1r..
34                 {right}z2r -- z2l{left} .. cycle;
35
36         addto currentpicture also 
37                 currentpicture xscaled -1;
38
39         pickup pencircle scaled dot_diam;
40         x4 =0;
41         bot y4 = - crook_thinness/2;
42         draw z4;
43 enddef;
44
45 fet_beginchar("fermata up", "ufermata", "ufermata")
46         draw_fermata;   
47         penlabels(1,2,4);
48 fet_endchar;
49
50 fet_beginchar("fermata down", "dfermata", "dfermata")
51         draw_fermata;
52         currentpicture:=currentpicture yscaled -1 ;
53         set_char_box(w#, w#, h#, 0);
54         
55 fet_endchar;
56
57
58 %
59 % FIXME: rounded endings
60 %
61 % `\accent' is TeX reserved.
62 fet_beginchar("> accent", "sforzato", "sforzatoaccent")
63         set_char_box(.9 interline#, .9 interline#, .5 interline#, .5 interline#);
64         save thickness, diminish;
65
66         thickness = 2 stafflinethickness;
67
68         % prevent blobs at crossing lines
69         diminish = .75;
70
71         y1 + thickness/2 = h;
72         x1 = -b;
73         x2 = w;
74         y2 = .25 thickness* diminish;
75
76         z4 = (w,0);
77         x3 =0;
78         z3 = whatever [z1, z4];
79
80         penpos2(thickness*(2 - diminish)/2 , 90);
81         penpos1(thickness, 90);
82         penpos3(thickness, 90);
83
84         penstroke z1e .. z3e .. z2e;
85         penstroke (z1e .. z3e .. z2e) yscaled -1;
86
87         penlabels(1,2,3);
88 fet_endchar;
89
90 fet_beginchar("staccato dot", "staccato", "staccato")
91         save radius;
92         radius# = 1.5 stafflinethickness#;
93         define_pixels(radius);
94         pickup pencircle scaled 2 radius;
95         draw (0,0);
96         set_char_box(radius#, radius#, radius#, radius#);
97 fet_endchar;
98
99 def draw_staccatissimo =
100         save radius, height;
101         height# = .8 interline#;
102         radius# = 2 stafflinethickness#;
103         define_pixels(radius, height);
104
105         draw_brush((0,0), blot_diameter, (0, height),2 radius);
106         set_char_box(radius#,radius#, blot_diameter#/2, height# + radius#);
107 enddef;
108
109 fet_beginchar("staccatissimo/martellato up", "ustaccatissimo", 
110                 "ustaccatissimo")
111         draw_staccatissimo;
112 fet_endchar;
113
114 %
115 % FIXEM: scale labels too.
116 %
117 fet_beginchar("staccatissimo/martellato down", "dstaccatissimo", "dstaccatissimo")
118         draw_staccatissimo;
119         y_mirror_char;
120 fet_endchar;
121
122 fet_beginchar("portato/single tenuto", "tenuto", "tenuto")
123         save thick;
124         thick# = 1.2 stafflinethickness#;
125         define_pixels(thick);
126
127         set_char_box(.9 interline#, .9 interline#, thick#/2,thick#/2);
128         pickup pencircle scaled thick;
129         lft x1 = -b;
130         rt x2 = w;
131         y1 = y2 = 0;
132         draw z1 .. z2;
133 fet_endchar;
134
135
136 def draw_marcato = 
137         save fatness, thinness;
138         set_char_box(interline#/2, interline#/2, 0, 1.1 interline#);
139
140         fatness = 3 stafflinethickness;
141         thinness = .8 stafflinethickness;
142         x2 - x1  + blot_diameter = fatness;
143         x2 + thinness/2 = w;
144         
145         y1 = y2;
146         y1 = thinness/2;
147         z2 - z3 = whatever * (charwd, -charht);
148         z1 - z4 = whatever * (charwd, -charht);
149         z3 - z4 = whatever * (charwd, charht);
150         y3 + thinness/2 = h;
151         draw_rounded_path(z1 -- z2 -- z3 -- z4 -- cycle, thinness);
152
153         pickup pencircle scaled thinness;
154         z3 - z5 = whatever* (z3 - z4);
155         bot y5 = 0;
156         draw z3 .. z5;
157 enddef;
158
159 fet_beginchar("marcato up", "umarcato", "umarcato")
160         draw_marcato;
161         labels(1,2,3,4,5);
162 fet_endchar;
163
164
165 %
166 % The down marcato char (not very much used). 
167 % Contrary to what some MF/TeX `gurus' believe
168 % it is *point*-symmetric with the "up" version; (at least [Chlapik] 
169 % agrees with us)
170 %
171 fet_beginchar("marcato down", "dmarcato", "dmarcato")
172         draw_marcato;
173         xy_mirror_char;
174 fet_endchar;
175  
176 fet_beginchar("open (unstopped)", "open", "ouvert")
177         save thin, height, width, thick;
178         height# = 5/4 width#;
179         height# = interline#;
180         thin = 1.2 stafflinethickness;
181         thick =  1.4 thin;
182         set_char_box(width#/2, width#/2, height#/2, height#/2);
183         
184         penpos1(thick, 0);
185         penpos2(thin, 90);
186         z1r = (w, 0);
187         z2r = (0, h);
188         penlabels(1,2);
189         penstroke z1e{up} .. {left}z2e;
190         addto currentpicture also currentpicture xscaled -1;
191         addto currentpicture also currentpicture yscaled -1;
192 fet_endchar;
193
194
195 fet_beginchar("plus (stopped)", "stopped", "plusstop")
196         save thick, size;
197         thick = 2 stafflinethickness;
198         size# = 1.1 interline#;
199
200         set_char_box(size#/2, size#/2, size#/2, size#/2);
201         pickup pencircle scaled thick;
202
203         rt x1 = w;
204         y1 = 0;
205         z2 = -z1;
206
207         draw z1 .. z2;
208         draw (z1 .. z2) rotated 90;
209 fet_endchar;
210
211 %
212 % FIXME: blotting 
213 %
214 fet_beginchar("Upbow", "upbow", "upbow")
215         save ht, wd, thick;
216
217         thick = 1.4 stafflinethickness;
218         wd# = 1.3 interline#;
219         ht# = 1.6 wd#; 
220
221         
222         set_char_box(wd#/2, wd#/2, 0, ht#);
223         pickup pencircle scaled thick;
224
225         x1 = 0;
226         bot y1 = 0;
227         rt x2 =  w;
228         top y2 = h;
229
230         labels(1,2);
231         draw z2 -- z1 -- (z2 xscaled -1);
232 fet_endchar;
233
234
235 fet_beginchar("Downbow", "downbow", "downbow")
236         save stemthick, beamheight;
237         save wd;
238         define_pixels(wd)
239
240         wd# = 1.5 interline#;
241         stemthick = 1.2 stafflinethickness;
242
243         set_char_box(wd#/2, wd#/2, 0, 4/3 interline#);
244
245         beamheight = 4/10 h;
246
247
248         pickup pencircle scaled blot_diameter;
249         top y2 - bot y1  = beamheight;
250         top y2 = h;
251         rt x1 = w;
252         x1 = x2;
253         y2 = y3;
254         y1 = y4;
255         x3 = 0;
256         x4 = x3;
257         save p;
258         path p;
259         p := z1 -- z2 -- z3 -- z4 --cycle;
260         draw_rounded_path(p, blot_diameter);
261         pickup pencircle scaled stemthick;
262
263         bot y5 =0;
264         rt x5 = rt x6 = w;
265         y6 = h - beamheight;
266         draw z6 -- z5;
267         labels(1, 2,3,4,5,6);
268         addto currentpicture also currentpicture xscaled -1;
269 fet_endchar;
270
271 %
272 % Inspired by a computer-set version of auf dem Strom by Baerenreiter. 
273 %
274 fet_beginchar("Turn","turn","turn")
275         save thin, thick, ball_diam, darkness;
276         save wd, ht, thick_nibangle, ball_nib_thick;
277         save turndir;
278         pair turndir;
279
280         wd# = 35/16 interline#;
281         ht# = 18/17 interline#;
282         darkness = 1.20 stafflinethickness;
283
284         set_char_box(wd#/2, wd#/2, ht#/2, ht#/2);
285
286         thick_nibangle = 60;
287         thick = 3 darkness;
288         thin = darkness;
289         ball_nib_thick = 2.7 darkness;
290         ball_diam = ball_nib_thick + (h - ball_nib_thick) / 10;
291
292         
293         x3l = w;
294         y3 = 0;
295         y4l = h;
296         x4 = x2;
297         x2l = w/2;
298         y2l = -d;
299         z1 = (0,0);
300
301         penpos1(1.1 thick, thick_nibangle);
302         penpos2(thick, thick_nibangle);
303         penpos3(thin, 180);
304         penpos4(ball_nib_thick, -90);
305
306         path swoosh, ploop;
307         swoosh :=  z1l{curl 0} .. z2l .. z3l{up} .. {left}z4l 
308           -- z4r .. z3r{down} .. z2r{left} ;
309         fill swoosh .. (swoosh scaled -1) .. cycle;
310         penlabels(2,3,4);
311
312         x5r = x4;
313         y5r = y4l - ball_diam /2;
314         z6r = z5r;
315
316         penpos5(1.6 ball_diam/2, 10);
317         penpos6(ball_diam/2, 150);
318
319         ploop := z4l{left} .. z5l .. z6l -- cycle;
320         fill ploop;
321         fill ploop scaled -1;
322
323
324         penlabels(5,6,7);
325         
326 fet_endchar;
327
328
329  
330
331 def draw_bulb(expr zl, zr, center_factor, radius_factor)=
332         begingroup;
333         clearxy;
334         save rad, ang;
335
336         ang = angle(zr-zl);
337         z0 = center_factor [zr, zl];
338         rad = center_factor * length(zr-zl);
339         
340         z1 = z0 + radius_factor* rad * dir(ang - 100);
341         z2 = z0 + rad * dir(ang - 270);
342         labels(0,1,2);
343         fill zr{dir (ang - 90)} .. z1 .. z2 -- cycle;
344
345         endgroup
346 enddef;
347
348 %
349 % Inspired by a (by now) PD edition of Durand & C'ie edition of 
350 % Saint-Saens' Celloconcerto no. 1 
351 %
352 % FIXME take out hardcoded vars.
353 % FIXME the two loops on the `t' should be smoother (and the left one bigger).
354 % FIXME generic macros for serifs: top of the t and bottom of r
355 %
356
357
358 fet_beginchar("Trill (`tr')","trill","trill")
359         
360         save start_angle,  ascender_extra, ex, hair_thick, fatness,
361           slant_angle, slant, t_fatness, r_fatness, kerning, t_overshoot, 
362           uitschieter, bulb_size;
363         ;
364         pair slant_vec;
365
366         ascender_extra# = 1/2 ex#;
367         ascender# = ascender_extra# + ex#;
368         ex# = 1.5 interline#;
369         kerning# = .75 ex#;
370
371         define_pixels(ex, ascender_extra, ascender, kerning);
372         t_overshoot = 0.03 ex;
373         fatness = 12/40 ex;
374         t_fatness = 8/10 fatness;
375         r_fatness = .75 fatness;
376         uitschieter = 21/40 ex;
377         hair_thick =  blot_diameter;
378         bulb_size = 0.47;
379         slant = .15;
380
381         local_copy(transform)(currenttransform);
382         currenttransform := currenttransform slanted slant;
383
384         y1 = ascender;
385         x1l = 0;
386         x1r = t_fatness;
387         penpos1(start_nib_wid, 25);
388         
389         z2 = (x1, 7/18 ex);
390         penpos2(start_nib_wid, 25);
391
392         z3l = (11/10 t_fatness, - t_overshoot);
393
394         z4l = (13/6 t_fatness, 5/16 ex);
395         penpos4(hair_thick, 180);
396
397         1.9 [z3l, z3r] = z4r;
398         z3 = .5 [z3l, z3r];
399         
400         save t_p, krul_p;
401         path t_p, krul_p, r_p;
402
403
404         t_p := z1l -- z2l{down} .. tension (1 + .5 slant)
405                 .. z3l{right} 
406                 
407                 .. z4l{up} -- z4r{down} 
408                 .. z3r{left} .. z2r{up} .. z1r -- cycle;
409         fill t_p ;
410
411         krul_ang = 32;
412
413         pickup pencircle scaled hair_thick;
414
415         z5 = (t_fatness/2, 2/3 ex);
416         
417         lft x6 = - uitschieter;
418         y6 =  y5 - 1/20 ex;
419
420         z7 = z5 + whatever*dir krul_ang;
421         up_angle = krul_ang;
422         % angle (z7-z5)
423         x7 = 5/10 kerning + x5;
424         
425         penpos7(hair_thick, up_angle + 90);
426
427         
428         x8l = .7 [x9r, x7r];
429         y8l = y7l;
430         penpos8(2 hair_thick, (up_angle +90)/2);
431
432         y9 = 3/4 ex;
433         x9 = x1 + kerning;
434         penpos9(r_fatness, 0);
435
436         x10 = x9;
437         y10 = 0;
438         penpos10(r_fatness, 0);
439
440         krul_p := z4{up} .. tension 1.1  .. z5 
441                 .. tension 1 and .75 .. {down}z6
442                 .. tension .85 and 1.1 .. z5 --- z7;
443         draw krul_p;
444         r_p := z7l{z7-z5} .. z8l{right} .. z9l{down} --- z10l -- z10r
445                 --- z9r{up} 
446                 ..  z8r{left} ..  z7r{z5-z7} -- cycle;
447         fill r_p;
448         set_char_box(0,2 interline#, 0,ascender#);
449
450
451         penpos11(1/4 r_fatness, -20);
452         z11r = z9r;
453         
454         z13 = (x9 + 2 r_fatness, y11 );
455         penpos13(r_fatness, 180);
456         fill z11r{dir 70} .. z13r{down} -- z13l{up} .. z11l{dir 250} -- cycle;
457         penlabels(range 1 thru 15);
458
459         draw_bulb(z13r, z13l, bulb_size, 1.5);
460 fet_endchar;
461
462 fet_beginchar("organ-heel", "pedalheel", "pedalheel")
463         save radius, thickness, wall;
464
465         radius# := .5 interline#;
466
467         define_pixels(radius);
468         set_char_box(radius#, radius#, radius#, 2/3 interline#);
469
470         thickness := 1.5 stafflinethickness;    
471         pickup pencircle scaled thickness;
472         rt x1 = b;
473         top y1 = h;
474         
475         x2 =x1;
476         y2 = 0;
477
478         x3 = 0;
479         bot y3 = -d;
480
481         draw z1{down} .. z2{down} .. z3{left};
482         addto currentpicture also currentpicture xscaled -1;
483         labels(1,2,3);
484 fet_endchar;
485
486 fet_beginchar("organ-toe", "pedaltoe", "pedaltoe")
487         save ht,wd;
488
489         thickness := 1.5 stafflinethickness;
490         ht# := 1.5 interline#;
491         wd# := 1/3 ht#;
492         define_pixels(ht,wd);
493
494
495         set_char_box(wd#, wd#, 0, ht#);
496         
497         pickup pencircle scaled thickness;
498         lft x1 = -b;
499         bot y1 = 0;
500         x2 =0;
501         top y2 = h;
502         z3 = z1 xscaled -1;
503
504
505         draw z1 -- z2 -- z3;
506         labels(1,2,3);
507 fet_endchar;
508
509
510
511
512 fet_endgroup("scripts");