]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/page-breaking.cc
Add regression tests for max-systems-per-page and systems-per-page.
[lilypond.git] / lily / page-breaking.cc
index 1c0d21cdc767502f80992eb1d4a3d27e518d99ad..f19079ce35fa049de26470daf4f4d3c5fac79c6b 100644 (file)
@@ -924,17 +924,22 @@ Page_breaking::space_systems_with_fixed_number_per_page (vsize configuration,
 
       res.systems_per_page_.push_back (line - page_first_line);
 
-      // 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.force_.push_back (space.force_);
       res.penalty_ += cached_line_details_[line-1].page_penalty_;
+      if (system_count_on_this_page != systems_per_page_)
+       {
+         res.penalty_ += TERRIBLE_SPACING_PENALTY;
+         res.system_count_status_ |= ((system_count_on_this_page < systems_per_page_))
+           ? SYSTEM_COUNT_TOO_FEW : SYSTEM_COUNT_TOO_MANY;
+       }
+
       page_first_line = line;
     }
 
   /* Recalculate forces for the last page because we know now that is
      really the last page. */
   space.resize (page_height (first_page_num + page, true));
-  res.force_.back () = min(space.force_, BAD_SPACING_PENALTY);
+  res.force_.back () = space.force_;
   return finalize_spacing_result (configuration, res);
 }