]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/page-spacing.cc
Fix 1285.
[lilypond.git] / lily / page-spacing.cc
index b3a7ed8a4146f3ddbd8e9da8f1a7e1b9968cf0bb..bb6b5063b9e885a1133c6f8923e840e9b59c3066 100644 (file)
@@ -57,7 +57,13 @@ Page_spacing::append_system (const Line_details &line)
       first_line_ = line;
     }
 
-  spring_len_ += line.space_;
+  // line.space_ measures the spring which goes from the bottom refpoint
+  // of one system to the top refpoint of the next. spring_len_ measures
+  // how much of that is stretchable.
+  Real refpoint_dist = last_line_.tallness_
+    + last_line_.refpoint_extent_[DOWN]
+    - line.refpoint_extent_[UP];
+  spring_len_ += max (0.0, line.space_ - refpoint_dist);
   inverse_spring_k_ += line.inverse_hooke_;
 
   last_line_ = line;
@@ -74,7 +80,11 @@ Page_spacing::prepend_system (const Line_details &line)
   rod_height_ -= first_line_.full_height ();
   rod_height_ += first_line_.tallness_;
   rod_height_ += line.full_height();
-  spring_len_ += line.space_;
+
+  Real refpoint_dist = line.tallness_
+    + line.refpoint_extent_[DOWN]
+    - first_line_.refpoint_extent_[UP];
+  spring_len_ += max (0.0, line.space_ - refpoint_dist);
   inverse_spring_k_ += line.inverse_hooke_;
 
   first_line_ = line;