From d0c3f3daf1eb5095154fceba15d24d39aadc2027 Mon Sep 17 00:00:00 2001 From: Joe Neeman Date: Mon, 10 Nov 2008 22:37:19 -0800 Subject: [PATCH] If systems-per-page is specified and a page is overfull, don't barf. --- lily/page-breaking.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lily/page-breaking.cc b/lily/page-breaking.cc index 96b9d3a0db..639cbd5ceb 100644 --- a/lily/page-breaking.cc +++ b/lily/page-breaking.cc @@ -866,15 +866,18 @@ Page_breaking::space_systems_with_fixed_number_per_page (vsize configuration, } res.systems_per_page_.push_back (line - page_first_line); - res.force_.push_back (space.force_); + + // Don't say that the force is infinite even if it is: if we were told to + // put a certain number of systems on a page then we will, even if it's bad. + res.force_.push_back (min (space.force_, BAD_SPACING_PENALTY)); res.penalty_ += cached_line_details_[line-1].page_penalty_; page_first_line = line; } /* Recalculate forces for the last page because we know now that is - was really the last page. */ + really the last page. */ space.resize (page_height (first_page_num + page, true)); - res.force_.back () = space.force_; + res.force_.back () = min(space.force_, BAD_SPACING_PENALTY); return finalize_spacing_result (configuration, res); } @@ -963,7 +966,7 @@ Page_breaking::finalize_spacing_result (vsize configuration, Page_spacing_result { Real f = res.force_[i]; if (isinf (f) && res.systems_per_page_[i] == 1) - f = 20000; + f = BAD_SPACING_PENALTY; page_force += f * f; } -- 2.39.5