From 7a60a3426d38616028ac3595ff3f2f5d1b6d115f Mon Sep 17 00:00:00 2001 From: Keith OHara Date: Sat, 4 Feb 2012 22:50:35 -0800 Subject: [PATCH] page-layout: loose lines between systems; issue 2276 --- ...page-spacing-nonstaff-lines-between-systems.ly | 4 ++-- lily/include/page-layout-problem.hh | 1 + lily/page-layout-problem.cc | 15 +++++++++++++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/input/regression/page-spacing-nonstaff-lines-between-systems.ly b/input/regression/page-spacing-nonstaff-lines-between-systems.ly index b1d161bb8d..fd9009bfc9 100644 --- a/input/regression/page-spacing-nonstaff-lines-between-systems.ly +++ b/input/regression/page-spacing-nonstaff-lines-between-systems.ly @@ -3,11 +3,11 @@ \header { texidoc = "The vertical spacing engine is not confused by a non-staff line below a system followed by a loose line above the -next system." +next system. Systems are spaced far enough that loose lines +are not interleaved, even if gaps would allow interleaving." } \paper { - indent = 0 ragged-right = ##t } diff --git a/lily/include/page-layout-problem.hh b/lily/include/page-layout-problem.hh index fc7e105510..12455c6fe7 100644 --- a/lily/include/page-layout-problem.hh +++ b/lily/include/page-layout-problem.hh @@ -95,6 +95,7 @@ protected: vector solution_; Real force_; Skyline bottom_skyline_; + Real bottom_loose_baseline_; Real page_height_; Real header_height_; Real footer_height_; diff --git a/lily/page-layout-problem.cc b/lily/page-layout-problem.cc index 39260b4173..6320827c76 100644 --- a/lily/page-layout-problem.cc +++ b/lily/page-layout-problem.cc @@ -380,6 +380,7 @@ Page_layout_problem::Page_layout_problem (Paper_book *pb, SCM page_scm, SCM syst : bottom_skyline_ (DOWN) { Prob *page = unsmob_prob (page_scm); + bottom_loose_baseline_ = 0; header_height_ = 0; footer_height_ = 0; header_padding_ = 0; @@ -596,12 +597,17 @@ Page_layout_problem::append_system (System *sys, Spring const &spring, Real inde { if (is_spaceable (elts[i])) { - // We don't add a spring for the first staff, since - // we are only adding springs _between_ staves here. if (!found_spaceable_staff) { + // Ensure space for any loose lines above this system + if (i > 0) + springs_.back ().ensure_min_distance (bottom_loose_baseline_ + - minimum_offsets_with_min_dist[i] + + padding); found_spaceable_staff = true; last_spaceable_staff = i; + // We don't add a spring for the first staff, since + // we are only adding springs _between_ staves here. continue; } @@ -629,6 +635,11 @@ Page_layout_problem::append_system (System *sys, Spring const &spring, Real inde } } + bottom_loose_baseline_ = found_spaceable_staff + ? ( minimum_offsets_with_min_dist[last_spaceable_staff] + - minimum_offsets_with_min_dist.back ()) + : 0; + // Corner case: there was only one staff, and it wasn't spaceable. // Mark it spaceable, because we do not allow non-spaceable staves // to be at the top or bottom of a system. -- 2.39.5