]> git.donarmstrong.com Git - lilypond.git/blobdiff - mf/parmesan-flags.mf
Run `make grand-replace'.
[lilypond.git] / mf / parmesan-flags.mf
index 3e381e451682b44fe3e7ccd4cadc5f9a3425d07d..6b6343b42446be80404e7bab20611ff902635eaf 100644 (file)
@@ -1,31 +1,24 @@
-% flags 
-%
+% -%-Fundamental-%- -*-Metafont-*-
+% parmesan-flags.mf -- implement ancient flags
+% 
+% source file of LilyPond's pretty-but-neat music font
+% 
+% (c) 2001--2008 Juergen Reuter <reuter@ipd.uka.de>
+% 
 
+fet_begingroup ("flags");
 
-fet_begingroup("flags")
-save outer_path;
-path outer_path;
-% Flags pointing down overlap with  the notehead (in x-direction), so 
-% the down-flag can be bigger
-upflag_width# = .750 black_notehead_width# + stemthickness#/2;
-downflag_width# = .833 black_notehead_width# + stemthickness#/2;
+save between_staff_lines, on_staff_line, anywhere;
 
-right_upflag_space# = .2 upflag_width#;
-right_downflag_space# = .2 downflag_width#;
+between_staff_lines := 0;
+on_staff_line := 1;
+anywhere := 2;
 
-%
-% Flags pointing down cannot overlap with the notehead in y-direction,
-% so they have less slant.
+save dir_up, dir_down;
 
-% Because of optical illusion, the utmost flag (bottom for
-% down-pointing, top for up-pointing) should be smaller than the other
-% flags.  Adobe Sonata doesn't do this correctly.  (Instead they have
-% an extension flag, which looks less elegant)
-%
+dir_up := 1;
+dir_down := -1;
 
-save hip_thickness, foot_thickness;
-hip_thickness# = 1.3 stemthickness#;
-foot_thickness# =  hip_thickness#;
 
 %%%%%%%%
 %
@@ -36,436 +29,298 @@ foot_thickness# =  hip_thickness#;
 %
 %
 
-def draw_mensural_outermost_flag_i =
-       define_pixels(stafflinethickness, staff_space)
-
-       pickup pencircle
-               xscaled 1.00 stafflinethickness
-               yscaled 0.22 staff_space
-               rotated -35;
-
-       save za, zb, zc, zd, ze;
-       pair za, zb, zc, zd, ze;
-
-       za = (+0.00 staff_space, -0.00 staff_space);
-       zb = (+0.15 staff_space, -0.00 staff_space);
-       zc = (+0.45 staff_space, -0.35 staff_space);
-       zd = (+0.45 staff_space, -0.85 staff_space);
-       ze = (+0.00 staff_space, -2.00 staff_space);
-
-       draw za .. zb -- zc{zc-zb} .. {ze-zd}zd -- ze;
+def draw_mensural_outermost_flare (expr staffline_adjustment, d_) =
+       define_pixels (linethickness, staff_space);
+
+       save ellipse, pat, T;
+       path ellipse, pat;
+       transform T;
+
+       T := identity xscaled 1.00 linethickness
+                     yscaled 0.22 staff_space
+                     rotated -35;
+       pickup pencircle transformed T;
+       ellipse := fullcircle transformed T;    
+
+       z11 = (+0.00 staff_space, -0.00 staff_space);
+       z12 = (+0.15 staff_space, -0.00 staff_space);
+
+       if staffline_adjustment = between_staff_lines:
+               z13 = (+0.45 staff_space, -0.35 staff_space);
+               z14 = (+0.45 staff_space, -0.85 staff_space);
+               z15 = (+0.00 staff_space, -2.00 staff_space);
+       elseif staffline_adjustment = on_staff_line:
+               z13 = (+0.20 staff_space, -0.05 staff_space);
+               z14 = (+0.20 staff_space, -1.15 staff_space);
+               z15 = (+0.00 staff_space, -1.40 staff_space);
+       else: % staffline_adjustment = anywhere
+               z13 = (+0.33 staff_space, -0.20 staff_space);
+               z14 = (+0.33 staff_space, -1.00 staff_space);
+               z15 = (+0.00 staff_space, -1.70 staff_space);
+       fi;
+
+       pat := z13{z13 - z12}
+              .. {z15 - z14}z14;
+
+       fill get_subpath (ellipse, z11 - z12, z12 - z11, z11)
+            -- get_subpoint (ellipse, z12 - z11, z12)
+            -- get_subpoint (ellipse, z13 - z12, z12)
+            -- get_subpoint (ellipse, direction 0 of pat, z13)
+                 {direction 0 of pat}
+            .. {direction 1 of pat}
+                 get_subpoint (ellipse, direction 1 of pat, z14)
+            -- get_subpath (ellipse, z15 - z14, z14 - z15, z15)
+            -- get_subpoint (ellipse, -direction 1 of pat, z14)
+                 {-direction 1 of pat}
+            .. {-direction 0 of pat}
+                 get_subpoint (ellipse, -direction 0 of pat, z13)
+            -- get_subpath (ellipse, z12 - z13, z11 - z12, z12)
+            -- cycle;
+
+       if d_ = dir_up:
+               labels (11, 12, 13, 14, 15);
+       fi;
 enddef;
 
-def draw_mensural_outermost_flag_ii =
-       define_pixels(stafflinethickness, staff_space)
-
-       pickup pencircle
-               xscaled 1.00 stafflinethickness
-               yscaled 0.22 staff_space
-               rotated -35;
-
-       save za, zb, zc, zd, ze;
-       pair za, zb, zc, zd, ze;
 
-       za = (+0.00 staff_space, -0.00 staff_space);
-       zb = (+0.15 staff_space, -0.00 staff_space);
-       zc = (+0.20 staff_space, -0.05 staff_space);
-       zd = (+0.20 staff_space, -1.15 staff_space);
-       ze = (+0.00 staff_space, -1.40 staff_space);
-
-       draw za .. zb -- zc{zc-zb} .. {ze-zd}zd -- ze;
+def draw_mensural_inner_flare (expr il_shift, idx, d_) =
+       define_pixels (linethickness, staff_space);
+
+       save ellipse, pat, T;
+       path ellipse, pat;
+       transform T;
+
+       T := identity xscaled 1.00 linethickness
+                     yscaled 0.22 staff_space
+                     rotated -35;
+       pickup pencircle transformed T;
+       ellipse := fullcircle transformed T;    
+
+       save i;
+       numeric i[];
+
+       i0 := idx * 10;
+       i1 := idx * 10 + 1;
+       i2 := idx * 10 + 2;
+       i3 := idx * 10 + 3;
+       i4 := idx * 10 + 4;
+
+       z[i0] = (0, -il_shift * staff_space);
+       z[i1] = z[i0] + (+0.00 staff_space, -0.10 staff_space);
+       z[i2] = z[i0] + (+0.33 staff_space, -0.30 staff_space);
+       z[i3] = z[i0] + (+0.33 staff_space, -0.70 staff_space);
+       z[i4] = z[i0] + (+0.00 staff_space, -0.90 staff_space);
+
+       pat := z[i1]{2, 1}
+              .. z[i2]
+              .. z[i3]
+              .. {-2, -1}z[i4];
+
+       % we avoid cusps originally present in `draw pat'
+       fill get_subpath (ellipse,
+                         -direction 0 of pat, direction 0 of pat, z[i1])
+            .. get_subpoint (ellipse, direction 1 of pat, z[i2])
+                 {direction 1 of pat}
+            .. get_subpoint (ellipse, direction 2 of pat, z[i3])
+                 {direction 2 of pat}
+            .. get_subpath (ellipse,
+                            direction 3 of pat, -direction 3 of pat, z[i4])
+            .. get_subpoint (ellipse, -direction 2 of pat, z[i3])
+                 {-direction 2 of pat}
+            .. get_subpoint (ellipse, -direction 1 of pat, z[i2])
+                 {-direction 1 of pat}
+            .. cycle;
+
+       if d_ = dir_up:
+               labels ([i0], [i1], [i2], [i3], [i4]);
+       fi;
 enddef;
 
