From 286c562bdcf92b18ba1cc297f028d1c47f9d8df4 Mon Sep 17 00:00:00 2001 From: Carl Sorensen Date: Thu, 2 Dec 2010 13:28:35 -0700 Subject: [PATCH] Fix 1252 by compressing page Add regression test --- input/regression/page-overflow-compression.ly | 17 +++++++++++++++++ lily/page-layout-problem.cc | 11 +++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 input/regression/page-overflow-compression.ly 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 -- 2.39.5