Hi!

Below is a patch for 1.5.7 that introduces mensural flags.  However,
there are some open issues:

* There is no mensural 32nd or 64th note, but only fusa (8th) and
  semifusa (16th).  For completeness, I have nevertheless tried to
  design flags for 32nd and 64th, although they are my pure invention
  and unfortunately look a bit ugly.  Maybe you prefer to exclude
  them.

* I could not find any Petrucci semifusa, but only a semifusa of a
  not-so-nice print and in bad resolution.  Hence, my semifusa flag is
  a kind of interpolation between Petrucci's fusa flag (taken from
  Gombert, Missa De Media Vita, 1542), and some not-so-fine semifusa
  flag.  If somebody has a high-resolution facsimile of a Petrucci-like
  semifusa, please let me know.  I might then also enhance the 32nd
  and 64th flags.

* Petrucci (and other printers) used flags that are different for
  notes on staff lines and for notes between staff lines.  Obviously,
  the idea is to have each flag nicely aligned vertically with the
  staff lines, regardless of the y position and length of the stem.
  Consequently, there are four flags for each note (two up, two down).
  An additional "0" or "1" character in the font symbol name is used
  to differentiate between them.

* This requires special treatment for mensural flags, currently
  reflected by an if-statement with a hard-coded "mensural" string in
  stem.cc.  This is ugly, but I do not see any clean solution other
  than introducing yet another scheme function.

* ancient-font.ly now produces many "programming error: No spring
  between column XYZ and next one (Continuing; cross thumbs)", but the
  result looks ok.  This did not happen in 1.5.6 (under which I
  developed this patch).  Is this a bug in the simple spacing
  algorithm?

Greetings,
            Juergen
--- feta-banier.mf.orig Wed Jan 17 14:18:39 2001
+++ feta-banier.mf      Sat Aug 18 04:06:46 2001
@@ -229,29 +229,6 @@
        draw (0, 0) .. (0,-2 staff_space);
 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;
-
-       foot_depth# =  3 staff_space#;
-
-       define_pixels(flare, hip_width, hip_thickness,
-               foot_depth, foot_thickness);
-
-       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);
-fet_endchar;
-
 fet_beginchar("8th (down)", "d3", "deighthflag")
        save flare, 
                hip_depth_ratio, hip_width,
@@ -404,6 +381,218 @@
        y_mirror_char;
 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);
+
+       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
+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;
+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)
+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;
+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)
+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;
+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)
+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;
+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
+%
+%
+%
+
+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;
+
+       foot_depth# =  3 staff_space#;
+
+       define_pixels(flare, hip_width, hip_thickness,
+               foot_depth, foot_thickness);
+
+       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);
+fet_endchar;
 
 fet_beginchar("grace dash (down)", "dgrace", "dgracedash")
        save flare, hip_depth_ratio, hip_width, foot_depth;


###############################################################################


--- stem.cc.orig        Wed Jul 11 14:54:52 2001
+++ stem.cc     Sat Aug 18 04:24:00 2001
@@ -461,18 +461,65 @@
 Molecule
 Stem::flag (Grob*me)
 {
-  String style;
-  SCM st = me->get_grob_property ("flag-style");
-  if (gh_string_p (st))
+  // TODO: rename flag-style into something more appropriate,
+  // e.g. "stroke-style", maybe with values "" (i.e. no stroke),
+  // "single" and "double".  Needs more discussion.
+  String style, fstyle, stafflineOffs;
+  SCM fst = me->get_grob_property ("flag-style");
+  if (gh_string_p (fst))
     {
-      style = ly_scm2string (st);
+      fstyle = ly_scm2string (fst);
     }
 
+  SCM st = me->get_grob_property ("style");
+  if (gh_symbol_p (st))
+    {
+      style = (ly_scm2string (scm_symbol_to_string (st)));
+    }
+  else
+    {
+      style = "";
+    }
+  if (String::compare_i (style, "mensural") == 0)
+      // Mensural notation: For notes on staff lines, use different
+      // flags than for notes between staff lines.  The idea is that
+      // flags are always vertically aligned with the staff lines,
+      // regardless if the note head is on a staff line or between two
+      // staff lines.  In other words, the inner end of a flag always
+      // touches a staff line.
+    {
+       // Urrgh!  We have to detect wether this stem ends on a staff
+       // line or between two staff lines.  But we can not call
+       // stem_end_position(me) or get_default_stem_end_position(me),
+       // since this encounters the flag and hence results in an
+       // infinite recursion.  However, in pure mensural notation,
+       // there are no multiple note heads attached to a single stem,
+       // neither is there usually need for using the stem_shorten
+       // property (except for 32th and 64th notes, but that is not a
+       // problem since the stem length in this case is augmented by
+       // an integral multiple of staff_space).  Hence, it should be
+       // sufficient to just take the first note head, assume it's
+       // the only one, look if it's on a staff line, and select the
+       // flag's shape accordingly.  In the worst case, the shape
+       // looks slightly misplaced, but that will usually be the
+       // programmer's fault (e.g. when trying to attach multiple
+       // note heads to a single stem in mensural notation).
+       Grob *firstHead = first_head(me);
+       int sz = Staff_symbol_referencer::line_count (me)-1;
+       int p = (int)rint (Staff_symbol_referencer::position_f (firstHead));
+       stafflineOffs = (((p ^ sz) & 0x1) == 0) ? "1" : "0";
+    }
+  else
+    {
+       stafflineOffs = "";
+    }
   char c = (get_direction (me) == UP) ? 'u' : 'd';
-  Molecule m = Font_interface::get_default_font (me)->find_by_name (String ("flags-") 
+ to_str (c) + 
-                                     to_str (flag_i (me)));
-  if (!style.empty_b ())
-    m.add_molecule (Font_interface::get_default_font (me)->find_by_name (String 
("flags-") + to_str (c) + style));
+  Molecule m =
+      Font_interface::get_default_font (me)->
+      find_by_name (String ("flags-") + style + to_str (c) + stafflineOffs +
+                   to_str (flag_i (me)));
+  if (!fstyle.empty_b ())
+    m.add_molecule (Font_interface::get_default_font (me)->find_by_name (String 
+("flags-") + to_str (c) + fstyle));
   return m;
 }
 


