]> git.donarmstrong.com Git - lilypond.git/blob - mf/feta-banier.mf
release: 1.5.32
[lilypond.git] / mf / feta-banier.mf
1 % flags 
2 %
3
4
5 fet_begingroup("flags")
6 save outer_path;
7 path outer_path;
8 % Flags pointing down overlap with  the notehead (in x-direction), so 
9 % the down-flag can be bigger
10 upflag_width# = .750 black_notehead_width# + stemthickness#/2;
11 downflag_width# = .833 black_notehead_width# + stemthickness#/2;
12
13 right_upflag_space# = .2 upflag_width#;
14 right_downflag_space# = .2 downflag_width#;
15
16 %
17 % Flags pointing down cannot overlap with the notehead in y-direction,
18 % so they have less slant.
19
20 % Because of optical illusion, the utmost flag (bottom for
21 % down-pointing, top for up-pointing) should be smaller than the other
22 % flags.  Adobe Sonata doesn't do this correctly.  (Instead they have
23 % an extension flag, which looks less elegant)
24 %
25
26 save hip_thickness, foot_thickness;
27 hip_thickness# = 1.3 stemthickness#;
28 foot_thickness# =  hip_thickness#;
29
30 %
31 % Inspired by Adobe Sonata and [Wanske]
32 % for example, see POSTSCRIPT Language -- program design, 
33 % page 119, and [Wanske], p 41,42
34 %
35 def draw_flag(expr center, flare, 
36         dims, hip_depth, foot_wid, hip_thickness, foot_thickness)=
37         clearxy;
38
39         penpos1(flare, 90);
40         penpos2(whatever, 0);
41         x2r - x2l = hip_thickness;
42         penpos3(foot_thickness, 0) ;
43
44         z1r  = center;
45         z2r = center + (xpart dims, -ypart(dims) * hip_depth);
46         z3r = center + (xpart(dims) * foot_wid, -ypart dims);
47
48         outer_path := z3r{curl 0} .. z2r{up} .. {up}z1r;
49
50         penlabels(1, 2, 3);
51         fill z1l{curl 0}
52                 ..tension 1.1 .. z2l{down} .. 
53                 {curl 0} simple_serif(z3l, z3r, 80) &
54                 outer_path & z1r -- cycle;
55 enddef;
56
57 %
58 % TODO: calc intersectpoint
59 % TODO: calc incision_depth
60
61 def add_flag(expr yoff, flare, hip_wid_multiplier, 
62                 hip_dep_multiplier,
63                 intersectpoint, hip_thickness, foot_thickness) =
64         begingroup
65         save prev_center, prev_xextreme, prev_yextreme;
66         save rel_foot, ip, center, incision_depth;
67         save prev_hipwid, prev_footdep, prev_hipdep, wid, dep, hip_dep;
68         save hip_dep_ratio, foot_wid_ratio;
69         pair prev_center, center, foot, prev_xextreme, prev_yextreme;
70         pair ip, rel_foot;
71         
72         incision_depth = 1.013;
73         prev_center = point 2 of outer_path;
74         prev_xextreme = point 1 of outer_path;
75         prev_yextreme = point 0 of outer_path;
76         prev_hipwid = xpart (prev_xextreme - prev_center);
77         prev_footdep = -ypart (prev_yextreme - prev_center);
78         prev_hipdep = -ypart(prev_xextreme - prev_center);
79         ip = point intersectpoint of outer_path;
80
81         wid = prev_hipwid * hip_wid_multiplier;
82         hip_dep = prev_hipdep * hip_dep_multiplier;
83
84         center = prev_center + (0,yoff);
85         rel_foot = incision_depth [(wid, hip_dep), ip - center];
86         dep = -ypart(rel_foot);
87         foot_wid_ratio = xpart(rel_foot ) / wid;
88         hip_dep_ratio = hip_dep / dep;
89
90         draw_flag(center, flare, 
91                 (wid, dep), hip_dep_ratio, foot_wid_ratio, 
92                 hip_thickness, foot_thickness);
93         endgroup
94 enddef;
95
96 fet_beginchar("8th Flag (up)", "u3", "eighthflag")
97         save flare, 
98                 hip_depth_ratio, hip_width,
99                 foot_depth, foot_width_ratio;
100
101         flare# = 1.0 staff_space#;
102         hip_depth_ratio = .72; 
103         foot_width_ratio = .8;
104         hip_width# = upflag_width# - hip_thickness#/2;
105
106         foot_depth# =  3 staff_space#;
107
108         set_char_box(stemthickness# /2, hip_width# 
109                 + stemthickness#/2 + right_upflag_space#, 
110                  foot_depth# + foot_thickness#/2, stemthickness#/2)
111
112         define_pixels(flare, hip_width, hip_thickness,
113                 foot_depth, foot_thickness);
114         draw_flag((stemthickness/2,0), flare, 
115                 (hip_width, foot_depth), 
116                 hip_depth_ratio, foot_width_ratio, hip_thickness, foot_thickness);
117
118         pickup pencircle scaled stemthickness;
119         draw (0, 0) .. (0,-2 staff_space);
120 fet_endchar;
121
122 fet_beginchar("16th Flag (up)", "u4", "sixteenthflag")
123         save flare, 
124                 hip_depth_ratio, hip_width,
125                 foot_depth, foot_width_ratio;
126         save flagspace, total_depth, flag_count;
127         total_depth# = 3.5 staff_space#;
128         flag_count = 2;
129         flare# = .85 staff_space#;
130         flagspace# = .85 staff_space#;  
131         hip_depth_ratio = .72 ;
132         hip_width# = upflag_width# - hip_thickness#/2;
133         flagspace# + foot_depth# = total_depth#;
134
135         foot_width_ratio = .8;
136
137         set_char_box(stemthickness# /2, hip_width#
138                 + stemthickness#/2 + right_upflag_space#, 
139                 total_depth# + foot_thickness#/2, stemthickness#/2)
140
141         define_pixels(flare, hip_width, hip_thickness,
142                 flagspace,
143                 foot_depth,  foot_thickness);
144         draw_flag((stemthickness/2,- flagspace), flare, 
145                 (hip_width, foot_depth), 
146                 hip_depth_ratio,foot_width_ratio, hip_thickness, foot_thickness);
147
148         add_flag(flagspace, flare,
149                 .97, 1.00, 1.25, hip_thickness, foot_thickness);  
150
151         pickup pencircle scaled stemthickness;
152         draw (0, 0) .. (0,-2 staff_space);
153 fet_endchar;
154
155
156 fet_beginchar("32nd Flag (up)", "u5", "thirtysecondflag")
157         save flare, 
158                 hip_depth_ratio, hip_width,
159                 foot_depth, foot_width_ratio;
160         save flagspace, total_depth, flag_count;
161         flag_count = 3;
162         total_depth#=4.25 staff_space#;
163         flare# = .85 staff_space#;
164         flagspace# = .87 staff_space#;  
165         hip_depth_ratio = .72 ;
166         hip_width# = upflag_width# - hip_thickness#/2;
167         (flag_count-1) * flagspace# + foot_depth# = total_depth#;
168
169         foot_width_ratio = .8;
170
171         set_char_box(stemthickness# /2, hip_width#
172                 + stemthickness#/2 + right_upflag_space#, 
173                 total_depth# + foot_thickness#/2, stemthickness#/2)
174
175         define_pixels(flare, hip_width, hip_thickness,
176                 flagspace,
177                 foot_depth,  foot_thickness);
178
179         draw_flag((stemthickness/2,- 2 flagspace), flare, 
180                 (hip_width, foot_depth), 
181                 hip_depth_ratio,foot_width_ratio, hip_thickness, foot_thickness);
182
183         add_flag(flagspace, flare,
184                 .97, 1.00, 1.25, hip_thickness, foot_thickness);  
185
186         add_flag(flagspace, flare,
187                 .95, 1.05, 1.25, hip_thickness, foot_thickness);  
188
189         pickup pencircle scaled stemthickness;
190         draw (0, 0) .. (0,-2 staff_space);
191 fet_endchar;
192
193 fet_beginchar("64th Flag (up)", "u6", "sixtyfourthflag")
194         save flare, 
195                 hip_depth_ratio, hip_width,
196                 foot_depth, foot_width_ratio;
197         save flagspace, total_depth, flag_count;
198         
199         flag_count = 4;
200         flare# = .85 staff_space#;
201         flagspace# = .9 staff_space#;   
202         hip_depth_ratio = .72 ;
203         hip_width# = upflag_width# - hip_thickness#/2;
204         total_depth# = 5.25 staff_space#;
205         (flag_count-1) * flagspace# + foot_depth# = total_depth#;
206
207         foot_width_ratio = .8;
208
209         set_char_box(stemthickness# /2, hip_width#
210                 + stemthickness#/2 + right_upflag_space#, 
211                 total_depth# + foot_thickness#/2, stemthickness#/2)
212
213         define_pixels(flare, hip_width, hip_thickness,
214                 flagspace,
215                 foot_depth,  foot_thickness);
216
217         draw_flag((stemthickness/2,- (flag_count-1)* flagspace), flare, 
218                 (hip_width, foot_depth), 
219                 hip_depth_ratio,foot_width_ratio, hip_thickness, foot_thickness);
220
221         add_flag(flagspace, flare,
222                 .97, 1.00, 1.3, hip_thickness, foot_thickness);  
223
224         add_flag(flagspace, flare,
225                 1.00, 1.00, 1.25, hip_thickness, foot_thickness);  
226         add_flag(flagspace, flare,
227                 .95, 1.05, 1.25, hip_thickness, foot_thickness);  
228         pickup pencircle scaled stemthickness;
229         draw (0, 0) .. (0,-2 staff_space);
230 fet_endchar;
231
232 fet_beginchar("8th (down)", "d3", "deighthflag")
233         save flare, 
234                 hip_depth_ratio, hip_width,
235                 foot_depth, foot_width_ratio;
236         save flagspace, total_depth, flag_count;
237         
238         flag_count = 1;
239         flare# = .99 staff_space#;
240         flagspace# = .9 staff_space#;   
241         hip_depth_ratio = .72 ;
242         hip_width# = downflag_width# - hip_thickness#/2;
243         total_depth# = 2.85 staff_space#;
244         (flag_count-1) * flagspace# + foot_depth# = total_depth#;
245
246         foot_width_ratio = .8;
247
248         set_char_box(stemthickness# /2, hip_width#
249                 + stemthickness#/2 + right_downflag_space#,
250                 total_depth# + foot_thickness#/2, stemthickness#/2)
251
252         define_pixels(flare, hip_width, hip_thickness,
253                 flagspace,
254                 foot_depth,  foot_thickness);
255
256         draw_flag((stemthickness/2,- (flag_count-1) *flagspace), flare, 
257                 (hip_width, foot_depth), 
258                 hip_depth_ratio,foot_width_ratio, hip_thickness, foot_thickness);
259
260         pickup pencircle scaled stemthickness;
261         draw (0, 0) .. (0,-2 staff_space);
262         y_mirror_char;
263 fet_endchar;
264
265 %%%%%%%%
266 %
267 %
268 %
269 % Single Stroke for Short Appogiatura
270 %
271 %
272 %
273
274 fet_beginchar("grace dash (up)", "ugrace", "gracedash")
275         save flare, 
276                 hip_depth_ratio, hip_width,
277                 foot_depth;
278
279         flare# = 1.0 staff_space#;
280         hip_depth_ratio = .72; 
281         hip_width# = upflag_width# - hip_thickness#/2;
282
283         foot_depth# =  3 staff_space#;
284
285         define_pixels(flare, hip_width, hip_thickness,
286                 foot_depth, foot_thickness);
287
288         set_char_box(hip_width# * hip_depth_ratio,
289           hip_width# + stemthickness#/2 + right_upflag_space#, 
290           foot_depth# * hip_depth_ratio, -flare#)
291
292         pickup pencircle scaled 1.5 stemthickness;
293         draw (-b ,-d) ..
294           (w, h);
295 fet_endchar;
296
297 fet_beginchar("grace dash (down)", "dgrace", "dgracedash")
298         save flare, hip_depth_ratio, hip_width, foot_depth;
299         save flagspace, total_depth, flag_count;
300         
301         flag_count = 1;
302         flare# = .99 staff_space#;
303         flagspace# = .9 staff_space#;   
304         hip_depth_ratio = .72 ;
305         hip_width# = downflag_width# - hip_thickness#/2;
306         total_depth# = 2.85 staff_space#;
307         (flag_count-1) * flagspace# + foot_depth# = total_depth#;
308
309         foot_width_ratio = .8;
310
311         define_pixels(flare, hip_width, hip_thickness,
312                 flagspace, foot_depth);
313
314         set_char_box(hip_width# * hip_depth_ratio,
315           hip_width# + stemthickness#/2 + right_downflag_space#,
316           foot_depth# * hip_depth_ratio, -flare#)
317
318         pickup pencircle scaled 1.5 stemthickness;
319         draw (-b, -d) .. (w,h);
320         y_mirror_char;
321 fet_endchar;
322
323 fet_beginchar("16th (down)", "d4", "dsixteenthflag")
324         save flare, 
325                 hip_depth_ratio, hip_width,
326                 foot_depth, foot_width_ratio;
327         save flagspace, total_depth, flag_count;
328         
329         flag_count = 2;
330         flare# = .8 staff_space#;
331         flagspace# = .9 staff_space#;   
332         hip_depth_ratio = .85 ;
333         hip_width# = downflag_width# - hip_thickness#/2;
334         total_depth# = 3.0 staff_space#;
335         (flag_count-1) * flagspace# + foot_depth# = total_depth#;
336
337         foot_width_ratio = .95;
338
339         set_char_box(stemthickness# /2, hip_width#
340                 + stemthickness#/2 + right_downflag_space#, 
341                 total_depth# + foot_thickness#/2, stemthickness#/2)
342
343         define_pixels(flare, hip_width, hip_thickness,
344                 flagspace,
345                 foot_depth,  foot_thickness);
346
347         draw_flag((stemthickness/2,- (flag_count-1) *flagspace), flare, 
348                 (hip_width, foot_depth), 
349                 hip_depth_ratio,foot_width_ratio, hip_thickness, foot_thickness);
350         add_flag(flagspace, flare,
351                 .95, 1.00, 1.25, hip_thickness, foot_thickness);  
352
353         
354
355         pickup pencircle scaled stemthickness;
356         draw (0, 0) .. (0,-2 staff_space);
357         y_mirror_char;
358 fet_endchar;
359
360 fet_beginchar("32nd (down)", "d5", "dthirtysecondflag")
361         save flare, 
362                 hip_depth_ratio, hip_width,
363                 foot_depth, foot_width_ratio;
364         save flagspace, total_depth, flag_count;
365         
366         flag_count = 3;
367         flare# = .84 staff_space#;
368         flagspace# = .9 staff_space#;   
369         hip_depth_ratio = .85 ;
370         hip_width# = downflag_width# - hip_thickness#/2;
371         total_depth# = 3.85 staff_space#;
372         (flag_count-1) * flagspace# + foot_depth# = total_depth#;
373
374         foot_width_ratio = .95;
375
376         set_char_box(stemthickness# /2, hip_width#
377                 + stemthickness#/2 + right_downflag_space#, 
378                 total_depth# + foot_thickness#/2, stemthickness#/2)
379
380         define_pixels(flare, hip_width, hip_thickness,
381                 flagspace,
382                 foot_depth,  foot_thickness);
383
384         draw_flag((stemthickness/2,- (flag_count-1) *flagspace), flare, 
385                 (hip_width, foot_depth), 
386                 hip_depth_ratio,foot_width_ratio, hip_thickness, foot_thickness);
387         add_flag(flagspace, flare,
388                 .97, 1.00, 1.25, hip_thickness, foot_thickness);  
389
390         add_flag(flagspace, flare,
391                 .95, 1.05, 1.25, hip_thickness, foot_thickness);  
392
393         
394
395         pickup pencircle scaled stemthickness;
396         draw (0, 0) .. (0,-2 staff_space);
397         y_mirror_char;
398 fet_endchar;
399 fet_beginchar("64th (down)", "d6", "dsixtyfourthflag")
400         save flare, 
401                 hip_depth_ratio, hip_width,
402                 foot_depth, foot_width_ratio;
403         save flagspace, total_depth, flag_count;
404         
405         flag_count = 4;
406         flare# = .8 staff_space#;
407         flagspace# = .9 staff_space#;   
408         hip_depth_ratio = .85 ;
409         hip_width# = downflag_width# - hip_thickness#/2;
410         total_depth# = 4.35 staff_space#;
411         (flag_count-1) * flagspace# + foot_depth# = total_depth#;
412
413         foot_width_ratio = .98;
414
415         set_char_box(stemthickness# /2, hip_width#
416                 + stemthickness#/2 + right_downflag_space#, 
417                 total_depth# + foot_thickness#/2, stemthickness#/2)
418
419         define_pixels(flare, hip_width, hip_thickness,
420                 flagspace,
421                 foot_depth,  foot_thickness);
422
423         draw_flag((stemthickness/2,- (flag_count-1) *flagspace), flare, 
424                 (hip_width, foot_depth), 
425                 hip_depth_ratio,foot_width_ratio, hip_thickness, foot_thickness);
426         add_flag(flagspace, flare,
427                 .97, 1.20, 1.175, hip_thickness, foot_thickness);  
428         add_flag(flagspace, flare,
429                 .97, 1.10, 1.175, hip_thickness, foot_thickness);  
430
431         add_flag(.98 flagspace, flare,
432                 .91, 1.05, 1.2, hip_thickness, foot_thickness);  
433
434         
435
436         pickup pencircle scaled stemthickness;
437         draw (0, 0) .. (0,-2 staff_space);
438         y_mirror_char;
439 fet_endchar;
440
441 % ustem?
442 %
443 %
444 % Stem characters so we can compose metronome markings with Feta
445 % entirely.
446 %
447
448 fet_beginchar("stem (up)", "stem", "stem")
449         set_char_box(stemthickness#/2, stemthickness#/2, 0, 3.5staff_space#);
450         pickup pencircle scaled stemthickness;
451         draw (0, 0.2staff_space) .. (0, 3.5staff_space);
452 fet_endchar;
453
454 % do we want this?
455 fet_beginchar("stem (down)", "dstem", "dstem")
456         set_char_box(stemthickness#/2, stemthickness#/2, 3.5staff_space#, 0);
457         pickup pencircle scaled stemthickness;
458         draw (0, -0.2staff_space) .. (0, -3.5staff_space);
459 fet_endchar;
460
461
462 fet_endgroup("flags");