]> git.donarmstrong.com Git - lilypond.git/commitdiff
Fix min_page_count in page-turn-breaking.
authorJoe Neeman <joeneeman@gmail.com>
Tue, 26 Oct 2010 00:21:00 +0000 (17:21 -0700)
committerJoe Neeman <joeneeman@gmail.com>
Fri, 5 Nov 2010 22:12:17 +0000 (15:12 -0700)
When the page-turn-breaker is running, the page breaking
routines can be called on subsets of the book. Ensure that
the special handling for the last page is only invoked for
the last page of a book, not just the last page of a subset.

lily/page-breaking.cc

index 22fe336da513e5c49cb969cd86bb67b5e4185f9a..f3b1f84de3a066dcf8156465a96944c8961be50f 100644 (file)
@@ -999,18 +999,21 @@ Page_breaking::min_page_count (vsize configuration, vsize first_page_num)
      calculations that treated it as a non-last page were ok.
   */
 
-  cur_page_height = page_height (first_page_num + ret - 1, true);
-  cur_page_height -= min_whitespace_at_top_of_page (cached_line_details_[page_starter]);
-  cur_page_height -= min_whitespace_at_bottom_of_page (cached_line_details_.back ());
-
-  Real cur_height = cur_rod_height + ((ragged_last () || ragged ()) ? cur_spring_height : 0);
-  if (!too_few_lines (line_count - cached_line_details_.back ().compressed_nontitle_lines_count_)
-      && cur_height > cur_page_height
-      /* don't increase the page count if the last page had only one system */
-      && cur_rod_height > cached_line_details_.back ().full_height ())
-    ret++;
-
-  assert (ret <= cached_line_details_.size ());
+  if (is_last ())
+    {
+      cur_page_height = page_height (first_page_num + ret - 1, true);
+      cur_page_height -= min_whitespace_at_top_of_page (cached_line_details_[page_starter]);
+      cur_page_height -= min_whitespace_at_bottom_of_page (cached_line_details_.back ());
+
+      Real cur_height = cur_rod_height + ((ragged_last () || ragged ()) ? cur_spring_height : 0);
+      if (!too_few_lines (line_count - cached_line_details_.back ().compressed_nontitle_lines_count_)
+         && cur_height > cur_page_height
+         /* don't increase the page count if the last page had only one system */
+         && cur_rod_height > cached_line_details_.back ().full_height ())
+       ret++;
+      assert (ret <= cached_line_details_.size ());
+    }
+
   return ret;
 }