]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/accidental.cc
Make pure-height on accidentals ignore tied accidentals after breaks.
[lilypond.git] / lily / accidental.cc
index 6b7c85ada750ad84cc6ecd0d9d2e9ced4d81c0b7..ba352e5b84032a315795f68643fcdd3e52d10299 100644 (file)
@@ -11,6 +11,7 @@
 #include "international.hh"
 #include "item.hh"
 #include "output-def.hh"
+#include "paper-column.hh"
 #include "pitch.hh"
 #include "stencil.hh"
 
@@ -49,6 +50,21 @@ Accidental_interface::after_line_breaking (SCM smob)
   return SCM_UNSPECIFIED;
 }
 
+MAKE_SCHEME_CALLBACK (Accidental_interface, pure_height, 3);
+SCM
+Accidental_interface::pure_height (SCM smob, SCM start_scm, SCM)
+{
+  Item *me = dynamic_cast<Item*> (unsmob_grob (smob));
+  int start = scm_to_int (start_scm);
+  int rank = me->get_column ()->get_rank ();
+
+  bool visible = to_boolean (me->get_property ("forced"))
+    || !unsmob_grob (me->get_object ("tie"))
+    || rank != start + 1; /* we are in the middle of a line */
+
+  return visible ? Grob::stencil_height (smob) : ly_interval2scm (Interval ());
+}
+
 vector<Box>
 Accidental_interface::accurate_boxes (Grob *me, Grob **common)
 {
@@ -130,12 +146,13 @@ Accidental_interface::print (SCM smob)
   Font_metric *fm = Font_interface::get_default_font (me);
 
   SCM alist = me->get_property ("glyph-name-alist");
-  SCM glyph_name = ly_assoc_get (me->get_property ("alteration"),
-                                alist, SCM_BOOL_F);
+  SCM alt = me->get_property ("alteration");
+  SCM glyph_name = ly_assoc_get (alt, alist, SCM_BOOL_F);
   
   if (!scm_is_string (glyph_name))
     {
-      me->warning ("Could not find glyph-name for alteration");
+      me->warning (_f ("Could not find glyph-name for alteration %s",
+                      ly_scm2rational (alt).to_string ().c_str ()));
       return SCM_EOL;
     }