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