]> git.donarmstrong.com Git - lilypond.git/commitdiff
Adjust page compression settings
authorCarl Sorensen <c_sorensen@byu.edu>
Sat, 4 Dec 2010 22:26:17 +0000 (15:26 -0700)
committerCarl Sorensen <c_sorensen@byu.edu>
Sat, 4 Dec 2010 22:28:09 +0000 (15:28 -0700)
Adjust compression when the sytems won't fit on the page so we don't
drive off the top of the page.

input/regression/page-breaking-min-systems-per-page2.ly
lily/page-layout-problem.cc

index 6d5550912f0ee62f067af8981ec61d9dea53ea06..08988311b6cf99fc65a731253fa4ceae4611aca3 100644 (file)
@@ -1,10 +1,13 @@
-\version "2.13.1"
+\version "2.13.42"
 
 #(set-default-paper-size "a6")
 
 \header {
-  texidoc = "The min-systems-per-page variable takes precedence over
-the desire not to overfill a page."
+  texidoc = "
+The min-systems-per-page variable takes precedence over
+the desire not to overfill a page.  In this case, systems will
+overlap because they are forced to be on the page.
+"
 }
 
 \book {
@@ -13,4 +16,4 @@ the desire not to overfill a page."
   }
 
   \repeat unfold 21 { c'1 }
-}
\ No newline at end of file
+}
index 4f035d72794617ba3bd144f8cf187046392b41db..aec0b80ac8380ea9a957731410152eb4edba81b3 100644 (file)
@@ -310,13 +310,15 @@ Page_layout_problem::solve_rod_spring_problem (bool ragged)
 
   if (!spacer.fits ())
     {
-      Real overflow = spacer.configuration_length (spacer.force ()) - page_height_;
-      vsize space_count = solution_.size ();
-      for (vsize i = 0; i < space_count; i++)
-       solution_[i] -= (i + 1) * overflow / space_count;
+      Real overflow = spacer.configuration_length (spacer.force ())
+                     - page_height_;
       warning (_f ("couldn't fit music on page: overflow is %f",
                    overflow));
       warning (_ ("compressing music to fit"));
+      vsize space_count = solution_.size ();
+      Real spacing_increment = overflow / (space_count - 2);
+      for (vsize i = 2; i < space_count; i++)
+       solution_[i] -= (i-1) * spacing_increment;
     }
 }