]> git.donarmstrong.com Git - lilypond.git/commitdiff
Fix spacing of lyrics followed by titles/markups.
authorJoe Neeman <joeneeman@gmail.com>
Mon, 10 Aug 2009 00:35:01 +0000 (10:35 +1000)
committerJoe Neeman <joeneeman@gmail.com>
Mon, 10 Aug 2009 00:38:26 +0000 (10:38 +1000)
input/regression/page-spacing-loose-lines-and-markup.ly [new file with mode: 0644]
lily/page-layout-problem.cc

diff --git a/input/regression/page-spacing-loose-lines-and-markup.ly b/input/regression/page-spacing-loose-lines-and-markup.ly
new file mode 100644 (file)
index 0000000..9191d58
--- /dev/null
@@ -0,0 +1,21 @@
+\version "2.13.4"
+
+\header {
+  texidoc = "Having markup after a loose line doesn't confuse the page layout
+engine."
+}
+
+#(set-default-paper-size "a6")
+
+\book {
+  \score {
+  <<
+     \new Staff <<
+       \new Voice = "asdf" { c' d' e' f' }
+     >>
+     \new Lyrics \lyricsto "asdf" \lyricmode { a b c d }
+  >>
+  }
+  \markup "blah blah blah"
+}
+
index d20387067d9d8e0e70d1ed24db0537c9247befd7..b4bb60b03d8cee68ef5b9042d8c9315d26d71240 100644 (file)
@@ -309,6 +309,23 @@ Page_layout_problem::find_system_offsets ()
          *tail = scm_cons (scm_from_double (solution_[spring_idx]), SCM_EOL);
          tail = SCM_CDRLOC (*tail);
 
+         // Lay out any non-spaceable lines between this line and
+         // the last one.
+         if (loose_lines.size ())
+           {
+             Interval loose_extent = loose_lines.back ()->extent (loose_lines.back (), Y_AXIS);
+             Interval prob_extent = unsmob_stencil (elements_[i].prob->get_property ("stencil"))->extent (Y_AXIS);
+             Real min_distance = -loose_extent[DOWN] + prob_extent[UP]; // TODO: include padding/minimum-distance
+
+             loose_line_min_distances.push_back (min_distance);
+             loose_lines.push_back (0);
+
+             distribute_loose_lines (loose_lines, loose_line_min_distances,
+                                     last_spaceable_line_translation, -solution_[spring_idx]);
+             loose_lines.clear ();
+             loose_line_min_distances.clear ();
+           }
+
          last_spaceable_line = 0;
          last_spaceable_line_translation = -solution_[spring_idx];
          spring_idx++;