]> git.donarmstrong.com Git - lilypond.git/commitdiff
final version of mensural improvements
authorBenkő Pál <benko.pal@gmail.com>
Thu, 27 Jan 2011 21:16:12 +0000 (22:16 +0100)
committerGraham Percival <graham@percival-music.ca>
Fri, 28 Jan 2011 15:01:35 +0000 (15:01 +0000)
lily/include/mensural-ligature.hh
lily/ligature-bracket-engraver.cc
lily/mensural-ligature-engraver.cc
lily/mensural-ligature.cc
mf/parmesan-custodes.mf
mf/parmesan-noteheads.mf
scm/define-grob-properties.scm
scm/define-grobs.scm
scm/output-lib.scm
scm/parser-clef.scm

index c3b5031f403c09b86b2777433e2f99307f2c2232..cb676e591602c6c13d175b138945f8b2a615586d 100644 (file)
 #define MLP_BREVIS 0x04 // mensural brevis head
 #define MLP_LONGA 0x08 // mensural brevis head with right cauda
 #define MLP_MAXIMA 0x10 // mensural maxima head without stem
-#define MLP_FLEXA 0x20 // mensural flexa-like shape
+#define MLP_FLEXA_BEGIN 0x20 // start of obliqua
+#define MLP_FLEXA_END 0x40 // end of obliqua
 
 #define MLP_STEM (MLP_UP | MLP_DOWN)
 #define MLP_SINGLE_HEAD (MLP_BREVIS | MLP_LONGA | MLP_MAXIMA)
+#define MLP_FLEXA (MLP_FLEXA_BEGIN | MLP_FLEXA_END)
 #define MLP_ANY (MLP_FLEXA | MLP_SINGLE_HEAD)
 
 struct Mensural_ligature
index a360e03f732719508a35cd15ad7bb164c2b3c738..b467ec998a3a16383da42f0f648af9b8fbe36a86 100644 (file)
 
 #include "international.hh"
 
-#include "ligature-engraver.hh"
+#include "engraver.hh"
 #include "note-column.hh"
 #include "tuplet-bracket.hh"
 #include "spanner.hh"
 #include "stream-event.hh"
-#include "spanner.hh"
 #include "item.hh"
 
 #include "translator.icc"
index 480f1afbfd6c7c11db1dbd97abb9b31b9b980b15..d6e8eed3ca3ffc700ba27a4d80905732496dff8a 100644 (file)
@@ -126,7 +126,7 @@ Mensural_ligature_engraver::transform_heads (vector<Grob_info> primitives)
        }
 
       int pitch = unsmob_pitch (nr->get_property ("pitch"))->steps ();
-      int delta_pitch = 0;
+      int prim = 0;
 
       if (at_beginning)
        {
@@ -142,14 +142,12 @@ Mensural_ligature_engraver::transform_heads (vector<Grob_info> primitives)
        }
       else
        {
-         delta_pitch = pitch - prev_pitch;
-         if (delta_pitch == 0)
+         if (pitch == prev_pitch)
            {
              nr->origin ()->warning
                (_ ("prime interval within ligature -> skipping"));
              at_beginning = true;
-             primitive->set_property ("primitive",
-                                      scm_from_int (MLP_NONE));
+              prim = MLP_NONE;
              continue;
            }
        }
@@ -159,14 +157,14 @@ Mensural_ligature_engraver::transform_heads (vector<Grob_info> primitives)
        {
          nr->origin ()->warning
            (_ ("mensural ligature: duration none of Mx, L, B, S -> skipping"));
-         primitive->set_property ("primitive",
-                                  scm_from_int (MLP_NONE));
+          prim = MLP_NONE;
          at_beginning = true;
          continue;
        }
 
-      // apply_transition replacement begins
       bool general_case = true;
+      bool make_flexa = false;
+      bool allow_flexa = true;
 
       // first check special cases
       // 1. beginning
@@ -175,9 +173,7 @@ Mensural_ligature_engraver::transform_heads (vector<Grob_info> primitives)
          // a. semibreves
          if (duration_log == 0)
            {
-             primitive->set_property ("primitive",
-                                      scm_from_int (MLP_UP | MLP_BREVIS));
-             prev_semibrevis = prev_brevis_shape = true;
+              prim = MLP_UP | MLP_BREVIS;
              general_case = false;
            }
          // b. descendens longa or brevis
@@ -187,11 +183,8 @@ Mensural_ligature_engraver::transform_heads (vector<Grob_info> primitives)
                   && duration_log > -3)
            {
              int left_stem = duration_log == -1 ? MLP_DOWN : 0;
-
-             primitive->set_property ("primitive",
-                                      scm_from_int (left_stem | MLP_BREVIS));
-             prev_brevis_shape = true;
-             prev_semibrevis = general_case = false;
+              prim = left_stem | MLP_BREVIS;
+             general_case = false;
            }
        }
       // 2. initial semibrevis must be followed by another one
