]> git.donarmstrong.com Git - lilypond.git/commitdiff
Fix 1252 by compressing page
authorCarl Sorensen <c_sorensen@byu.edu>
Thu, 2 Dec 2010 20:28:35 +0000 (13:28 -0700)
committerCarl Sorensen <c_sorensen@byu.edu>
Fri, 3 Dec 2010 22:23:23 +0000 (15:23 -0700)
Add regression test

input/regression/page-overflow-compression.ly [new file with mode: 0644]
lily/page-layout-problem.cc

diff --git a/input/regression/page-overflow-compression.ly b/input/regression/page-overflow-compression.ly
new file mode 100644 (file)
index 0000000..40f8b9d
--- /dev/null
@@ -0,0 +1,17 @@
+\version "2.13.41"
+
+\header {
+  texidoc = "
+Layouts that overflow a page will be compressed in order to fit on
+the page, even if it causes collisions.  In this example, the
+tagline should not collide with the bottom staff.
+"
+}
+
+\paper {
+  paper-height= 8\cm
+}
+
+\book {
+  \repeat unfold 3 { g'''1\mark \markup "Long Text" g'''1\break}
+}
index 1a39ad51e8c21f681d1d345424b1c30931820e57..4f035d72794617ba3bd144f8cf187046392b41db 100644 (file)
@@ -309,8 +309,15 @@ Page_layout_problem::solve_rod_spring_problem (bool ragged)
   solution_ = spacer.spring_positions ();
 
   if (!spacer.fits ())
-    warning (_f ("couldn't fit music on page: overflow is %f",
-                spacer.configuration_length(spacer.force()) - page_height_));
+    {
+      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;
+      warning (_f ("couldn't fit music on page: overflow is %f",
+                   overflow));
+      warning (_ ("compressing music to fit"));
+    }
 }
 
 // The solution_ vector stores the position of every live VerticalAxisGroup