]> git.donarmstrong.com Git - lilypond.git/commitdiff
page-layout: loose lines between systems; issue 2276
authorKeith OHara <k-ohara5a5a@oco.net>
Sun, 5 Feb 2012 06:50:35 +0000 (22:50 -0800)
committerKeith OHara <k-ohara5a5a@oco.net>
Wed, 8 Feb 2012 08:04:45 +0000 (00:04 -0800)
input/regression/page-spacing-nonstaff-lines-between-systems.ly
lily/include/page-layout-problem.hh
lily/page-layout-problem.cc

index b1d161bb8da084e038d30cd97b298d89254ad87b..fd9009bfc99c350f9f49a4d3bb0190d47f6f4e61 100644 (file)
@@ -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
 }
 
index fc7e105510be95c4ae1056e029da1be251eb1bbe..12455c6fe76d494352372a0b41c30e655e5f24e5 100644 (file)
@@ -95,6 +95,7 @@ protected:
   vector<Real> solution_;
   Real force_;
   Skyline bottom_skyline_;
+  Real bottom_loose_baseline_;
   Real page_height_;
   Real header_height_;
   Real footer_height_;
index 39260b4173edc98845cee4d038bf0a8e1d2b51fc..6320827c767a74b07078d328eb7041d7649f6179 100644 (file)
@@ -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.