@@ -200,15 +193,14 @@ Mensural_ligature_engraver::transform_heads (vector<Grob_info> primitives)
          prev_semibrevis = false;
          if (duration_log == 0)
            {
-             primitive->set_property ("primitive", scm_from_int (MLP_BREVIS));
+             prim = MLP_BREVIS;
              general_case = false;
            }
          else
            {
              nr->origin ()->warning
                (_ ("semibrevis must be followed by another one -> skipping"));
-             primitive->set_property ("primitive",
-                                      scm_from_int (MLP_NONE));
+              prim = MLP_NONE;
              at_beginning = true;
              continue;
            }
@@ -219,27 +211,20 @@ Mensural_ligature_engraver::transform_heads (vector<Grob_info> primitives)
          nr->origin ()->warning
            (_ ("semibreves can only appear at the beginning of a ligature,\n"
                "and there may be only zero or two of them"));
-         primitive->set_property ("primitive",
-                                  scm_from_int (MLP_NONE));
+          prim = MLP_NONE;
          at_beginning = true;
          continue;
        }
       // 4. end, descendens
-      else if (i == s - 1 && delta_pitch < 0)
+      else if (i == s - 1 && pitch < prev_pitch)
        {
          // brevis; previous note must be turned into flexa
          if (duration_log == -1)
            {
              if (prev_brevis_shape)
                {
-                 prev_primitive->set_property
-                   ("primitive",
-                    scm_from_int
-                    (MLP_FLEXA
-                     | (scm_to_int (prev_primitive->get_property ("primitive"))
-                        & MLP_DOWN)));
-                 primitive->set_property ("primitive", scm_from_int (MLP_NONE));
-                 break; // no more notes, no join
+                  make_flexa = true;
+                  general_case = false;
                }
              else
                {
@@ -248,54 +233,90 @@ Mensural_ligature_engraver::transform_heads (vector<Grob_info> primitives)
                        "when the last note is a descending brevis,\n"
                        "the penultimate note must be another one,\n"
                        "or the ligatura must be LB or SSB"));
-                 primitive->set_property ("primitive", scm_from_int (MLP_NONE));
+                 prim = MLP_NONE;
                  break;
                }
            }
          // longa
          else if (duration_log == -2)
            {
-             primitive->set_property ("primitive", scm_from_int (MLP_BREVIS));
-             general_case = false;
+             prim = MLP_BREVIS;
+             general_case = allow_flexa = false;
            }
-         // else maxima; fall through regular case below
+         // else maxima; fall through to regular case below
        }
 
+      if (allow_flexa
+          && to_boolean (primitive->get_property ("ligature-flexa")))
+        {
+          /*
+            flexa requested, check whether allowed:
+            - there should be a previous note
+            - both of the notes must be of brevis shape
+              (i.e. can't be maxima or flexa;
+              longa is forbidden as well - it's nonexistent anyway)
+            - no compulsory flexa for the next note,
+              i.e. it's not an ultimate descending breve
+          */
+          make_flexa = !at_beginning && prev_brevis_shape && duration_log > -2;
+          if (make_flexa && i == s - 2)
+            {
+              /*
+                check last condition: look ahead to next note
+              */
+              Grob_info next_info = primitives[i + 1];
+              Item *next_primitive = dynamic_cast<Item *> (next_info.grob ());
+              if (Rhythmic_head::duration_log (next_primitive) == -1)
+                {
+                  /*
+                    breve: check whether descending
+                  */
+                  int const next_pitch = unsmob_pitch
+                    (next_info.event_cause ()->get_property ("pitch"))->steps ();
+                  if (next_pitch < pitch)
+                   /*
+                     sorry, forbidden
+                   */
+                   make_flexa = false;
+                }
+            }
+        }
+
       if (general_case)
        {
-         static int const shape[3] = {MLP_MAXIMA, MLP_LONGA, MLP_BREVIS};
+          static int const shape[3] = {MLP_MAXIMA, MLP_LONGA, MLP_BREVIS};
 
-         primitive->set_property ("primitive",
-                                  scm_from_int (shape[duration_log + 3]));
-         prev_brevis_shape = duration_log == -1;
+          prim = shape[duration_log + 3];
        }
 
+      if (make_flexa)
+        {
+          /*
+            turn the note with the previous one into a flexa
+          */
+          prev_primitive->set_property
+            ("primitive",
+             scm_from_int
+             (MLP_FLEXA_BEGIN
+              | (scm_to_int (prev_primitive->get_property ("primitive"))
+                 & MLP_STEM)));
+          prev_primitive->set_property
+            ("flexa-interval", scm_from_int (pitch - prev_pitch));
+          prim = MLP_FLEXA_END;
+          primitive->set_property
+            ("flexa-interval", scm_from_int (pitch - prev_pitch));
+        }
+
       // join_primitives replacement
