From 01c8642b238658f9bb5280ccad2d5447f6e5bc82 Mon Sep 17 00:00:00 2001 From: Joe Neeman Date: Mon, 10 Aug 2009 10:35:01 +1000 Subject: [PATCH] Fix spacing of lyrics followed by titles/markups. --- .../page-spacing-loose-lines-and-markup.ly | 21 +++++++++++++++++++ lily/page-layout-problem.cc | 17 +++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 input/regression/page-spacing-loose-lines-and-markup.ly 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 index 0000000000..9191d580bc --- /dev/null +++ b/input/regression/page-spacing-loose-lines-and-markup.ly @@ -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" +} + diff --git a/lily/page-layout-problem.cc b/lily/page-layout-problem.cc index d20387067d..b4bb60b03d 100644 --- a/lily/page-layout-problem.cc +++ b/lily/page-layout-problem.cc @@ -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++; -- 2.39.5