From: Carl Sorensen Date: Thu, 2 Dec 2010 20:28:35 +0000 (-0700) Subject: Fix 1252 by compressing page X-Git-Tag: release/2.13.41-1~1^2 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=286c562bdcf92b18ba1cc297f028d1c47f9d8df4;p=lilypond.git Fix 1252 by compressing page Add regression test --- diff --git a/input/regression/page-overflow-compression.ly b/input/regression/page-overflow-compression.ly new file mode 100644 index 0000000000..40f8b9d3ea --- /dev/null +++ b/input/regression/page-overflow-compression.ly @@ -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} +} diff --git a/lily/page-layout-problem.cc b/lily/page-layout-problem.cc index 1a39ad51e8..4f035d7279 100644 --- a/lily/page-layout-problem.cc +++ b/lily/page-layout-problem.cc @@ -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