]> git.donarmstrong.com Git - lilypond.git/commitdiff
Hairpin minimum-length has not effect at end of line; issue 2785.
authorMike Solomon <mike@apollinemike.com>
Sat, 6 Apr 2013 08:03:44 +0000 (10:03 +0200)
committerMike Solomon <mike@apollinemike.com>
Sat, 6 Apr 2013 08:03:44 +0000 (10:03 +0200)
Fixes the springs and rods callback so that broken left items and
center items are used as potential bounds of spanners, which allows
both cases to be considered in the simple spacer when scoring line breaking
configurations.

input/regression/minimum-length-end-line.ly [new file with mode: 0644]
lily/simple-spacer.cc
lily/spanner.cc

diff --git a/input/regression/minimum-length-end-line.ly b/input/regression/minimum-length-end-line.ly
new file mode 100644 (file)
index 0000000..29ba2f7
--- /dev/null
@@ -0,0 +1,16 @@
+\version "2.17.16"
+
+\header {
+  texidoc = "Long spanners at the end of the lines stretch measures
+correctly.
+"
+}
+
+{
+  \override Hairpin.minimum-length = #60
+  \override Hairpin.to-barline = ##t
+  \repeat unfold 4 a1
+  a1\<
+  a1\>
+  a1\!
+}
index 61afdb9bcc281004c4b0dbffbabe2fbd757ec4d5..aef524da87579bb2ecb1e087409f0f2da04baa3f 100644 (file)
@@ -387,6 +387,9 @@ get_column_description (vector<Grob *> const &cols, vsize col_index, bool line_s
           if (cols[j] == other)
             description.rods_.push_back (Rod_description (j, scm_to_double (scm_cdar (s))));
           else /* it must end at the LEFT prebroken_piece */
+               /* see Spanner::set_spacing_rods for more comments on how
+                  to deal with situations where  we don't know if we're
+                  ending yet on the left prebroken piece */
             description.end_rods_.push_back (Rod_description (j, scm_to_double (scm_cdar (s))));
         }
     }
index a6a2cb7e939423fcadfed6b07c50711106f806b2..79496dd4f5d3797baed4721878195a89de716c60 100644 (file)
@@ -385,6 +385,23 @@ Spanner::set_spacing_rods (SCM smob)
       r.item_drul_[LEFT] = sp->get_bound (LEFT);
       r.item_drul_[RIGHT] = sp->get_bound (RIGHT);
       r.add_to_cols ();
+
+      /*
+        We do not know yet if the spanner is going to have a bound that is
+        broken. To account for this uncertainty, we add the rod twice:
+        once for the central column (see above) and once for the left column
+        (see below). As end_rods_ are never used when rods_ are used and vice
+        versa, this rod will only be accessed once for each spacing
+        configuraiton before line breaking. Then, as a grob never exists in
+        both unbroken and broken forms after line breaking, only one of these
+        two rods will be in the column vector used for spacing in
+        simple-spacer.cc get_line_confugration.
+      */
+      if (Item *left_pbp = sp->get_bound (RIGHT)->find_prebroken_piece (LEFT))
+        {
+          r.item_drul_[RIGHT] = left_pbp;
+          r.add_to_cols ();
+        }
     }
 
   return SCM_UNSPECIFIED;