From: Joe Neeman Date: Tue, 28 Sep 2010 23:01:17 +0000 (-0700) Subject: Fix thinkos in page-spacing. X-Git-Tag: release/2.13.35-1~5 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=f8159a57125bbf52e96cad584d6c3756a39d5fc9;p=lilypond.git Fix thinkos in page-spacing. Force is negative if page is overfull, and we can't allow overfull pages to have infinite badness. --- diff --git a/lily/page-spacing.cc b/lily/page-spacing.cc index 00ffcc4458..b556c1c305 100644 --- a/lily/page-spacing.cc +++ b/lily/page-spacing.cc @@ -31,7 +31,7 @@ Page_spacing::calc_force () - breaker_->min_whitespace_at_bottom_of_page (last_line_); if (rod_height_ + last_line_.bottom_padding_ >= height) - force_ = infinity_f; + force_ = -infinity_f; else force_ = (height - rod_height_ - last_line_.bottom_padding_ - spring_len_) / max (0.1, inverse_spring_k_); @@ -300,10 +300,11 @@ Page_spacer::calc_subproblem (vsize page, vsize line) space.force_ = 0; Real demerits = space.force_ * space.force_; - /* If a single line is taller than a page, we need to consider it as - a possible solution (but we give it a very bad score). */ - if (isinf (space.force_) && page_start == line) - demerits = BAD_SPACING_PENALTY; + + // Clamp the demerits at BAD_SPACING_PENALTY, even if the page + // is overfull. This ensures that TERRIBLE_SPACING_PENALTY takes + // precedence over overfull pages. + demerits = min (demerits, BAD_SPACING_PENALTY); demerits += (prev ? prev->demerits_ : 0); Real penalty = breaker_->line_count_penalty (line_count);