###############################################################################


--- grob-property-description.scm.orig  Tue Aug 14 13:41:27 2001
+++ grob-property-description.scm       Fri Aug 17 22:41:48 2001
@@ -150,7 +150,7 @@
 slur dir) -> attachment to determine the attachment (see above).  If
 procedure returns #t, attachment is used.  Otherwise, the next
 procedure is tried.")
-(grob-property-description 'flag-style string? "style for flag (hook of a stem).")
+(grob-property-description 'flag-style string? "turn stroke through stem on/off.")
 (grob-property-description 'flag-width-function procedure? "Procedure that computes 
the width of a half-beam (a non-connecting beam.).")
 (grob-property-description 'font-family symbol? "partial font
 definition: music roman braces dynamic math ...")


###############################################################################


--- generic-property.scm.orig   Wed Mar 28 01:26:12 2001
+++ generic-property.scm        Fri Aug 17 22:42:46 2001
@@ -39,6 +39,7 @@
         (list 'verticalDirection dir? 'direction)       
         (list 'stemLength number? 'length)
         (list 'flagStyle string? 'flag-style)
+        (list 'style symbol? 'style)
         (list 'noStemExtend boolean? 'no-stem-extend)
         (list 'stemShorten number? 'shorten)
         ))


###############################################################################


--- ancient-font.ly.orig        Tue Aug 14 13:35:04 2001
+++ ancient-font.ly     Sat Aug 18 04:42:20 2001
@@ -107,6 +107,7 @@
       #'line-count = #5
     
     \notes \transpose c' {
+       \property Voice.noAutoBeaming = ##t
        \property Staff.KeySignature \override #'style = #'mensural
        \property Staff.Accidentals \override #'style = #'mensural
        \property Staff.Custos \override #'style = #'mensural
@@ -131,7 +132,11 @@
        e d c1 \bar "|"
 
         \property Voice.NoteHead \override #'style = #'mensural
+       \property Voice.Stem \override #'style = #'mensural
+       \property Voice.Stem \override #'thickness = #1.0
        \clef "petrucci_f"
+       c8 b, c16 b, c32 b, c64 b, c b,
+       d8 e  d16 e  d32 e  d64 e  d e
        c2 d e f g
         \property Staff.forceClef = ##t
        \clef "petrucci_f"
@@ -171,14 +176,14 @@
 %      \paperTwentysix
        linewidth = 17.25\cm
        textheight = 26.0\cm
-%      stafflinethickness = \staffspace / 5.0
+       stafflinethickness = \staffspace / 5.0
        indent = 0.0
        \translator {
            \StaffContext
            \consists Custos_engraver
 %          Custos \override #'style = #'mensural
            \remove Time_signature_engraver
-           StaffSymbol \override #'thickness = #2.0
+%          StaffSymbol \override #'thickness = #2.0
 %          StaffSymbol \override #'line-count = #4
        }
     }


###############################################################################

Reply via email to