5 fet_begingroup ("flags")
11 % Flags pointing down overlap with the notehead (in x-direction), so
12 % the down-flag can be bigger.
15 upflag_width# = .65 black_notehead_width# + stemthickness# / 2;
16 downflag_width# = .833 black_notehead_width# + stemthickness# / 2;
18 right_upflag_space# = .0 upflag_width#;
19 right_downflag_space# = .0 downflag_width#;
22 % Flags pointing down cannot overlap with the notehead in y-direction,
23 % so they have less slant.
25 % Because of optical illusion, the utmost flag (bottom for
26 % down-pointing, top for up-pointing) should be smaller than the other
27 % flags. Adobe Sonata doesn't do this correctly. (Instead they have
28 % an extension flag, which looks less elegant)
31 save hip_thickness, foot_thickness;
33 hip_thickness# = 1.0 linethickness# + 0.069 staff_space#;
34 foot_thickness# = 1.2055 linethickness# + 0.06 staff_space#;
37 % Inspired by Adobe Sonata and [Wanske].
38 % For example, see POSTSCRIPT Language -- program design,
39 % page 119, and [Wanske], p 41, 42.
42 def draw_flag (expr center, flare, dims, hip_depth, foot_wid,
43 hip_thickness, foot_thickness, show_labels) =
51 penpos2 (whatever, 0);
53 x2r - x2l = hip_thickness;
55 penpos3 (foot_thickness, -20.0);
58 z2r = center + (xpart (dims), -ypart (dims) * hip_depth);
59 z3r = center + (xpart (dims) * foot_wid, -ypart (dims));
61 outer_path := z3r{curl c} .. z2r{up} .. {up}z1r;
68 ..tension 1.1.. z2l{down}
69 .. {curl c}simple_serif (z3l, z3r, 80)
76 % TODO: calculate intersectpoint (see TeX book, p. 137)
77 % TODO: calculate incision_depth
80 def add_flag (expr yoff, flare, hip_wid_multiplier, hip_dep_multiplier,
81 intersectpoint, hip_thickness, foot_thickness) =
83 save prev_center, prev_xextreme, prev_yextreme;
84 save rel_foot, ip, center, incision_depth;
85 save prev_hipwid, prev_footdep, prev_hipdep, wid, dep, hip_dep;
86 save hip_dep_ratio, foot_wid_ratio;
87 pair prev_center, center, foot, prev_xextreme, prev_yextreme;
90 incision_depth = 1.013;
91 prev_center = point 2 of outer_path;
92 prev_xextreme = point 1 of outer_path;
93 prev_yextreme = point 0 of outer_path;
94 prev_hipwid = xpart (prev_xextreme - prev_center);
95 prev_footdep = -ypart (prev_yextreme - prev_center);
96 prev_hipdep = -ypart (prev_xextreme - prev_center);
97 ip = point intersectpoint of outer_path;
99 wid = prev_hipwid * hip_wid_multiplier;
100 hip_dep = prev_hipdep * hip_dep_multiplier;
102 center = prev_center + (0, yoff);
103 rel_foot = incision_depth [(wid, hip_dep), ip - center];
104 dep = -ypart (rel_foot);
105 foot_wid_ratio = xpart (rel_foot) / wid;
106 hip_dep_ratio = hip_dep / dep;
108 draw_flag (center, flare, (wid, dep),
109 hip_dep_ratio, foot_wid_ratio,
110 hip_thickness, foot_thickness, 0);
115 fet_beginchar ("8th Flag (up)", "u3")
116 save flare, hip_depth_ratio, hip_width, foot_depth, foot_width_ratio;
118 flare# = 1.0 staff_space#;
119 hip_depth_ratio = .72;
120 foot_width_ratio = .8;
121 hip_width# = upflag_width# - hip_thickness# / 2;
122 foot_depth# = 3 staff_space# - blot_diameter# / 2;
123 define_pixels (flare, hip_width, hip_thickness,
124 foot_depth, foot_thickness);
126 set_char_box (0, hip_width# + stemthickness# / 2 + right_upflag_space#,
127 foot_depth# + foot_thickness# / 2, stemthickness# / 2);
129 draw_flag ((0,0), flare, (hip_width, foot_depth),
130 hip_depth_ratio, foot_width_ratio,
131 hip_thickness, foot_thickness, 1);
133 draw_square_block ((-.5 stemthickness, -staff_space), (0, 0));
137 fet_beginchar ("16th Flag (up)", "u4")
138 save flare, hip_depth_ratio, hip_width, foot_depth, foot_width_ratio;
139 save flagspace, total_depth, flag_count;
140 total_depth# = 3.5 staff_space# - blot_diameter# / 2;
142 flare# = .85 staff_space#;
143 flagspace# = .85 staff_space#;
144 hip_depth_ratio = .72;
145 hip_width# = upflag_width# - hip_thickness# / 2;
146 flagspace# + foot_depth# = total_depth#;
147 foot_width_ratio = .8;
148 define_pixels (flare, hip_width, hip_thickness, flagspace,
149 foot_depth, foot_thickness);
152 hip_width# + stemthickness# / 2 + right_upflag_space#,
153 total_depth# + foot_thickness# / 2, stemthickness# / 2);
155 draw_flag ((0, -flagspace), flare, (hip_width, foot_depth),
156 hip_depth_ratio, foot_width_ratio,
157 hip_thickness, foot_thickness, 1);
159 add_flag (flagspace, flare, .97, 1.00, 1.25,
160 hip_thickness, foot_thickness);
162 draw_square_block ((-.5 stemthickness, 0), (0, -2 staff_space));
166 fet_beginchar ("32nd Flag (up)", "u5")
167 save flare, hip_depth_ratio, hip_width, foot_depth, foot_width_ratio;
168 save flagspace, total_depth, flag_count;
171 total_depth# = 4.25 staff_space#;
172 flare# = .85 staff_space#;
173 flagspace# = .87 staff_space#;
174 hip_depth_ratio = .72;
175 hip_width# = upflag_width# - hip_thickness# / 2;
176 foot_width_ratio = .8;
178 (flag_count - 1) * flagspace# + foot_depth# = total_depth#;
180 define_pixels (flare, hip_width, hip_thickness, flagspace,
181 foot_depth, foot_thickness);
183 set_char_box (0, hip_width# + right_upflag_space#,
184 total_depth# + foot_thickness# / 2, stemthickness# / 2);
186 draw_flag ((0, -2 flagspace), flare, (hip_width, foot_depth),
187 hip_depth_ratio, foot_width_ratio,
188 hip_thickness, foot_thickness, 1);
190 add_flag (flagspace, flare, .97, 1.00, 1.25,
191 hip_thickness, foot_thickness);
192 add_flag (flagspace, flare, .95, 1.05, 1.25,
193 hip_thickness, foot_thickness);
195 draw_square_block ((-.5 stemthickness, 0), (0, -3 staff_space));
199 fet_beginchar ("64th Flag (up)", "u6")
200 save flare, hip_depth_ratio, hip_width, foot_depth, foot_width_ratio;
201 save flagspace, total_depth, flag_count;
204 flare# = .85 staff_space#;
205 flagspace# = .9 staff_space#;
206 hip_depth_ratio = .72;
207 hip_width# = upflag_width# - hip_thickness# / 2;
208 total_depth# = 5.25 staff_space#;
209 foot_width_ratio = .8;
211 (flag_count - 1) * flagspace# + foot_depth# = total_depth#;
213 define_pixels (flare, hip_width, hip_thickness, flagspace,
214 foot_depth, foot_thickness);
216 set_char_box (0, hip_width# + right_upflag_space#,
217 total_depth# + foot_thickness# / 2, stemthickness# / 2);
219 draw_flag ((0, -(flag_count - 1) * flagspace), flare,
220 (hip_width, foot_depth),
221 hip_depth_ratio, foot_width_ratio,
222 hip_thickness, foot_thickness, 1);
224 add_flag (flagspace, flare, .97, 1.00, 1.3,
225 hip_thickness, foot_thickness);
226 add_flag (flagspace, flare, 1.00, 1.00, 1.25,
227 hip_thickness, foot_thickness);
228 add_flag (flagspace, flare, .95, 1.05, 1.25,
229 hip_thickness, foot_thickness);
231 draw_square_block ((-.5 stemthickness, 0), (0, -4 staff_space));
235 fet_beginchar ("8th (down)", "d3")
236 save flare, hip_depth_ratio, hip_width, foot_depth, foot_width_ratio;
237 save flagspace, total_depth, flag_count;
240 flare# = .99 staff_space#;
241 flagspace# = .9 staff_space#;
242 hip_depth_ratio = .72 ;
243 hip_width# = downflag_width# - hip_thickness# / 2;
244 total_depth# = 2.85 staff_space#;
245 foot_width_ratio = .8;
247 (flag_count - 1) * flagspace# + foot_depth# = total_depth#;
249 define_pixels (flare, hip_width, hip_thickness, flagspace,
250 foot_depth, foot_thickness);
252 set_char_box (0, hip_width# + right_downflag_space#,
253 total_depth# + foot_thickness# / 2, stemthickness# / 2)
255 draw_flag ((0, -(flag_count - 1) * flagspace), flare,
256 (hip_width, foot_depth),
257 hip_depth_ratio, foot_width_ratio,
258 hip_thickness, foot_thickness, 0);
260 draw_square_block ((-.5 stemthickness, 0), (0, -staff_space));
268 % Single Stroke for Short Appogiatura
271 fet_beginchar ("grace dash (up)", "ugrace")
272 save flare, hip_depth_ratio, hip_width, foot_depth;
274 flare# = staff_space#;
275 hip_depth_ratio = .72;
276 hip_width# = upflag_width# - hip_thickness# / 2;
277 foot_depth# = 3 staff_space#;
279 define_pixels (flare, hip_width, hip_thickness,
280 foot_depth, foot_thickness);
282 set_char_box (hip_width# * hip_depth_ratio,
283 hip_width# + right_upflag_space#,
284 foot_depth# * hip_depth_ratio, -flare#)
286 pickup pencircle scaled 1.5 stemthickness;
291 penpos1 (1.5 stemthickness, angle (z2 - z1) - 90);
292 penpos2 (1.5 stemthickness, angle (z2 - z1) - 90);
308 fet_beginchar ("grace dash (down)", "dgrace")
309 save flare, hip_depth_ratio, hip_width, foot_depth;
310 save flagspace, total_depth;
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 foot_depth# = total_depth#;
318 foot_width_ratio = .8;
320 define_pixels (flare, hip_width, hip_thickness,
321 flagspace, foot_depth);
323 set_char_box (hip_width# * hip_depth_ratio,
324 hip_width# + right_downflag_space#,
325 foot_depth# * hip_depth_ratio, -flare#)
327 pickup pencircle scaled 1.5 stemthickness;
332 penpos1 (1.5 stemthickness, angle (z2 - z1) - 90);
333 penpos2 (1.5 stemthickness, angle (z2 - z1) - 90);
349 fet_beginchar ("16th (down)", "d4")
350 save flare, hip_depth_ratio, hip_width, foot_depth, foot_width_ratio;
351 save flagspace, total_depth, flag_count;
354 flare# = .8 staff_space#;
355 flagspace# = .9 staff_space#;
356 hip_depth_ratio = .85;
357 hip_width# = downflag_width# - hip_thickness# / 2;
358 total_depth# = 3.0 staff_space# - blot_diameter# / 2;
359 foot_width_ratio = .95;
361 (flag_count - 1) * flagspace# + foot_depth# = total_depth#;
363 set_char_box (0, hip_width# + right_downflag_space#,
364 total_depth# + foot_thickness# / 2, stemthickness# / 2);
366 define_pixels (flare, hip_width, hip_thickness, flagspace,
367 foot_depth, foot_thickness);
369 draw_flag ((0, -(flag_count - 1) * flagspace), flare,
370 (hip_width, foot_depth),
371 hip_depth_ratio, foot_width_ratio,
372 hip_thickness, foot_thickness, 0);
374 add_flag (flagspace, flare, .95, 1.00, 1.25,
375 hip_thickness, foot_thickness);
377 draw_square_block ((-.5 stemthickness, 0), (0, -2 staff_space));
383 fet_beginchar ("32nd (down)", "d5")
384 save flare, hip_depth_ratio, hip_width, foot_depth, foot_width_ratio;
385 save flagspace, total_depth, flag_count;
388 flare# = .84 staff_space#;
389 flagspace# = .9 staff_space#;
390 hip_depth_ratio = .85;
391 hip_width# = downflag_width# - hip_thickness# / 2;
392 total_depth# = 3.85 staff_space#;
393 foot_width_ratio = .95;
395 (flag_count - 1) * flagspace# + foot_depth# = total_depth#;
397 define_pixels (flare, hip_width, hip_thickness, flagspace,
398 foot_depth, foot_thickness);
400 set_char_box (0, hip_width# + right_downflag_space#,
401 total_depth# + foot_thickness# / 2, stemthickness# / 2);
403 draw_flag ((0, -(flag_count - 1) * flagspace), flare,
404 (hip_width, foot_depth),
405 hip_depth_ratio, foot_width_ratio,
406 hip_thickness, foot_thickness, 0);
408 add_flag (flagspace, flare, .97, 1.00, 1.25,
409 hip_thickness, foot_thickness);
410 add_flag (flagspace, flare, .95, 1.05, 1.25,
411 hip_thickness, foot_thickness);
413 draw_square_block ((-.5 stemthickness, 0), (0, -3 staff_space));
419 fet_beginchar ("64th (down)", "d6")
420 save flare, hip_depth_ratio, hip_width, foot_depth, foot_width_ratio;
421 save flagspace, total_depth, flag_count;
424 flare# = .8 staff_space#;
425 flagspace# = .9 staff_space#;
426 hip_depth_ratio = .85;
427 hip_width# = downflag_width# - hip_thickness# / 2;
428 total_depth# = 4.35 staff_space#;
429 foot_width_ratio = .98;
431 (flag_count - 1) * flagspace# + foot_depth# = total_depth#;
433 define_pixels (flare, hip_width, hip_thickness, flagspace,
434 foot_depth, foot_thickness);
436 set_char_box (0, hip_width# + right_downflag_space#,
437 total_depth# + foot_thickness# / 2, stemthickness# / 2);
439 draw_flag ((0, -(flag_count - 1) * flagspace), flare,
440 (hip_width, foot_depth),
441 hip_depth_ratio, foot_width_ratio,
442 hip_thickness, foot_thickness, 0);
444 add_flag (flagspace, flare, .97, 1.20, 1.175,
445 hip_thickness, foot_thickness);
446 add_flag (flagspace, flare, .97, 1.10, 1.175,
447 hip_thickness, foot_thickness);
448 add_flag (.98 flagspace, flare, .91, 1.05, 1.2,
449 hip_thickness, foot_thickness);
451 draw_square_block ((-.5 stemthickness, 0), (0, -4 staff_space));
456 fet_endgroup ("flags");