lilypond-1.3.139
[lilypond.git] / mf / feta-bant.mf
blobe25c7343e2dfbd1c1351016d6b8f944f2301a07e
1 % flags 
4 fet_begingroup("flagst")
5 save bot_path;
6 path bot_path;
7 % Flags pointing down overlap with  the notehead (in x-direction), so 
8 % the down-flag can be bigger
9 upflag_width# = .750 black_notehead_width# + stemthickness#/2;
10 downflag_width# = .833 black_notehead_width# + stemthickness#/2;
13 % Flags pointing down cannot overlap with the notehead in y-direction,
14 % so they have less slant.
17 % Because of optical illusion, the utmost flag 
18 % (bottom for down-pointing, top  
19 % for up-pointing) should be smaller than the other flags 
22 save hip_thickness, foot_thickness;
23 hip_thickness# = 1.3 stemthickness#;
24 foot_thickness# =  hip_thickness#;
27 % Inspired by Adobe Sonata and [Wanske]
28 % for example, see POSTSCRIPT Language -- program design, 
29 % page 119, and [Wanske], p 41,42
32 def draw_flag(expr center, flare, 
33         dims, hip_depth, foot_wid, hip_thickness, foot_thickness)=
34         clearxy;
36         penpos1(flare, 90);
37         penpos2(whatever, 0);
38         x2r - x2l = hip_thickness;
39         penpos3(foot_thickness, 0) ;
41         z1r  = center;
42         z2r = center + (xpart dims, -ypart(dims) * hip_depth);
43         z3r = center + (xpart(dims) * foot_wid, -ypart dims);
45         bot_path := z3r{curl 0} .. z2r{up} .. {up}z1r;
47         penlabels(1, 2, 3);
48         fill z1l{curl 0}
49                 ..tension 1.1 .. z2l{down} .. 
50                 {curl 0} simple_serif(z3l, z3r, 80) &
51                 bot_path & z1r -- cycle;
52 enddef;
54 def add_flag(expr yoff, flare, hip_wid_multiplier, 
55                 hip_dep_multiplier,
56                 intersectpoint, hip_thickness, foot_thickness) =
57         begingroup
58         save prev_center, prev_xextreme, prev_yextreme;
59         save rel_foot, ip, center;
60         save prev_hipwid, prev_footdep, prev_hipdep, wid, dep, hip_dep;
61         save hip_dep_ratio, foot_wid_ratio;
62         pair prev_center, center, foot, prev_xextreme, prev_yextreme;
63         pair ip, rel_foot;
64         
66         prev_center = point 2 of bot_path;
67         prev_xextreme = point 1 of bot_path;
68         prev_yextreme = point 0 of bot_path;
69         prev_hipwid = xpart (prev_xextreme - prev_center);
70         prev_footdep = -ypart (prev_yextreme - prev_center);
71         prev_hipdep = -ypart(prev_xextreme - prev_center);
72         ip = point intersectpoint of bot_path;
74         wid = prev_hipwid * hip_wid_multiplier;
75         hip_dep = prev_hipdep * hip_dep_multiplier;
77         center = prev_center + (0,yoff);
78         rel_foot = 1.013 [(wid, hip_dep), ip - center];
79         dep = -ypart(rel_foot);
80         foot_wid_ratio = xpart(rel_foot ) / wid;
81         hip_dep_ratio = hip_dep / dep;
83         draw_flag(center, flare, 
84                 (wid, dep), hip_dep_ratio, foot_wid_ratio, 
85                 hip_thickness, foot_thickness);
86         endgroup
87 enddef;
89 fet_beginchar("8th Flag (up)", "u3", "eighthflag")
90         save flare, 
91                 hip_depth_ratio, hip_width,
92                 foot_depth, foot_width_ratio;
94         flare# = 1.0 interline#;
95         hip_depth_ratio = .72; 
96         foot_width_ratio = .8;
97         hip_width# = upflag_width# - hip_thickness#/2;
99         foot_depth# =  3 interline#;
101         set_char_box(stemthickness# /2, hip_width# 
102                 + stemthickness#/2, 
103                  foot_depth# + foot_thickness#/2, stemthickness#/2)
105         define_pixels(flare, hip_width, hip_thickness,
106                 foot_depth, foot_thickness);
107         draw_flag((stemthickness/2,0), flare, 
108                 (hip_width, foot_depth), 
109                 hip_depth_ratio, foot_width_ratio, hip_thickness, foot_thickness);
111         pickup pencircle scaled stemthickness;
112         draw (0, 0) .. (0,-2 interline);
113 fet_endchar;
115 fet_beginchar("16th Flag (up)", "u4", "sixteenthflag")
116         save flare, 
117                 hip_depth_ratio, hip_width,
118                 foot_depth, foot_width_ratio;
119         save flagspace, total_depth, flag_count;
120         total_depth# = 3.5 interline#;
121         flag_count = 2;
122         flare# = .85 interline#;
123         flagspace# = .85 interline#;    
124         hip_depth_ratio = .72 ;
125         hip_width# = upflag_width# - hip_thickness#/2;
126         flagspace# + foot_depth# = total_depth#;
128         foot_width_ratio = .8;
130         set_char_box(stemthickness# /2, hip_width#
131                 + stemthickness#/2, 
132                 total_depth# + foot_thickness#/2, stemthickness#/2)
134         define_pixels(flare, hip_width, hip_thickness,
135                 flagspace,
136                 foot_depth,  foot_thickness);
138         draw_flag((stemthickness/2,- flagspace), flare, 
139                 (hip_width, foot_depth), 
140                 hip_depth_ratio,foot_width_ratio, hip_thickness, foot_thickness);
142         add_flag(flagspace, flare,
143                 .97, 1.00, 1.25, hip_thickness, foot_thickness);  
145         pickup pencircle scaled stemthickness;
146         draw (0, 0) .. (0,-2 interline);
147 fet_endchar;
150 fet_beginchar("32nd Flag (up)", "u5", "thirtysecondflag")
151         save flare, 
152                 hip_depth_ratio, hip_width,
153                 foot_depth, foot_width_ratio;
154         save flagspace, total_depth, flag_count;
155         flag_count = 3;
156         total_depth#=4.25 interline#;
157         flare# = .85 interline#;
158         flagspace# = .87 interline#;    
159         hip_depth_ratio = .72 ;
160         hip_width# = upflag_width# - hip_thickness#/2;
161         (flag_count-1) * flagspace# + foot_depth# = total_depth#;
163         foot_width_ratio = .8;
165         set_char_box(stemthickness# /2, hip_width#
166                 + stemthickness#/2, 
167                 total_depth# + foot_thickness#/2, stemthickness#/2)
169         define_pixels(flare, hip_width, hip_thickness,
170                 flagspace,
171                 foot_depth,  foot_thickness);
173         draw_flag((stemthickness/2,- 2 flagspace), flare, 
174                 (hip_width, foot_depth), 
175                 hip_depth_ratio,foot_width_ratio, hip_thickness, foot_thickness);
177         add_flag(flagspace, flare,
178                 .97, 1.00, 1.25, hip_thickness, foot_thickness);  
180         add_flag(flagspace, flare,
181                 .95, 1.05, 1.25, hip_thickness, foot_thickness);  
183         pickup pencircle scaled stemthickness;
184         draw (0, 0) .. (0,-2 interline);
185 fet_endchar;
187 fet_beginchar("64th Flag (up)", "u6", "sixtyfourthflag")
188         save flare, 
189                 hip_depth_ratio, hip_width,
190                 foot_depth, foot_width_ratio;
191         save flagspace, total_depth, flag_count;
192         
193         flag_count = 4;
194         flare# = .85 interline#;
195         flagspace# = .9 interline#;     
196         hip_depth_ratio = .72 ;
197         hip_width# = upflag_width# - hip_thickness#/2;
198         total_depth# = 5.25 interline#;
199         (flag_count-1) * flagspace# + foot_depth# = total_depth#;
201         foot_width_ratio = .8;
203         set_char_box(stemthickness# /2, hip_width#
204                 + stemthickness#/2, 
205                 total_depth# + foot_thickness#/2, stemthickness#/2)
207         define_pixels(flare, hip_width, hip_thickness,
208                 flagspace,
209                 foot_depth,  foot_thickness);
211         draw_flag((stemthickness/2,- (flag_count-1)* flagspace), flare, 
212                 (hip_width, foot_depth), 
213                 hip_depth_ratio,foot_width_ratio, hip_thickness, foot_thickness);
215         add_flag(flagspace, flare,
216                 .97, 1.00, 1.3, hip_thickness, foot_thickness);  
218         add_flag(flagspace, flare,
219                 1.00, 1.00, 1.25, hip_thickness, foot_thickness);  
220         add_flag(flagspace, flare,
221                 .95, 1.05, 1.25, hip_thickness, foot_thickness);  
222         pickup pencircle scaled stemthickness;
223         draw (0, 0) .. (0,-2 interline);
224 fet_endchar;
226 fet_beginchar("8th (down)", "d3", "deighthflag")
227         save flare, 
228                 hip_depth_ratio, hip_width,
229                 foot_depth, foot_width_ratio;
230         save flagspace, total_depth, flag_count;
231         
232         flag_count = 1;
233         flare# = .99 interline#;
234         flagspace# = .9 interline#;     
235         hip_depth_ratio = .72 ;
236         hip_width# = downflag_width# - hip_thickness#/2;
237         total_depth# = 2.85 interline#;
238         (flag_count-1) * flagspace# + foot_depth# = total_depth#;
240         foot_width_ratio = .8;
242         set_char_box(stemthickness# /2, hip_width#
243                 + stemthickness#/2, 
244                 total_depth# + foot_thickness#/2, stemthickness#/2)
246         define_pixels(flare, hip_width, hip_thickness,
247                 flagspace,
248                 foot_depth,  foot_thickness);
250         draw_flag((stemthickness/2,- (flag_count-1) *flagspace), flare, 
251                 (hip_width, foot_depth), 
252                 hip_depth_ratio,foot_width_ratio, hip_thickness, foot_thickness);
255         pickup pencircle scaled stemthickness;
256         draw (0, 0) .. (0,-2 interline);
257         y_mirror_char;
258 fet_endchar;
260 fet_beginchar("16th (down)", "d4", "dsixteenthflag")
261         save flare, 
262                 hip_depth_ratio, hip_width,
263                 foot_depth, foot_width_ratio;
264         save flagspace, total_depth, flag_count;
265         
266         flag_count = 2;
267         flare# = .8 interline#;
268         flagspace# = .9 interline#;     
269         hip_depth_ratio = .85 ;
270         hip_width# = downflag_width# - hip_thickness#/2;
271         total_depth# = 3.0 interline#;
272         (flag_count-1) * flagspace# + foot_depth# = total_depth#;
274         foot_width_ratio = .95;
276         set_char_box(stemthickness# /2, hip_width#
277                 + stemthickness#/2, 
278                 total_depth# + foot_thickness#/2, stemthickness#/2)
280         define_pixels(flare, hip_width, hip_thickness,
281                 flagspace,
282                 foot_depth,  foot_thickness);
284         draw_flag((stemthickness/2,- (flag_count-1) *flagspace), flare, 
285                 (hip_width, foot_depth), 
286                 hip_depth_ratio,foot_width_ratio, hip_thickness, foot_thickness);
287         add_flag(flagspace, flare,
288                 .95, 1.00, 1.25, hip_thickness, foot_thickness);  
290         
292         pickup pencircle scaled stemthickness;
293         draw (0, 0) .. (0,-2 interline);
294         y_mirror_char;
295 fet_endchar;
297 fet_beginchar("32nd (down)", "d5", "dthirtysecondflag")
298         save flare, 
299                 hip_depth_ratio, hip_width,
300                 foot_depth, foot_width_ratio;
301         save flagspace, total_depth, flag_count;
302         
303         flag_count = 3;
304         flare# = .84 interline#;
305         flagspace# = .9 interline#;     
306         hip_depth_ratio = .85 ;
307         hip_width# = downflag_width# - hip_thickness#/2;
308         total_depth# = 3.85 interline#;
309         (flag_count-1) * flagspace# + foot_depth# = total_depth#;
311         foot_width_ratio = .95;
313         set_char_box(stemthickness# /2, hip_width#
314                 + stemthickness#/2, 
315                 total_depth# + foot_thickness#/2, stemthickness#/2)
317         define_pixels(flare, hip_width, hip_thickness,
318                 flagspace,
319                 foot_depth,  foot_thickness);
321         draw_flag((stemthickness/2,- (flag_count-1) *flagspace), flare, 
322                 (hip_width, foot_depth), 
323                 hip_depth_ratio,foot_width_ratio, hip_thickness, foot_thickness);
324         add_flag(flagspace, flare,
325                 .97, 1.00, 1.25, hip_thickness, foot_thickness);  
327         add_flag(flagspace, flare,
328                 .95, 1.05, 1.25, hip_thickness, foot_thickness);  
330         
332         pickup pencircle scaled stemthickness;
333         draw (0, 0) .. (0,-2 interline);
334         y_mirror_char;
335 fet_endchar;
336 fet_beginchar("64th (down)", "d6", "dsixtyfourthflag")
337         save flare, 
338                 hip_depth_ratio, hip_width,
339                 foot_depth, foot_width_ratio;
340         save flagspace, total_depth, flag_count;
341         
342         flag_count = 4;
343         flare# = .8 interline#;
344         flagspace# = .9 interline#;     
345         hip_depth_ratio = .85 ;
346         hip_width# = downflag_width# - hip_thickness#/2;
347         total_depth# = 4.35 interline#;
348         (flag_count-1) * flagspace# + foot_depth# = total_depth#;
350         foot_width_ratio = .98;
352         set_char_box(stemthickness# /2, hip_width#
353                 + stemthickness#/2, 
354                 total_depth# + foot_thickness#/2, stemthickness#/2)
356         define_pixels(flare, hip_width, hip_thickness,
357                 flagspace,
358                 foot_depth,  foot_thickness);
360         draw_flag((stemthickness/2,- (flag_count-1) *flagspace), flare, 
361                 (hip_width, foot_depth), 
362                 hip_depth_ratio,foot_width_ratio, hip_thickness, foot_thickness);
363         add_flag(flagspace, flare,
364                 .97, 1.20, 1.175, hip_thickness, foot_thickness);  
365         add_flag(flagspace, flare,
366                 .97, 1.10, 1.175, hip_thickness, foot_thickness);  
368         add_flag(flagspace, flare,
369                 .9, 1.03, 1.175, hip_thickness, foot_thickness);  
371         
373         pickup pencircle scaled stemthickness;
374         draw (0, 0) .. (0,-2 interline);
375         y_mirror_char;
376 fet_endchar;
377 fet_endgroup("flags");