]> git.donarmstrong.com Git - lilypond.git/commitdiff
Fix #299.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 16 Feb 2007 12:40:26 +0000 (13:40 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 16 Feb 2007 12:40:26 +0000 (13:40 +0100)
Take minimum for right_point with system->get_bound(RIGHT) X coordinate.

input/regression/lyric-extender-right-margin.ly [new file with mode: 0644]
lily/lyric-extender.cc

diff --git a/input/regression/lyric-extender-right-margin.ly b/input/regression/lyric-extender-right-margin.ly
new file mode 100644 (file)
index 0000000..5fb01d5
--- /dev/null
@@ -0,0 +1,23 @@
+\version "2.10.19"
+\header {
+  texidoc = "extenders will not protude into the right margin"
+  }
+
+\score{
+  {
+    \relative c' {
+      \override Score.PaperColumn #'keep-inside-line = ##t
+      c4 d e f ~ | \break
+      f4 e d c |
+    }
+
+    \addlyrics {
+      c d e effffffffffff __
+      e d c
+    }
+  }
+
+}
+\paper {
+  ragged-right = ##t
+}
index ce9e0fbc2e0070ee9030466ad8174bdcf9ff4619..de7452eb51736aa70ae7eaf71dac2082560cf672 100644 (file)
@@ -8,7 +8,7 @@
 
 #include "lyric-extender.hh"
 
-#include "spanner.hh"
+#include "system.hh"
 #include "item.hh"
 #include "warn.hh"
 #include "lookup.hh"
@@ -30,6 +30,8 @@ Lyric_extender::print (SCM smob)
     common = common->common_refpoint (right_text, X_AXIS);
 
   common = common->common_refpoint (me->get_bound (RIGHT), X_AXIS);
+  common = common->common_refpoint (me->get_system (), X_AXIS);
+  
   Real sl = me->layout ()->get_dimension (ly_symbol2scm ("line-thickness"));
 
   extract_grob_set (me, "heads", heads);
@@ -56,6 +58,8 @@ Lyric_extender::print (SCM smob)
   Real right_point
     = left_point + (robust_scm2double (minlen, 0));
 
+  right_point = min (right_point, me->get_system ()->get_bound (RIGHT)->relative_coordinate (common, X_AXIS));
+    
   if (heads.size ())
     right_point = max (right_point, heads.back ()->extent (common, X_AXIS)[RIGHT]);