bool title_;
+ /* The page-breaker deals with forbidden page breaks by "compressing"
+ two Line_detailses into one. The following fields are used by the
+ page-breaker to keep track of this. If the number of fields needed
+ by the page-breaker grows, it might be a good idea to create a separate
+ class. */
+ int compressed_lines_count_;
+ int compressed_nontitle_lines_count_;
+
Line_details ()
{
force_ = infinity_f;
page_penalty_ = 0;
turn_penalty_ = 0;
title_ = false;
+ compressed_lines_count_ = 0;
+ compressed_nontitle_lines_count_ = 0;
}
Line_details (Prob *pb)
page_penalty_ = robust_scm2double (pb->get_property ("page-break-penalty"), 0);
turn_penalty_ = robust_scm2double (pb->get_property ("page-turn-penalty"), 0);
title_ = to_boolean (pb->get_property ("is-title"));
+ compressed_lines_count_ = 0;
+ compressed_nontitle_lines_count_ = 0;
}
};
vsize current_configuration_count () const;
Line_division current_configuration (vsize configuration_index) const;
Page_spacing_result space_systems_on_n_pages (vsize configuration_index,
- vsize n, vsize first_page_num);
+ vsize n, vsize first_page_num);
Page_spacing_result space_systems_on_n_or_one_more_pages (vsize configuration_index, vsize n,
- vsize first_page_num);
+ vsize first_page_num);
Page_spacing_result space_systems_on_best_pages (vsize configuration_index,
- vsize first_page_num);
+ vsize first_page_num);
+ Page_spacing_result space_systems_with_fixed_number_per_page (vsize configuration_index,
+ int systems_per_page,
+ vsize first_page_num);
Page_spacing_result pack_systems_on_least_pages (vsize configuration_index,
vsize first_page_num);
vsize min_page_count (vsize configuration_index, vsize first_page_num);
compressed.extent_[UP] = old.extent_[UP] + orig[i].extent_.length () + old.padding_;
compressed.space_ += old.space_;
compressed.inverse_hooke_ += old.inverse_hooke_;
- compressed.title_ = old.title_;
- /* we don't need the force_ field for the vertical spacing,
- so we use force_ = n to signal that the line was compressed,
- reducing the number of lines by n (and force_ = 0 otherwise).
- This makes uncompression much easier. */
- compressed.force_ = old.force_ + 1;
+ compressed.compressed_lines_count_ = old.compressed_lines_count_ + 1;
+ compressed.compressed_nontitle_lines_count_ =
+ old.compressed_nontitle_lines_count_ + (compressed.title_ ? 0 : 1);
+
+ compressed.title_ = compressed.title_ && old.title_;
ret.back () = compressed;
}
else
{
int compressed_count = 0;
for (vsize j = start_sys; j < start_sys + systems_per_page[i]; j++)
- compressed_count += (int)compressed[j].force_;
+ compressed_count += compressed[j].compressed_lines_count_;
ret.push_back (systems_per_page[i] + compressed_count);
start_sys += systems_per_page[i];
return finalize_spacing_result (configuration, best);
}
+Page_spacing_result space_systems_with_fixed_number_per_page (vsize configuration_index,
+ int systems_per_page,
+ vsize first_page_num)
+{
+ return Page_spacing_result ();
+}
+
Page_spacing_result
Page_breaking::pack_systems_on_least_pages (vsize configuration, vsize first_page_num)
{