fix space calculation of new footers

however, there are widows...
This commit is contained in:
PgBiel 2025-06-13 03:45:42 -03:00
parent a2f5593174
commit f3cc3bdae7
8 changed files with 9 additions and 12 deletions

View File

@ -298,11 +298,6 @@ impl<'a> GridLayouter<'a> {
self.prepare_next_repeating_footers(true, engine)?; self.prepare_next_repeating_footers(true, engine)?;
// Ensure rows in the first region will be aware of the possible
// presence of the footer.
self.regions.size.y -= self.current.footer_height;
self.current.initial_after_repeats = self.regions.size.y;
let mut y = 0; let mut y = 0;
let mut consecutive_header_count = 0; let mut consecutive_header_count = 0;
while y < self.grid.rows.len() { while y < self.grid.rows.len() {
@ -1785,13 +1780,6 @@ impl<'a> GridLayouter<'a> {
)?; )?;
} }
// Ensure rows don't try to overrun the footer.
// Note that header layout will only subtract this again if it has
// to skip regions to fit headers, so there is no risk of
// subtracting this twice.
self.regions.size.y -= self.current.footer_height;
self.current.initial_after_repeats = self.regions.size.y;
if !self.repeating_headers.is_empty() || !self.pending_headers.is_empty() { if !self.repeating_headers.is_empty() || !self.pending_headers.is_empty() {
// Add headers to the new region. // Add headers to the new region.
self.layout_active_headers(engine)?; self.layout_active_headers(engine)?;

View File

@ -632,9 +632,18 @@ impl<'a> GridLayouter<'a> {
.simulate_footer_heights(footers, &self.regions, engine, disambiguator)?; .simulate_footer_heights(footers, &self.regions, engine, disambiguator)?;
} }
// Ensure rows don't try to overrun the new footers.
// Note that header layout will only subtract this again if it has
// to skip regions to fit headers, so there is no risk of
// subtracting this twice.
self.regions.size.y -= expected_footer_height;
self.current.footer_height += expected_footer_height; self.current.footer_height += expected_footer_height;
self.current.repeating_footer_heights.extend(expected_footer_heights); self.current.repeating_footer_heights.extend(expected_footer_heights);
if at_region_top {
self.current.initial_after_repeats = self.regions.size.y;
}
Ok(()) Ok(())
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 973 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 772 B

After

Width:  |  Height:  |  Size: 721 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 910 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 979 B

After

Width:  |  Height:  |  Size: 970 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 975 B

After

Width:  |  Height:  |  Size: 963 B