From 2f72abee18d38cad0639fd1db62ab878ec093d90 Mon Sep 17 00:00:00 2001 From: Joe Neeman Date: Wed, 6 May 2009 16:08:29 -0700 Subject: [PATCH] Improve some comments. --- lily/constrained-breaking.cc | 2 +- lily/page-spacing.cc | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lily/constrained-breaking.cc b/lily/constrained-breaking.cc index 3a56aa4754..f7f832b57b 100644 --- a/lily/constrained-breaking.cc +++ b/lily/constrained-breaking.cc @@ -21,7 +21,7 @@ /* We use the following optimal substructure. Let W (A) be our weight function. - Let A_{k, n} = (a_{k, n,1}, ... a_{k, n, k}) be the optimal set of line breaks + Let A_{k, n} = (a_{k, n, 1}, ... a_{k, n, k}) be the optimal set of line breaks for k systems and n potential breakpoints. a_{k, n, k} = n (it is the end of the piece) diff --git a/lily/page-spacing.cc b/lily/page-spacing.cc index c60f0d88b1..3eb7c8f4a0 100644 --- a/lily/page-spacing.cc +++ b/lily/page-spacing.cc @@ -185,6 +185,12 @@ Page_spacer::resize (vsize page_count) max_page_count_ = page_count; } +// Carries out one step in the dynamic programming algorithm for putting systems +// on a fixed number of pages. One call to this routine calculates the best +// configuration for putting lines 0 through LINE-1 on PAGE+1 pages, provided that +// we have previously called calc_subproblem(page-1, k) for every k < LINE. +// +// This algorithm is similar to the constrained-breaking algorithm. bool Page_spacer::calc_subproblem (vsize page, vsize line) { @@ -213,6 +219,9 @@ Page_spacer::calc_subproblem (vsize page, vsize line) line_count += lines_[page_start].compressed_nontitle_lines_count_; if (page > 0 || page_start == 0) { + // If the last page is ragged, set its force to zero. This way, we will leave + // the last page half-empty rather than trying to balance things out + // (which only makes sense in non-ragged situations). if (line == lines_.size () - 1 && ragged && last && space.force_ > 0) space.force_ = 0; -- 2.11.4.GIT