-      if (!at_beginning)
-       {
-         /*
-           if the previous note is longa-shaped and this note is lower,
-           then the joining line may hide the stem, so it is made longer
-           to serve as stem as well
-         */
-         if (delta_pitch < 0
-             && (scm_to_int (prev_primitive->get_property ("primitive"))
-                 & MLP_LONGA))
-           {
-             delta_pitch -= 6;
-             // instead of number 6
-             // the legth of the longa stem should be queried something like
-             // Font_interface::get_default_font (ligature)->find_by_name
-             //  ("noteheads.sM2mensural").extent (Y_AXIS).length ()
-           }
-         prev_primitive->set_property ("join-right-amount",
-                                       scm_from_int (delta_pitch));
-         // perhaps set add-join as well
-       }
+      if (!(at_beginning || make_flexa))
+       prev_primitive->set_property ("add-join", ly_bool2scm (true));
+
       at_beginning = false;
       prev_primitive = primitive;
       prev_pitch = pitch;
-      // apply_transition replacement ends
+      primitive->set_property ("primitive", scm_from_int (prim));
+      prev_brevis_shape = (prim & MLP_BREVIS) != 0;
+      prev_semibrevis = (prim & MLP_UP) != 0;
     }
 }
 
@@ -325,16 +346,11 @@ Mensural_ligature_engraver::propagate_properties (Spanner *ligature,
   Real head_width
     = Font_interface::get_default_font (ligature)->
     find_by_name ("noteheads.sM1mensural").extent (X_AXIS).length ();
-  Real flexa_width
-    = robust_scm2double (ligature->get_property ("flexa-width"), 2);
   Real maxima_head_width
     = Font_interface::get_default_font (ligature)->
-    find_by_name ("noteheads.sM1neomensural").extent (X_AXIS).length ();
-
-  flexa_width *= Staff_symbol_referencer::staff_space (ligature);
-
-  Real half_flexa_width = 0.5 * (flexa_width + thickness);
+    find_by_name ("noteheads.sM3ligmensural").extent (X_AXIS).length ();
 
+  Item *prev_primitive = NULL;
   for (vsize i = 0; i < primitives.size (); i++)
     {
       Item *primitive = dynamic_cast<Item *> (primitives[i].grob ());
@@ -342,31 +358,36 @@ Mensural_ligature_engraver::propagate_properties (Spanner *ligature,
       primitive->set_property ("thickness",
                               scm_from_double (thickness));
 
-      switch (output & MLP_ANY)
-       {
-       case MLP_NONE:
-         primitive->set_property ("head-width",
-                                  scm_from_double (half_flexa_width));
-         break;
-       case MLP_BREVIS:
-       case MLP_LONGA:
-         primitive->set_property ("head-width",
-                                  scm_from_double (head_width));
-         break;
-       case MLP_MAXIMA:
-         primitive->set_property ("head-width",
-                                  scm_from_double (maxima_head_width));
-         break;
-       case MLP_FLEXA:
-         primitive->set_property ("head-width",
-                                  scm_from_double (half_flexa_width));
-         primitive->set_property ("flexa-width",
-                                  scm_from_double (flexa_width));
-         break;
-       default:
-         programming_error (_ ("unexpected case fall-through"));
-         break;
-       }
+      switch (output & MLP_ANY) {
+      case MLP_BREVIS:
+      case MLP_LONGA:
+       primitive->set_property ("head-width", scm_from_double (head_width));
+       break;
+      case MLP_MAXIMA:
+       primitive->set_property ("head-width",
+                                scm_from_double (maxima_head_width));
+       break;
+      case MLP_FLEXA_BEGIN:
+        /*
+          the next note (should be MLP_FLEXA_END) will handle this one
+        */
+        break;
+      case MLP_FLEXA_END:
+        {
+          SCM flexa_scm = primitive->get_property ("flexa-width");
+          Real const flexa_width = robust_scm2double (flexa_scm, 2.0);
+          SCM head_width = scm_from_double (0.5 * (flexa_width + thickness));
+          primitive->set_property ("head-width", head_width);
+          prev_primitive->set_property ("head-width", head_width);
+          prev_primitive->set_property ("flexa-width", flexa_scm);
+        }
+       break;
+      default:
+       programming_error (_ ("unexpected case fall-through"));
+       break;
+      }
+
+      prev_primitive = primitive;
     }
 }
 
@@ -375,43 +396,69 @@ Mensural_ligature_engraver::fold_up_primitives (vector<Grob_info> primitives)
 {
   Item *first = 0;
   Real distance = 0.0;
-  Real dot_shift = 0.0;
+  Real staff_space = 0.0;
+  Real thickness = 0.0;
+
   for (vsize i = 0; i < primitives.size (); i++)
     {
       Item *current = dynamic_cast<Item *> (primitives[i].grob ());
       if (i == 0)
        {
          first = current;
-         dot_shift = 1.5 * Staff_symbol_referencer::staff_space (first);
+         staff_space = Staff_symbol_referencer::staff_space (first);
+         thickness = scm_to_double (current->get_property ("thickness"));
        }
 
       move_related_items_to_column (current, first->get_column (),
                                    distance);
 
-      distance
-       += scm_to_double (current->get_property ("head-width"))
-       - scm_to_double (current->get_property ("thickness"));
+      Real head_width = scm_to_double (current->get_property ("head-width"));
+      distance += head_width - thickness;
 
       if (Rhythmic_head::dot_count (current) > 0)
-       // Move dots above/behind the ligature.
+       /*
+         Move dots above/behind the ligature.
+         dots should also avoid staff lines.
+       */
        {
+         Grob *dot_gr = Rhythmic_head::get_dots (current);
+
+         bool const on_line = Staff_symbol_referencer::on_line
+           (current,
+            robust_scm2int (current->get_property ("staff-position"), 0));
+         Real vert_shift = on_line ? staff_space * 0.5 : 0.0;
+          bool const flexa_begin =
+            scm_to_int (current->get_property ("primitive"))
+            & MLP_FLEXA_BEGIN;
+
          if (i + 1 < primitives.size ())
-           // dot in the midst => move above head
+           /*
+             dot in the midst => avoid next note;
+             what to avoid and where depends on
+             being on a line or between lines
+           */
            {
-             // FIXME: Amount of vertical dot-shift should depend on
-             // pitch.
-             //
-             // FIXME: dot placement is horizontally slightly off.
-             Rhythmic_head::get_dots (current)->translate_axis (dot_shift, Y_AXIS);
-           }
-         else
-           // trailing dot => move behind head
-           {
-             double head_width =
-               scm_to_double (current->get_property ("head-width"));
-             Rhythmic_head::get_dots (current)->
-               translate_axis (head_width, X_AXIS);
+             int const delta =
+               scm_to_int (current->get_property ("delta-position"));
+             if (flexa_begin)
+               vert_shift += delta < 0
+                 ? staff_space : (on_line ? -2.0 : -1.0) * staff_space;
+             else if (on_line)
+               {
+                 if (0 < delta && delta < 3)
+                   vert_shift -= staff_space;
+               }
+             else if (delta == 1 || delta == -1)
+                 vert_shift -= delta * staff_space;
            }
+
+         dot_gr->translate_axis (vert_shift, Y_AXIS);
+
+         /*
+           move all dots behind head
+         */
+         dot_gr->translate_axis
+            ((flexa_begin ? staff_space * 0.6 : head_width) - 2.0*thickness, X_AXIS);
        }
     }
 }
index c3a3aaf16f3213c714939f1559cbe7b0bab3b7b6..ad2f0918a9ab22cd427bef19b349401bbeafc0e8 100644 (file)
 #include "warn.hh"
 
 /*
+  draws one half a flexa, i.e. a portion corresponding to a single note.
+  this way coloration of the two notes building up the flexa can be
+  handled independently.
+
  * TODO: divide this function into mensural and neo-mensural style.
  *
  * TODO: move this function to class Lookup?
  */
 Stencil
 brew_flexa (Grob *me,
-           Real interval,
            bool solid,
            Real width,
-           Real vertical_line_thickness)
+           Real thickness,
+           bool begin)
 {
   Real staff_space = Staff_symbol_referencer::staff_space (me);
+
+  /*
+    The thickness of the horizontal lines of the flexa shape
+    should be equal to that of the horizontal lines of the
+    neomensural brevis note head (see mf/parmesan-heads.mf).
+  */
+  Real const horizontal_line_thickness = staff_space * 0.35;
+
+  // URGH!  vertical_line_thickness is adjustable (via thickness
+  // property), while horizontal_line_thickness is constant.
+  // Maybe both should be adjustable independently?
+
+  Real height = staff_space - horizontal_line_thickness;
+  Stencil stencil;
+  Real const interval =
+    robust_scm2double (me->get_property ("flexa-interval"), 0.0);
   Real slope = (interval / 2.0 * staff_space) / width;
 
   // Compensate optical illusion regarding vertical position of left
@@ -50,52 +70,42 @@ brew_flexa (Grob *me,
   Real slope_correction = 0.2 * staff_space * sign (slope);
   Real corrected_slope = slope + slope_correction / width;
 
-  Stencil stencil;
   if (solid) // colorated flexae
     {
-      Stencil solid_head
-       = Lookup::beam (corrected_slope, width, staff_space, 0.0);
-      stencil.add_stencil (solid_head);
+      stencil = Lookup::beam (corrected_slope, width * 0.5, staff_space, 0.0);
     }
   else // outline
     {
-      /*
-       The thickness of the horizontal lines of the flexa shape
-       should be equal to that of the horizontal lines of the
-       neomensural brevis note head (see mf/parmesan-heads.mf).
-      */
-      Real const horizontal_line_thickness = staff_space * 0.35;
-
-      // URGH!  vertical_line_thickness is adjustable (via thickness
-      // property), while horizontal_line_thickness is constant.
-      // Maybe both should be adjustable independently?
-
-      Real height = staff_space - horizontal_line_thickness;
-
-      Stencil left_edge
-       = Lookup::beam (corrected_slope, vertical_line_thickness, height, 0.0);
-      stencil.add_stencil (left_edge);
-
-      Stencil right_edge
-       = Lookup::beam (corrected_slope, vertical_line_thickness, height, 0.0);
-      right_edge.translate_axis (width - vertical_line_thickness, X_AXIS);
-      right_edge.translate_axis ((width - vertical_line_thickness) *
-                                corrected_slope, Y_AXIS);
-      stencil.add_stencil (right_edge);
-
-      Stencil bottom_edge
-       = Lookup::beam (corrected_slope, width,
-                       horizontal_line_thickness, 0.0);
-      bottom_edge.translate_axis (-0.5 * height, Y_AXIS);
+      stencil = Lookup::beam (corrected_slope, thickness, height, 0.0);
+      if (!begin)
+       {
+         stencil.translate_axis (width*0.5 - thickness, X_AXIS);
+         stencil.translate_axis (corrected_slope * (width*0.5 - thickness),
+                                  Y_AXIS);
+        }
+
+      Stencil bottom_edge =
+        Lookup::beam (corrected_slope, width * 0.5, horizontal_line_thickness,
+                      0.0);
+      bottom_edge.translate_axis (-0.5*height, Y_AXIS);
       stencil.add_stencil (bottom_edge);
 
-      Stencil top_edge
-       = Lookup::beam (corrected_slope, width,
-                       horizontal_line_thickness, 0.0);
-      top_edge.translate_axis (+0.5 * height, Y_AXIS);
+      Stencil top_edge =
+        Lookup::beam (corrected_slope, width * 0.5, horizontal_line_thickness,
+                      0.0);
+      top_edge.translate_axis (+0.5*height, Y_AXIS);
       stencil.add_stencil (top_edge);
     }
-  stencil.translate_axis (ypos_correction, Y_AXIS);
+
+  if (begin)
+    stencil.translate_axis (ypos_correction, Y_AXIS);
+  else
+    {
+      stencil.translate_axis (0.5 * thickness, X_AXIS);
+
+      stencil.translate_axis (interval / -4.0 * staff_space, Y_AXIS);
+    }
+
   return stencil;
 }
 
@@ -112,41 +122,50 @@ internal_brew_primitive (Grob *me)
   int primitive = scm_to_int (primitive_scm);
 
   Stencil out;
-  int delta_pitch = 0;
   Real thickness = 0.0;
   Real width = 0.0;
+  Real flexa_width = 0.0;
   Real staff_space = Staff_symbol_referencer::staff_space (me);
-  if (primitive & MLP_ANY)
-    thickness = robust_scm2double (me->get_property ("thickness"), .14);
 
-  if (primitive & MLP_FLEXA)
+  bool const color =
+    me->get_property ("style") == ly_symbol2scm ("blackpetrucci");
+  bool const semi =
+    me->get_property ("style") == ly_symbol2scm ("semipetrucci");
+
+  if (primitive & MLP_ANY)
     {
-      delta_pitch = robust_scm2int (me->get_property ("delta-position"),
-                                   0);
-      width
-       = robust_scm2double (me->get_property ("flexa-width"), 2.0 * staff_space);
+      thickness = robust_scm2double (me->get_property ("thickness"), .14);
+      width = robust_scm2double (me->get_property ("head-width"), staff_space);
     }
-  if (primitive & MLP_SINGLE_HEAD)
-    width = robust_scm2double (me->get_property ("head-width"), staff_space);
+  if (primitive & MLP_FLEXA)
+    flexa_width = robust_scm2double (me->get_property ("flexa-width"), 2.0)
+      * staff_space;
+
+  int const note_shape = primitive & MLP_ANY;
 
-  switch (primitive & MLP_ANY)
+  switch (note_shape)
     {
     case MLP_NONE:
       return Lookup::blank (Box (Interval (0, 0), Interval (0, 0)));
     case MLP_LONGA: // mensural brevis head with right cauda
       out = Font_interface::get_default_font (me)->find_by_name
-       ("noteheads.sM2mensural");
+       (color ? "noteheads.sM2blackmensural" :
+         semi ? "noteheads.sM2semimensural" : "noteheads.sM2mensural");
       break;
     case MLP_BREVIS: // mensural brevis head
       out = Font_interface::get_default_font (me)->find_by_name
-       ("noteheads.sM1mensural");
+       (color ? "noteheads.sM1blackmensural" :
+         semi ? "noteheads.sM1semimensural" : "noteheads.sM1mensural");
       break;
     case MLP_MAXIMA: // should be mensural maxima head without stem
       out = Font_interface::get_default_font (me)->find_by_name
-       ("noteheads.sM1neomensural");
+       (color ? "noteheads.sM3blackligmensural" :
+         semi ? "noteheads.sM3semiligmensural" : "noteheads.sM3ligmensural");
       break;
-    case MLP_FLEXA:
-      out = brew_flexa (me, delta_pitch, false, width, thickness);
+    case MLP_FLEXA_BEGIN:
+    case MLP_FLEXA_END:
+      out = brew_flexa (me, color, flexa_width, thickness,
+                       note_shape == MLP_FLEXA_BEGIN);
       break;
     default:
       programming_error (_ ("Mensural_ligature:"
@@ -176,11 +195,9 @@ internal_brew_primitive (Grob *me)
       out.add_stencil (join);
     }
 
-  SCM join_right_scm = me->get_property ("join-right-amount");
-
-  if (scm_is_number (join_right_scm))
+  if (to_boolean (me->get_property ("add-join")))
     {
-      int join_right = scm_to_int (join_right_scm);
+      int join_right = scm_to_int (me->get_property ("delta-position"));
       if (join_right)
        {
          Real y_top = join_right * 0.5 * staff_space;
@@ -190,6 +207,19 @@ internal_brew_primitive (Grob *me)
            {
              y_bottom = y_top;
              y_top = 0.0;
+
+             /*
+               if the previous note is longa-shaped,
+               the joining line may hide the stem, so made it longer
+               to serve as stem as well
+             */
+             if (primitive & MLP_LONGA)
+               /*
+                 instead of 3.0 the length of a longa stem should be used
+                 Font_interface::get_default_font (???)->find_by_name
+                 ("noteheads.s-2mensural").extent (Y_AXIS).length () * 0.5
+               */
+               y_bottom -= 3.0 * staff_space;
            }
 
          Interval x_extent (width - thickness, width);
@@ -235,10 +265,10 @@ ADD_INTERFACE (Mensural_ligature,
 
               /* properties */
               "delta-position "
-              "flexa-width "
+              "ligature-flexa "
               "head-width "
-              "join-right-amount "
+              "add-join "
+              "flexa-interval "
               "primitive "
               "thickness "
               );
-
index f9e1e18d86d3ba8b7f4821a7afee5554625275f3..97cf3c48efed86557d008dde43c67cf11393a0fe 100644 (file)
@@ -394,11 +394,11 @@ def custos_mensural (expr verbose_name, internal_name,
                dalpha = direction * alpha;
 
                if staffline_adjustment = between_staff_lines:
-                       stem_ht# = 1.00 staff_space#;
+                       stem_ht# = 2.00 staff_space#;
                elseif staffline_adjustment = on_staff_line:
-                       stem_ht# = 1.50 staff_space#;
+                       stem_ht# = 2.50 staff_space#;
                else: % staffline_adjustment = anywhere
-                       stem_ht# = 1.25 staff_space#;
+                       stem_ht# = 2.25 staff_space#;
                fi;
 
                define_pixels (ht, wd, stem_ht);
index db17c5fe122f7b1f2af76a49072e91fcd0b86653..682dc8bc3c149b46d3f21e015e13b530e3ec8cd2 100644 (file)
@@ -60,7 +60,7 @@ define_pixels (noteheight);
 %
 %
 
-def draw_neomensural_brevis (expr brevwid) =
+def draw_neomensural_brevis (expr brevwid, open, full) =
        save beamheight, head_width;
        save holeheight, stem_width;
        save serif_size, serif_protrude;
@@ -91,8 +91,8 @@ def draw_neomensural_brevis (expr brevwid) =
        penpos4 (beamheight, 90);
        penpos5 (stem_width, 180);
 
-       save pat_in, pat_out;
-       path pat_in, pat_out;
+       save pat_out;
+       path pat_out;
 
        pat_out := z4l
                   -- z3l{left}
@@ -108,18 +108,26 @@ def draw_neomensural_brevis (expr brevwid) =
                   -- cycle;
        fill pat_out;
 
-       pat_in := z4r
-                 -- z3r{left}
-                 .. z2r{up}
-                 -- z1r;
-       pat_in := pat_in
-                 -- reverse pat_in yscaled -1;
-       pat_in := pat_in
-                 -- reverse pat_in shifted (-x4r, 0)
-                                   xscaled -1
-                                   shifted (x4l, 0)
-                 -- cycle;
-       unfill pat_in;
+       if open:
+               save pat_in;
+               path pat_in;
+
+               pat_in := z4r
+                         -- z3r{left}
+                         .. z2r{up}
+                         -- z1r;
+               pat_in := pat_in
+                         -- reverse pat_in yscaled -1;
+               if full:
+                       pat_in := pat_in
+                                 -- reverse pat_in shifted (-x4r, 0)
+                                                   xscaled -1
+                                                   shifted (x4l, 0);
+               fi;
+               pat_in := pat_in
+                         -- cycle;
+               unfill pat_in;
+        fi;
 
        penlabels (1, 2, 3, 4, 5);
 enddef;
@@ -127,7 +135,7 @@ enddef;
 
 %%% This head does not seem to be used anywhere.  Junk me?  -- jr
 def draw_neomensural_left_stemmed_head (expr wid) =
-       draw_neomensural_brevis (wid);
+       draw_neomensural_brevis (wid, true, true);
 
        x6 = x7 = stem_width / 2;
        y6 = y5;
@@ -161,7 +169,7 @@ fet_endchar;
 % the left, some say right.  Right wins democratically.
 %
 def draw_neomensural_longa (expr wid) =
-       draw_neomensural_brevis (wid);
+       draw_neomensural_brevis (wid, true, true);
 
        save theta;
 
@@ -204,7 +212,7 @@ fet_endchar;
 
 
 fet_beginchar ("Neo-mensural brevis notehead", "sM1neomensural");
-       draw_neomensural_brevis (2 staff_space#);
+       draw_neomensural_brevis (2 staff_space#, true, true);
 fet_endchar;
 
 
@@ -314,15 +322,15 @@ fet_beginchar ("Neo-mensural semiminima head", "s2neomensural");
 fet_endchar;
 
 
-def draw_mensural_brevis (expr wid) =
+def draw_mensural_brevis (expr wid, open, full) =
        % TODO.  For the moment, fall back to draw_neomensural_brevis.
-       draw_neomensural_brevis (wid);
+       draw_neomensural_brevis (wid, open, full);
 enddef;
 
 
 %%% This head does not seem to be used anywhere.  Junk me?  -- jr
-def draw_mensural_left_stemmed_head (expr wid) =
-       draw_mensural_brevis (wid);
+def draw_mensural_left_stemmed_head (expr wid, open, full) =
+       draw_mensural_brevis (wid, open, full);
 
        x6 = x7 = stem_width / 2;
        y6 = y5;
@@ -345,8 +353,8 @@ def draw_mensural_left_stemmed_head (expr wid) =
 enddef;
 
 
-def draw_mensural_longa (expr wid) =
-       draw_mensural_brevis (wid);
+def draw_mensural_longa (expr wid, open, full) =
+       draw_mensural_brevis (wid, open, full);
 
        x6 = x7 = head_width - stem_width / 2;
        y6 = y5;
@@ -371,22 +379,67 @@ enddef;
 
 %%% This head does not seem to be used anywhere.  Junk me?  -- jr
 fet_beginchar ("Mensural left stemmed notehead", "slmensural");
-       draw_mensural_left_stemmed_head (staff_space#);
+       draw_mensural_left_stemmed_head (staff_space#, true, true);
 fet_endchar;
 
 
 fet_beginchar ("Mensural maxima notehead", "sM3mensural");
-       draw_mensural_longa (2.0 staff_space#);
+       draw_mensural_longa (2.0 staff_space#, true, true);
+fet_endchar;
+
+
+fet_beginchar ("Mensural maxima notehead in ligaturae", "sM3ligmensural");
+       draw_mensural_brevis (2.0 staff_space#, true, true);
 fet_endchar;
 
 
 fet_beginchar ("Mensural longa notehead", "sM2mensural");
-       draw_mensural_longa (staff_space#);
+       draw_mensural_longa (staff_space#, true, true);
 fet_endchar;
 
 
 fet_beginchar ("Mensural brevis notehead", "sM1mensural");
-       draw_mensural_brevis (staff_space#);
+       draw_mensural_brevis (staff_space#, true, true);
+fet_endchar;
+
+
+fet_beginchar ("Black mensural maxima notehead", "sM3blackmensural");
+       draw_mensural_longa (2.0 staff_space#, false, false);
+fet_endchar;
+
+
+fet_beginchar ("Black mensural maxima notehead in ligaturae", "sM3blackligmensural");
+       draw_mensural_brevis (2.0 staff_space#, false, false);
+fet_endchar;
+
+
+fet_beginchar ("Black mensural longa notehead", "sM2blackmensural");
+       draw_mensural_longa (staff_space#, false, false);
+fet_endchar;
+
+
+fet_beginchar ("Black mensural brevis notehead", "sM1blackmensural");
+       draw_mensural_brevis (staff_space#, false, false);
+fet_endchar;
+
+
+fet_beginchar ("Semi-colored mensural maxima notehead", "sM3semimensural");
+       draw_mensural_longa (2.0 staff_space#, true, false);
+fet_endchar;
+
+
+fet_beginchar ("Semi-colored mensural maxima notehead in ligaturae", "sM3semiligmensural");
+       draw_mensural_brevis (2.0 staff_space#, true, false);
+fet_endchar;
+
+
+fet_beginchar ("Semi-colored mensural longa notehead", "sM2semimensural");
+       draw_mensural_longa (staff_space#, true, false);
+fet_endchar;
+
+
+fet_beginchar ("Semi-colored mensural brevis notehead", "sM1semimensural");
+       draw_mensural_brevis (staff_space#, true, false);
 fet_endchar;
 
 
@@ -466,6 +519,11 @@ fet_beginchar ("Mensural semiminima head", "s2mensural");
 fet_endchar;
 
 
+fet_beginchar ("Black mensural semibrevis head", "s0blackmensural");
+       draw_diamond_head (staff_space#, 0.15, 0.30, 30, false);
+fet_endchar;
+
+
 fet_beginchar ("Petrucci semibrevis head", "s0petrucci");
 %      draw_diamond_head (1.8 staff_space#, 0.15, 0.40, 30, true);
        draw_neomensural_open_head (staff_space#, 1.8 staff_space#);
@@ -484,6 +542,24 @@ fet_beginchar ("Petrucci semiminima head", "s2petrucci");
 fet_endchar;
 
 
+fet_beginchar ("Petrucci colored semibrevis head", "s0blackpetrucci");
+%      draw_diamond_head (1.8 staff_space#, 0.15, 0.40, 30, true);
+       draw_neomensural_black_head (staff_space#, 1.8 staff_space#);
+fet_endchar;
+
+
+fet_beginchar ("Petrucci colored minima head", "s1blackpetrucci");
+%      draw_diamond_head (1.8 staff_space#, 0.15, 0.40, 30, true);
+       draw_neomensural_black_head (staff_space#, 1.8 staff_space#);
+fet_endchar;
+
+
+fet_beginchar ("Petrucci colored semiminima head", "s2blackpetrucci");
+%      draw_diamond_head (1.8 staff_space#, 0.15, 0.40, 30, true);
+       draw_neomensural_black_head (staff_space#, 1.8 staff_space#);
+fet_endchar;
+
+
 %%%%%%%%
 %
 %
index cbe005831827e85c6aa68f3d71b72e1b7702e9ee..41f5386b45f84dda9549e71e20580f117cce396a 100644 (file)
@@ -1133,13 +1133,15 @@ right neighbour, encoded as a bit mask.")
 
      (flexa-height ,ly:dimension? "The height of a flexa shape in a ligature
 grob (in @code{staff-space} units).")
+     (flexa-interval ,integer? "The interval spanned by the two notes of a
+flexa shape (1 is a second, 7 is an octave).")
      (flexa-width ,ly:dimension? "The width of a flexa shape in a
 ligature grob in (in @code{staff-space} units).")
+     (ligature-flexa ,boolean? "request joining note to the previous one
+in a flexa.")
 
      (inclinatum ,boolean? "Is this neume an inclinatum?")
 
-     (join-right-amount ,number? "A length used for calculating the
-Y-extent of mensural ligatures.")
 
      (linea ,boolean? "Attach vertical lines to this neume?")
 
index 02160eec64eca2e710bb40db374224a9c617812e..5b234627439fb10a2f7ef3940712d059ebeb8380 100644 (file)
 
     (MensuralLigature
      . (
-       (flexa-width . 2.0)
        (stencil . ,ly:mensural-ligature::print)
        (thickness . 1.4)
        (meta . ((class . Spanner)
 
     (NoteHead
      . (
+       (flexa-width . 2.0)
        (duration-log . ,note-head::calc-duration-log)
        (extra-spacing-height . ,ly:note-head::include-ledger-line-height)
        (glyph-name . ,note-head::calc-glyph-name)
+        (ligature-flexa . #f)
        (stem-attachment . ,ly:note-head::calc-stem-attachment)
        (stencil . ,ly:note-head::print)
        (X-offset . ,ly:note-head::stem-x-shift)
index 219a287cd1d55c921442f2419bfd3dc0a981731e..f00273add6e236028ade8dffbe917d4f7d8d21d2 100644 (file)
@@ -120,6 +120,14 @@ and duration-log @var{log}."
      (if (< log 0)
         (string-append (number->string log) "mensural")
         (string-append (number->string log) (symbol->string style))))
+    ((blackpetrucci)
+     (if (< log 0)
+        (string-append (number->string log) "blackmensural")
+        (string-append (number->string log) (symbol->string style))))
+    ((semipetrucci)
+     (if (< log 0)
+        (string-append (number->string log) "semimensural")
+        (string-append (number->string log) "petrucci")))
     ((neomensural)
      (string-append (number->string log) (symbol->string style)))
     (else
index f668ab78e6d559e5ee4ffe0405fc23e32ece74f2..a731e7459e7e6a38e6f796998d3f3b12b3852122 100644 (file)
@@ -74,6 +74,7 @@
     ("petrucci-c5" . ("clefs.petrucci.c5" 4 0))
     ("petrucci-f3" . ("clefs.petrucci.f" 0 0))
     ("petrucci-f4" . ("clefs.petrucci.f" 2 0))
+    ("petrucci-f5" . ("clefs.petrucci.f" 4 0))
     ("petrucci-f" . ("clefs.petrucci.f" 2 0))
     ("petrucci-g" . ("clefs.petrucci.g" -2 0))))