]> git.donarmstrong.com Git - lilypond.git/commitdiff
Improve some comments.
authorJoe Neeman <joeneeman@gmail.com>
Wed, 6 May 2009 23:08:29 +0000 (16:08 -0700)
committerJoe Neeman <joeneeman@gmail.com>
Wed, 6 May 2009 23:08:29 +0000 (16:08 -0700)
lily/constrained-breaking.cc
lily/page-spacing.cc

index 3a56aa47541190b7bd2f6e2669d5292f7e4d1fac..f7f832b57b0cadc4261c85f5e1e97cab15f6e7ee 100644 (file)
@@ -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)
 
index c60f0d88b1d171d3df4608169575ea7cf6331cfa..3eb7c8f4a067345e836ba562bea90d2486b8bf87 100644 (file)
@@ -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;