]> git.donarmstrong.com Git - lilypond.git/commitdiff
Fix #1194.
authorNeil Puttock <n.puttock@gmail.com>
Tue, 27 Jul 2010 21:48:56 +0000 (22:48 +0100)
committerNeil Puttock <n.puttock@gmail.com>
Tue, 27 Jul 2010 21:48:56 +0000 (22:48 +0100)
* lily/new-dynamic-engraver.cc (acknowledge_note_column):

  if NoteColumn contains a rest, set as X-parent instead of relying on
  default (PaperColumn)

input/regression/dynamics-rest-positioning.ly [new file with mode: 0644]
lily/new-dynamic-engraver.cc

diff --git a/input/regression/dynamics-rest-positioning.ly b/input/regression/dynamics-rest-positioning.ly
new file mode 100644 (file)
index 0000000..bae0ebd
--- /dev/null
@@ -0,0 +1,11 @@
+\version "2.13.29"
+
+\header {
+  texidoc = "Text dynamics are positioned correctly on rests, i.e.,
+centered on the parent object."
+}
+
+\relative c'' {
+  g2\p r\p
+  g4\f s r4\f s
+}
index 497fc0b7f710c145c1b44310e4d9c86618282118..cf2a2b1df84d4f5dce25b60a9305a6f36956758a 100644 (file)
@@ -227,10 +227,16 @@ New_dynamic_engraver::acknowledge_note_column (Grob_info info)
   if (script_ && !script_->get_parent (X_AXIS))
     {
       extract_grob_set (info.grob (), "note-heads", heads);
-      if (heads.size ())
+      /*
+       Spacing constraints may require dynamics to be aligned on rests,
+       so check for a rest if this note column has no note heads.
+      */
+      Grob *x_parent = (heads.size ()
+                       ? heads[0]
+                       : unsmob_grob (info.grob ()->get_object ("rest")));
+      if (x_parent)
        {
-         Grob *head = heads[0];
-         script_->set_parent (head, X_AXIS);
+         script_->set_parent (x_parent, X_AXIS);
          Self_alignment_interface::set_center_parent (script_, X_AXIS);
        }
     }
@@ -244,10 +250,7 @@ New_dynamic_engraver::acknowledge_note_column (Grob_info info)
 ADD_ACKNOWLEDGER (New_dynamic_engraver, note_column);
 ADD_TRANSLATOR (New_dynamic_engraver,
                /* doc */
-               "Create hairpins, dynamic texts, and their vertical"
-               " alignments.  The symbols are collected onto a"
-               " @code{DynamicLineSpanner} grob which takes care of vertical"
-               " positioning.",
+               "Create hairpins, dynamic texts and dynamic text spanners.",
 
                /* create */
                "DynamicTextSpanner "