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