mirror of
https://github.com/typst/typst
synced 2025-05-14 04:56:26 +08:00
allow skipping from non-repeated header on lack of space
Can lead to orphans, but without enough space, anything goes.
This commit is contained in:
parent
6a12a451fc
commit
1d217e4019
@ -1376,14 +1376,13 @@ impl<'a> GridLayouter<'a> {
|
||||
// endlessly repeated) when subtracting header and footer height.
|
||||
//
|
||||
// See 'check_for_unbreakable_rows' as for why we're using
|
||||
// 'header_height' to predict header height and not
|
||||
// 'repeating_header_height'.
|
||||
// 'repeating_header_height' to predict header height.
|
||||
let height = frame.height();
|
||||
while self.unbreakable_rows_left == 0
|
||||
&& !self.regions.size.y.fits(height)
|
||||
&& may_progress_with_offset(
|
||||
self.regions,
|
||||
self.current.header_height + self.current.footer_height,
|
||||
self.current.repeating_header_height + self.current.footer_height,
|
||||
)
|
||||
{
|
||||
self.finish_region(engine, false)?;
|
||||
@ -1571,11 +1570,9 @@ impl<'a> GridLayouter<'a> {
|
||||
&& self.current.lrows.is_empty()
|
||||
&& may_progress_with_offset(
|
||||
self.regions,
|
||||
// This header height isn't doing much as we just
|
||||
// confirmed that there are no headers in this region,
|
||||
// but let's keep it here for correctness. It will add
|
||||
// zero anyway.
|
||||
self.current.header_height + self.current.footer_height,
|
||||
// Don't sum header height as we just confirmed that there
|
||||
// are no headers in this region.
|
||||
self.current.footer_height,
|
||||
);
|
||||
|
||||
let mut laid_out_footer_start = None;
|
||||
|
@ -377,7 +377,7 @@ impl<'a> GridLayouter<'a> {
|
||||
// 'header_height == repeating_header_height' here
|
||||
// (there won't be any pending headers at this point, other
|
||||
// than the ones we are about to place).
|
||||
self.current.header_height + self.current.footer_height,
|
||||
self.current.repeating_header_height + self.current.footer_height,
|
||||
)
|
||||
{
|
||||
// Note that, after the first region skip, the new headers will go
|
||||
@ -393,7 +393,7 @@ impl<'a> GridLayouter<'a> {
|
||||
&& self.current.lrows_orphan_snapshot.is_none()
|
||||
&& may_progress_with_offset(
|
||||
self.regions,
|
||||
self.current.header_height + self.current.footer_height,
|
||||
self.current.repeating_header_height + self.current.footer_height,
|
||||
);
|
||||
|
||||
if should_snapshot {
|
||||
|
@ -258,12 +258,11 @@ impl GridLayouter<'_> {
|
||||
while !self.regions.size.y.fits(row_group.height)
|
||||
&& may_progress_with_offset(
|
||||
self.regions,
|
||||
// Note that we consider that the exact same headers and footers will be
|
||||
// added if we skip like this (blocking other rows from being laid out)
|
||||
// due to orphan/widow prevention, which explains the usage of
|
||||
// 'header_height' (include non-repeating but pending headers) rather
|
||||
// than 'repeating_header_height'.
|
||||
self.current.header_height + self.current.footer_height,
|
||||
// Use 'repeating_header_height' (ignoring the height of
|
||||
// non-repeated headers) to allow skipping if the
|
||||
// non-repeated header is too large. It will become an
|
||||
// orphan, but when there is no space left, anything goes.
|
||||
self.current.repeating_header_height + self.current.footer_height,
|
||||
)
|
||||
{
|
||||
self.finish_region(engine, false)?;
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 437 B After Width: | Height: | Size: 542 B |
Loading…
x
Reference in New Issue
Block a user