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)
Real penalty = blank_page_penalty ();
n_res.demerits_ += penalty;
- n_res.force_.back () += penalty;
+
+ if (n_res.force_.size ())
+ n_res.force_.back () += penalty;
return (m_res.demerits_ < n_res.demerits_) ? m_res : n_res;
}
Page_spacing_result
Page_breaking::finalize_spacing_result (vsize configuration, Page_spacing_result res)
{
+ if (res.force_.empty ())
+ return res;
+
cache_line_details (configuration);
res.systems_per_page_ = uncompress_solution (res.systems_per_page_, cached_line_details_);