]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/mensural-ligature-engraver.cc
* lily/parser.yy (command_element): move clef stuff into Scheme.
[lilypond.git] / lily / mensural-ligature-engraver.cc
index 999ea817a4c9dcc3b44fb9af2508d35194a6a758..3c5e9adb926dacd5be249b275907812c46c8da33 100644 (file)
@@ -8,7 +8,7 @@
 
 #include "mensural-ligature.hh"
 #include "ligature-engraver.hh"
-#include "musical-request.hh"
+#include "request.hh"
 #include "warn.hh"
 #include "item.hh"
 #include "spanner.hh"
@@ -341,8 +341,15 @@ Mensural_ligature_engraver::transform_heads ()
     Grob_info info = primitives_[i];
     int duration_log =
       Note_head::get_balltype (dynamic_cast<Item*> (info.grob_));
-    Note_req *nr = dynamic_cast<Note_req*> (info.music_cause ());
-    if (!nr)
+
+    Music * nr = info.music_cause ();
+    
+
+    /*
+
+    ugh. why not simply check for pitch? 
+     */
+    if (!nr->is_mus_type ("note-event"))
       {
        info.music_cause ()->origin ()->warning (_f ("can not determine pitch of ligature primitive -> skipping"));
        i++;
@@ -395,10 +402,8 @@ Mensural_ligature_engraver::transform_heads ()
 
 void set_delta_pitch (Item *primitive, Grob_info info1, Grob_info info2)
 {
-  Note_req *nr1 = dynamic_cast<Note_req*> (info1.music_cause ());
-  Note_req *nr2 = dynamic_cast<Note_req*> (info2.music_cause ());
-  Pitch pitch1 = *unsmob_pitch (nr1->get_mus_property ("pitch"));
-  Pitch pitch2 = *unsmob_pitch (nr2->get_mus_property ("pitch"));
+  Pitch pitch1 = *unsmob_pitch (info1.music_cause ()->get_mus_property ("pitch"));
+  Pitch pitch2 = *unsmob_pitch (info2.music_cause ()->get_mus_property ("pitch"));
   int delta_pitch = (pitch2.steps () - pitch1.steps ());
   primitive->set_grob_property ("delta-pitch", gh_int2scm (delta_pitch));
 }
@@ -426,24 +431,9 @@ Mensural_ligature_engraver::propagate_properties ()
     gh_scm2double (thickness_scm) : 1.4;
   thickness *= finished_ligature_->get_paper ()->get_var ("linethickness");
 
-  /*
-   * FIXME: Since character "noteheads--1mensural" is defined in
-   * parmesan font only, the right-hand expression in the
-   * following assignment evaluates to a width of 0.0, in case
-   * font-family of finished_ligature_ is _not_ set to "ancient"
-   * (by default, it is; see grob properties of MensuralLigature
-   * in scm/grob-description.scm).  This may arise severe problems
-   * in the future when switching between fonts (e.g. mensural
-   * versus neo-mensural).
-   */
   Real head_width =
     Font_interface::get_default_font (finished_ligature_)->
     find_by_name ("noteheads--1mensural").extent (X_AXIS).length ();
-  if (head_width == 0.0)
-    {
-      programming_error ("Mensural_ligature_engraver: failed evaluating head_width (most probably a font-family selection problem)");
-    }
-
   SCM flexa_width_scm =
     finished_ligature_->get_grob_property ("flexa-width");
   Real flexa_width = (flexa_width_scm != SCM_EOL) ?
@@ -525,8 +515,7 @@ Mensural_ligature_engraver::join_primitives ()
   for (int i = 0; i < primitives_.size (); i++)
     {
       Grob_info info = primitives_[i];
-      Note_req *nr = dynamic_cast<Note_req*> (info.music_cause ());
-      Pitch pitch = *unsmob_pitch (nr->get_mus_property ("pitch"));
+      Pitch pitch = *unsmob_pitch (info.music_cause ()->get_mus_property ("pitch"));
       if (i > 0)
         {
          Item *primitive = dynamic_cast<Item*> (info.grob_);
@@ -578,6 +567,7 @@ Mensural_ligature_engraver::acknowledge_grob (Grob_info info)
 ENTER_DESCRIPTION (Mensural_ligature_engraver,
 /* descr */       "Handles Mensural_ligature_requests by glueing special ligature heads together.",
 /* creats*/       "MensuralLigature",
-/* acks  */       "ligature-head-interface note-head-interface rest-interface",
+/* accepts */     "",
+/* acks  */      "ligature-head-interface note-head-interface rest-interface",
 /* reads */       "",
 /* write */       "");