X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Foptimal-page-breaking.cc;h=34ff7f1b184cb519b418c2b44f53417599a31b4d;hb=730dd1aeadf4609b4a08bd08702c1a478f11d372;hp=f25d75f039ca3a9cebeb3779c8f57fba1bf2f217;hpb=9c21d283f744d73918c8b1c83904f3b66892b65f;p=lilypond.git diff --git a/lily/optimal-page-breaking.cc b/lily/optimal-page-breaking.cc index f25d75f039..34ff7f1b18 100644 --- a/lily/optimal-page-breaking.cc +++ b/lily/optimal-page-breaking.cc @@ -52,7 +52,7 @@ Optimal_page_breaking::solve () vsize ideal_sys_count = best.system_count (); vsize min_sys_count = ideal_sys_count - best.systems_per_page_.back (); - if (page_count > 1) + if (page_count > 1 && best.systems_per_page_[page_count - 2] > 1) min_sys_count -= best.systems_per_page_[page_count - 2]; if (page_count == 1) @@ -92,17 +92,11 @@ Optimal_page_breaking::solve () best_division = bound; } - if (best_for_this_sys_count.systems_per_page_.size () < page_count) - { - /* if the pages are stretched on average, stop trying to reduce sys_count */ - Real average_force = 0; - for (vsize i = 0; i < best_for_this_sys_count.systems_per_page_.size (); i++) - average_force += best_for_this_sys_count.force_[i]; - - average_force /= best_for_this_sys_count.page_count (); - if (average_force > 0) - break; - } + /* if the pages are stretched on average, stop trying to reduce sys_count */ + if (best_for_this_sys_count.page_count () < page_count + && best_for_this_sys_count.average_force () > 0) + break; + if (isinf (best_for_this_sys_count.demerits_)) break;