-def draw_mensural_inner_flag(expr il_shift) =
-       define_pixels(stafflinethickness, staff_space)
-
-       pickup pencircle
-               xscaled 1.00 stafflinethickness
-               yscaled 0.22 staff_space
-               rotated -35;
-
-       save zs, za, zb, zc, zd;
-       pair zs, za, zb, zc, zd;
 
-       zs = (0, -il_shift * staff_space);
-       za = zs + (+0.00 staff_space, -0.10 staff_space);
-       zb = zs + (+0.33 staff_space, -0.30 staff_space);
-       zc = zs + (+0.33 staff_space, -0.70 staff_space);
-       zd = zs + (+0.00 staff_space, -0.90 staff_space);
-
-       draw za{2,1} .. zb .. zc .. {-2,-1}zd;
+def draw_mensural_flag (expr staffline_adjustment, flares, d_) =
+       save char_box_adjust, flare_shift;
+
+       if staffline_adjustment = between_staff_lines:
+               flare_shift := 0.5;
+       elseif staffline_adjustment = on_staff_line:
+               flare_shift := 0.0;
+       else: % staffline_adjustment = anywhere
+               flare_shift := 0.25;
+       fi;
+
+       char_box_adjust := flare_shift + 0.5;
+
+       if d_ = dir_up:
+               set_char_box (0,
+                             0.60 staff_space#,
+                             (flares + char_box_adjust) * staff_space#,
+                             0.10 staff_space#);
+       else: % d_ = dir_down
+               set_char_box (0.60 staff_space#,
+                             0,
+                             0.10 staff_space#,
+                             (flares + char_box_adjust) * staff_space#);
+       fi;
+
+       draw_mensural_outermost_flare (staffline_adjustment, d_);
+
+       for flare_count := 2 step 1 until 4:
+               if flares >= flare_count:
+                       draw_mensural_inner_flare (flare_shift
+                                                  + flare_count - 0.5,
+                                                  flare_count, d_);
+               fi;
+       endfor;
+
+       if d_ = dir_down:
+               currentpicture := currentpicture xscaled -1
+                                                yscaled -1;
+       fi;
 enddef;
 
-fet_beginchar("8th Mensural Flag (up)", "mensuralu03", "menseighthflag")
-       set_char_box(0, 0.60 staff_space#, 2.00 staff_space#, 0)
-       draw_mensural_outermost_flag_i
-fet_endchar;
 
-fet_beginchar("8th Mensural Flag (up)", "mensuralu13", "mens1eighthflag")
-       set_char_box(0, 0.60 staff_space#, 1.50 staff_space#, 0)
-       draw_mensural_outermost_flag_ii
+% 8th mensural flag, upwards, between staff lines
+fet_beginchar ("8th Mensural Flag (up)", "mensuralu03");
+       draw_mensural_flag (between_staff_lines, 1, dir_up);
 fet_endchar;
 
-fet_beginchar("8th Mensural Flag (down)", "mensurald03", "mensdeighthflag")
-       set_char_box(0.60 staff_space#, 0, 0, 2.00 staff_space#)
-       draw_mensural_outermost_flag_i
-       currentpicture := currentpicture xscaled -1 yscaled -1;
-fet_endchar;
 
-fet_beginchar("8th Mensural Flag (down)", "mensurald13", "mensd1eighthflag")
-       set_char_box(0.60 staff_space#, 0, 0, 1.50 staff_space#)
-       draw_mensural_outermost_flag_ii
-       currentpicture := currentpicture xscaled -1 yscaled -1;
+% 8th mensural flag, upwards, on staff line
+fet_beginchar ("8th Mensural Flag (up)", "mensuralu13");
+       draw_mensural_flag (on_staff_line, 1, dir_up);
 fet_endchar;
 
-fet_beginchar("16th Mensural Flag (up)", "mensuralu04", "menssixteenthflag")
-       set_char_box(0, 0.60 staff_space#, 3.00 staff_space#, 0)
-       draw_mensural_outermost_flag_i
-       draw_mensural_inner_flag(2.0)
-fet_endchar;
 
-fet_beginchar("16th Mensural Flag (up)", "mensuralu14", "mens1sixteenthflag")
-       set_char_box(0, 0.60 staff_space#, 3.00 staff_space#, 0)
-       draw_mensural_outermost_flag_ii
-       draw_mensural_inner_flag(1.5)
+% 8th mensural flag, upwards, anywhere
+fet_beginchar ("8th Mensural Flag (up)", "mensuralu23");
+       draw_mensural_flag (anywhere, 1, dir_up);
 fet_endchar;
 
-fet_beginchar("16th Mensural Flag (down)", "mensurald04", "mensdsixteenthflag")
-       set_char_box(0, 0.60 staff_space#, 3.00 staff_space#, 0)
-       draw_mensural_outermost_flag_i
-       draw_mensural_inner_flag(2.0)
-       currentpicture := currentpicture xscaled -1 yscaled -1;
-fet_endchar;
 
-fet_beginchar("16th Mensural Flag (down)", "mensurald14", "mensd1sixteenthflag")
-       set_char_box(0, 0.60 staff_space#, 3.00 staff_space#, 0)
-       draw_mensural_outermost_flag_ii
-       draw_mensural_inner_flag(1.5)
-       currentpicture := currentpicture xscaled -1 yscaled -1;
+% 8th mensural flag, downwards, between staff lines
+fet_beginchar ("8th Mensural Flag (down)", "mensurald03");
+       draw_mensural_flag (between_staff_lines, 1, dir_down);
 fet_endchar;
 
-fet_beginchar("32th Mensural Flag (up)", "mensuralu05", "mensthirtysecondflag")
-       set_char_box(0, 0.60 staff_space#, 3.00 staff_space#, 0)
-       draw_mensural_outermost_flag_i
-       draw_mensural_inner_flag(2.0)
-       draw_mensural_inner_flag(3.0)
-fet_endchar;
 
-fet_beginchar("32th Mensural Flag (up)", "mensuralu15", "mens1thirtysecondflag")
-       set_char_box(0, 0.60 staff_space#, 3.00 staff_space#, 0)
-       draw_mensural_outermost_flag_ii
-       draw_mensural_inner_flag(1.5)
-       draw_mensural_inner_flag(2.5)
+% 8th mensural flag, downwards, on staff line
+fet_beginchar ("8th Mensural Flag (down)", "mensurald13");
+       draw_mensural_flag (on_staff_line, 1, dir_down);
 fet_endchar;
 
-fet_beginchar("32th Mensural Flag (down)", "mensurald05", "mensdthirtysecondflag")
-       set_char_box(0, 0.60 staff_space#, 3.00 staff_space#, 0)
-       draw_mensural_outermost_flag_i
-       draw_mensural_inner_flag(2.0)
-       draw_mensural_inner_flag(3.0)
-       currentpicture := currentpicture xscaled -1 yscaled -1;
-fet_endchar;
 
-fet_beginchar("32th Mensural Flag (down)", "mensurald15", "mensd1thirtysecondflag")
-       set_char_box(0, 0.60 staff_space#, 3.00 staff_space#, 0)
-       draw_mensural_outermost_flag_ii
-       draw_mensural_inner_flag(1.5)
-       draw_mensural_inner_flag(2.5)
-       currentpicture := currentpicture xscaled -1 yscaled -1;
+% 8th mensural flag, downwards, anywhere
+fet_beginchar ("8th Mensural Flag (down)", "mensurald23");
+       draw_mensural_flag (anywhere, 1, dir_down);
 fet_endchar;
 
-fet_beginchar("64th Mensural Flag (up)", "mensuralu06", "menssixtyfourthflag")
-       set_char_box(0, 0.60 staff_space#, 3.00 staff_space#, 0)
-       draw_mensural_outermost_flag_i
-       draw_mensural_inner_flag(1.5)
-       draw_mensural_inner_flag(2.5)
-       draw_mensural_inner_flag(3.5)
-fet_endchar;
 
-fet_beginchar("64th Mensural Flag (up)", "mensuralu16", "mens1sixtyfourthflag")
-       set_char_box(0, 0.60 staff_space#, 3.00 staff_space#, 0)
-       draw_mensural_outermost_flag_ii
-       draw_mensural_inner_flag(1.17)
-       draw_mensural_inner_flag(2.08)
-       draw_mensural_inner_flag(3.00)
+% 16th mensural flag, upwards, between staff lines
+fet_beginchar ("16th Mensural Flag (up)", "mensuralu04");
+       draw_mensural_flag (between_staff_lines, 2, dir_up);
 fet_endchar;
 
-fet_beginchar("64th Mensural Flag (down)", "mensurald06", "mensdsixtyfourthflag")
-       set_char_box(0, 0.60 staff_space#, 3.00 staff_space#, 0)
-       draw_mensural_outermost_flag_i
-       draw_mensural_inner_flag(1.5)
-       draw_mensural_inner_flag(2.5)
-       draw_mensural_inner_flag(3.5)
-       currentpicture := currentpicture xscaled -1 yscaled -1;
-fet_endchar;
 
-fet_beginchar("64th Mensural Flag (down)", "mensurald16", "mensd1sixtyfourthflag")
-       set_char_box(0, 0.60 staff_space#, 3.00 staff_space#, 0)
-       draw_mensural_outermost_flag_ii
-       draw_mensural_inner_flag(1.17)
-       draw_mensural_inner_flag(2.08)
-       draw_mensural_inner_flag(3.00)
-       currentpicture := currentpicture xscaled -1 yscaled -1;
+% 16th mensural flag, upwards, on staff line
+fet_beginchar ("16th Mensural Flag (up)", "mensuralu14");
+       draw_mensural_flag (on_staff_line, 2, dir_up);
 fet_endchar;
 
-%%%%%%%%
-%
-%
-%
-% Mensural Notation
-%
-%
-%
-
-def draw_mensural_outermost_flag_i =
-       define_pixels(stafflinethickness, staff_space)
-
-       pickup pencircle
-               xscaled 1.00 stafflinethickness
-               yscaled 0.22 staff_space
-               rotated -35;
-
-       save za, zb, zc, zd, ze;
-       pair za, zb, zc, zd, ze;
-
-       za = (+0.00 staff_space, -0.00 staff_space);
-       zb = (+0.15 staff_space, -0.00 staff_space);
-       zc = (+0.45 staff_space, -0.35 staff_space);
-       zd = (+0.45 staff_space, -0.85 staff_space);
-       ze = (+0.00 staff_space, -2.00 staff_space);
-
-       draw za .. zb -- zc{zc-zb} .. {ze-zd}zd -- ze;
-enddef;
 
-def draw_mensural_outermost_flag_ii =
-       define_pixels(stafflinethickness, staff_space)
-
-       pickup pencircle
-               xscaled 1.00 stafflinethickness
-               yscaled 0.22 staff_space
-               rotated -35;
-
-       save za, zb, zc, zd, ze;
-       pair za, zb, zc, zd, ze;
-
-       za = (+0.00 staff_space, -0.00 staff_space);
-       zb = (+0.15 staff_space, -0.00 staff_space);
-       zc = (+0.20 staff_space, -0.05 staff_space);
-       zd = (+0.20 staff_space, -1.15 staff_space);
-       ze = (+0.00 staff_space, -1.40 staff_space);
-
-       draw za .. zb -- zc{zc-zb} .. {ze-zd}zd -- ze;
-enddef;
-
-def draw_mensural_inner_flag(expr il_shift) =
-       define_pixels(stafflinethickness, staff_space)
-
-       pickup pencircle
-               xscaled 1.00 stafflinethickness
-               yscaled 0.22 staff_space
-               rotated -35;
-
-       save zs, za, zb, zc, zd;
-       pair zs, za, zb, zc, zd;
-
-       zs = (0, -il_shift * staff_space);
-       za = zs + (+0.00 staff_space, -0.10 staff_space);
-       zb = zs + (+0.33 staff_space, -0.30 staff_space);
-       zc = zs + (+0.33 staff_space, -0.70 staff_space);
-       zd = zs + (+0.00 staff_space, -0.90 staff_space);
+% 16th mensural flag, upwards, anywhere
+fet_beginchar ("16th Mensural Flag (up)", "mensuralu24");
+       draw_mensural_flag (anywhere, 2, dir_up);
+fet_endchar;
 
-       draw za{2,1} .. zb .. zc .. {-2,-1}zd;
-enddef;
 
-fet_beginchar("8th Mensural Flag (up)", "mensuralu03", "menseighthflag")
-       set_char_box(0, 0.60 staff_space#, 2.00 staff_space#, 0)
-       draw_mensural_outermost_flag_i
+% 16th mensural flag, downwards, between staff lines
+fet_beginchar ("16th Mensural Flag (down)", "mensurald04");
+       draw_mensural_flag (between_staff_lines, 2, dir_down);
 fet_endchar;
 
-fet_beginchar("8th Mensural Flag (up)", "mensuralu13", "mens1eighthflag")
-       set_char_box(0, 0.60 staff_space#, 1.50 staff_space#, 0)
-       draw_mensural_outermost_flag_ii
-fet_endchar;
 
-fet_beginchar("8th Mensural Flag (down)", "mensurald03", "mensdeighthflag")
-       set_char_box(0.60 staff_space#, 0, 0, 2.00 staff_space#)
-       draw_mensural_outermost_flag_i
-       currentpicture := currentpicture xscaled -1 yscaled -1;
+% 16th mensural flag, downwards, on staff line
+fet_beginchar ("16th Mensural Flag (down)", "mensurald14");
+       draw_mensural_flag (on_staff_line, 2, dir_down);
 fet_endchar;
 
-fet_beginchar("8th Mensural Flag (down)", "mensurald13", "mensd1eighthflag")
-       set_char_box(0.60 staff_space#, 0, 0, 1.50 staff_space#)
-       draw_mensural_outermost_flag_ii
-       currentpicture := currentpicture xscaled -1 yscaled -1;
-fet_endchar;
 
-fet_beginchar("16th Mensural Flag (up)", "mensuralu04", "menssixteenthflag")
-       set_char_box(0, 0.60 staff_space#, 3.00 staff_space#, 0)
-       draw_mensural_outermost_flag_i
-       draw_mensural_inner_flag(2.0)
+% 16th mensural flag, downwards, anywhere
+fet_beginchar ("16th Mensural Flag (down)", "mensurald24");
+       draw_mensural_flag (anywhere, 2, dir_down);
 fet_endchar;
 
-fet_beginchar("16th Mensural Flag (up)", "mensuralu14", "mens1sixteenthflag")
-       set_char_box(0, 0.60 staff_space#, 3.00 staff_space#, 0)
-       draw_mensural_outermost_flag_ii
-       draw_mensural_inner_flag(1.5)
-fet_endchar;
 
-fet_beginchar("16th Mensural Flag (down)", "mensurald04", "mensdsixteenthflag")
-       set_char_box(0, 0.60 staff_space#, 3.00 staff_space#, 0)
-       draw_mensural_outermost_flag_i
-       draw_mensural_inner_flag(2.0)
-       currentpicture := currentpicture xscaled -1 yscaled -1;
+% 32th mensural flag, upwards, between staff lines
+fet_beginchar ("32th Mensural Flag (up)", "mensuralu05");
+       draw_mensural_flag (between_staff_lines, 3, dir_up);
 fet_endchar;
 
-fet_beginchar("16th Mensural Flag (down)", "mensurald14", "mensd1sixteenthflag")
-       set_char_box(0, 0.60 staff_space#, 3.00 staff_space#, 0)
-       draw_mensural_outermost_flag_ii
-       draw_mensural_inner_flag(1.5)
-       currentpicture := currentpicture xscaled -1 yscaled -1;
-fet_endchar;
 
-fet_beginchar("32th Mensural Flag (up)", "mensuralu05", "mensthirtysecondflag")
-       set_char_box(0, 0.60 staff_space#, 3.00 staff_space#, 0)
-       draw_mensural_outermost_flag_i
-       draw_mensural_inner_flag(2.0)
-       draw_mensural_inner_flag(3.0)
+% 32th mensural flag, upwards, on staff line
+fet_beginchar ("32th Mensural Flag (up)", "mensuralu15");
+       draw_mensural_flag (on_staff_line, 3, dir_up);
 fet_endchar;
 
-fet_beginchar("32th Mensural Flag (up)", "mensuralu15", "mens1thirtysecondflag")
-       set_char_box(0, 0.60 staff_space#, 3.00 staff_space#, 0)
-       draw_mensural_outermost_flag_ii
-       draw_mensural_inner_flag(1.5)
-       draw_mensural_inner_flag(2.5)
-fet_endchar;
 
-fet_beginchar("32th Mensural Flag (down)", "mensurald05", "mensdthirtysecondflag")
-       set_char_box(0, 0.60 staff_space#, 3.00 staff_space#, 0)
-       draw_mensural_outermost_flag_i
-       draw_mensural_inner_flag(2.0)
-       draw_mensural_inner_flag(3.0)
-       currentpicture := currentpicture xscaled -1 yscaled -1;
+% 32th mensural flag, upwards, anywhere
+fet_beginchar ("32th Mensural Flag (up)", "mensuralu25");
+       draw_mensural_flag (anywhere, 3, dir_up);
 fet_endchar;
 
-fet_beginchar("32th Mensural Flag (down)", "mensurald15", "mensd1thirtysecondflag")
-       set_char_box(0, 0.60 staff_space#, 3.00 staff_space#, 0)
-       draw_mensural_outermost_flag_ii
-       draw_mensural_inner_flag(1.5)
-       draw_mensural_inner_flag(2.5)
-       currentpicture := currentpicture xscaled -1 yscaled -1;
-fet_endchar;
 
-fet_beginchar("64th Mensural Flag (up)", "mensuralu06", "menssixtyfourthflag")
-       set_char_box(0, 0.60 staff_space#, 3.00 staff_space#, 0)
-       draw_mensural_outermost_flag_i
-       draw_mensural_inner_flag(1.5)
-       draw_mensural_inner_flag(2.5)
-       draw_mensural_inner_flag(3.5)
+% 32th mensural flag, downwards, between staff lines
+fet_beginchar ("32th Mensural Flag (down)", "mensurald05");
+       draw_mensural_flag (between_staff_lines, 3, dir_down);
 fet_endchar;
 
-fet_beginchar("64th Mensural Flag (up)", "mensuralu16", "mens1sixtyfourthflag")
-       set_char_box(0, 0.60 staff_space#, 3.00 staff_space#, 0)
-       draw_mensural_outermost_flag_ii
-       draw_mensural_inner_flag(1.17)
-       draw_mensural_inner_flag(2.08)
-       draw_mensural_inner_flag(3.00)
-fet_endchar;
 
-fet_beginchar("64th Mensural Flag (down)", "mensurald06", "mensdsixtyfourthflag")
-       set_char_box(0, 0.60 staff_space#, 3.00 staff_space#, 0)
-       draw_mensural_outermost_flag_i
-       draw_mensural_inner_flag(1.5)
-       draw_mensural_inner_flag(2.5)
-       draw_mensural_inner_flag(3.5)
-       currentpicture := currentpicture xscaled -1 yscaled -1;
+% 32th mensural flag, downwards, on staff line
+fet_beginchar ("32th Mensural Flag (down)", "mensurald15");
+       draw_mensural_flag (on_staff_line, 3, dir_down);
 fet_endchar;
 
-fet_beginchar("64th Mensural Flag (down)", "mensurald16", "mensd1sixtyfourthflag")
-       set_char_box(0, 0.60 staff_space#, 3.00 staff_space#, 0)
-       draw_mensural_outermost_flag_ii
-       draw_mensural_inner_flag(1.17)
-       draw_mensural_inner_flag(2.08)
-       draw_mensural_inner_flag(3.00)
-       currentpicture := currentpicture xscaled -1 yscaled -1;
-fet_endchar;
 
-%%%%%%%%
-%
-%
-%
-% Single Stroke for Short Appogiatura
-%
-%
-%
+% 32th mensural flag, downwards, anywhere
+fet_beginchar ("32th Mensural Flag (down)", "mensurald25");
+       draw_mensural_flag (anywhere, 3, dir_down);
+fet_endchar;
 
-fet_beginchar("grace dash (up)", "ugrace", "gracedash")
-       save flare, 
-               hip_depth_ratio, hip_width,
-               foot_depth;
 
-       flare# = 1.0 staff_space#;
-       hip_depth_ratio = .72; 
-       hip_width# = upflag_width# - hip_thickness#/2;
+% 64th mensural flag, upwards, between staff lines
+fet_beginchar ("64th Mensural Flag (up)", "mensuralu06");
+       draw_mensural_flag (between_staff_lines, 4, dir_up);
+fet_endchar;
 
-       foot_depth# =  3 staff_space#;
 
-       define_pixels(flare, hip_width, hip_thickness,
-               foot_depth, foot_thickness);
+% 64th mensural flag, upwards, on staff line
+fet_beginchar ("64th Mensural Flag (up)", "mensuralu16");
+       draw_mensural_flag (on_staff_line, 4, dir_up);
+fet_endchar;
 
-       set_char_box(hip_width# * hip_depth_ratio,
-         hip_width# + stemthickness#/2 + right_upflag_space#, 
-         foot_depth# * hip_depth_ratio, -flare#)
 
-       pickup pencircle scaled 1.5 stemthickness;
-       draw (-b ,-d) ..
-         (w, h);
+% 64th mensural flag, upwards, anywhere
+fet_beginchar ("64th Mensural Flag (up)", "mensuralu26");
+       draw_mensural_flag (anywhere, 4, dir_up);
 fet_endchar;
 
-fet_beginchar("grace dash (down)", "dgrace", "dgracedash")
-       save flare, hip_depth_ratio, hip_width, foot_depth;
-       save flagspace, total_depth, flag_count;
-       
-       flag_count = 1;
-       flare# = .99 staff_space#;
-       flagspace# = .9 staff_space#;   
-       hip_depth_ratio = .72 ;
-       hip_width# = downflag_width# - hip_thickness#/2;
-       total_depth# = 2.85 staff_space#;
-       (flag_count-1) * flagspace# + foot_depth# = total_depth#;
-
-       foot_width_ratio = .8;
-
-       define_pixels(flare, hip_width, hip_thickness,
-               flagspace, foot_depth);
-
-       set_char_box(hip_width# * hip_depth_ratio,
-         hip_width# + stemthickness#/2 + right_downflag_space#,
-         foot_depth# * hip_depth_ratio, -flare#)
-
-       pickup pencircle scaled 1.5 stemthickness;
-       draw (-b, -d) .. (w,h);
-       y_mirror_char;
+
+% 64th mensural flag, downwards, between staff lines
+fet_beginchar ("64th Mensural Flag (down)", "mensurald06");
+       draw_mensural_flag (between_staff_lines, 4, dir_down);
 fet_endchar;
 
-% ustem?
-%
-%
-% Stem characters so we can compose metronome markings with Feta
-% entirely.
-%
 
-fet_beginchar("stem (up)", "stem", "stem")
-       set_char_box(stemthickness#/2, stemthickness#/2, 0, 3.5staff_space#);
-       pickup pencircle scaled stemthickness;
-       draw (0, 0.2staff_space) .. (0, 3.5staff_space);
+% 64th mensural flag, downwards, on staff line
+fet_beginchar ("64th Mensural Flag (down)", "mensurald16");
+       draw_mensural_flag (on_staff_line, 4, dir_down);
 fet_endchar;
 
-% do we want this?
-fet_beginchar("stem (down)", "dstem", "dstem")
-       set_char_box(stemthickness#/2, stemthickness#/2, 3.5staff_space#, 0);
-       pickup pencircle scaled stemthickness;
-       draw (0, -0.2staff_space) .. (0, -3.5staff_space);
+
+% 64th mensural flag, downwards, anywhere
+fet_beginchar ("64th Mensural Flag (down)", "mensurald26");
+       draw_mensural_flag (anywhere, 4, dir_down);
 fet_endchar;
 
 
-fet_endgroup("flags");
+fet_endgroup ("flags");