Defer bottom floats like TeX page building

This commit is contained in:
gloamxun committed 2026-10-23 23:48:28 +08:00
1 parent 17638996a1
commit 4dd28b3aa7
6 files changed
+66 -34

No files matched your search

+11
View File
@@ -122,6 +122,9 @@ pub struct PageFragment {
/// Accepted insertion space per class, including material held over from
/// the previous page.
pub insertions: Vec<InsertionSpace>,
/// Bottom floats placed at this page's bottom, as heights in placement
/// order, including floats carried over from the page before.
pub bottom_floats: Vec<i64>,
}
#[derive(Clone, Debug)]
@@ -287,6 +290,7 @@ impl PageBuilder {
stretches: [0; 4],
set: 0,
insertions: Vec::new(),
bottom_floats: floats.to_vec(),
}
}
@@ -368,6 +372,7 @@ impl PageBuilder {
bottom,
order_stretches(&nodes[start..end]),
self.insertion_space(nodes, start, end, held),
bottom_floats.clone(),
);
return Some((
fragment,
@@ -422,6 +427,7 @@ impl PageBuilder {
bottom,
order_stretches(&nodes[start..end]),
self.insertion_space(nodes, start, end, held),
bottom_floats.clone(),
);
return Some((
fragment,
@@ -498,6 +504,7 @@ impl PageBuilder {
bottom,
order_stretches(&nodes[start..end]),
self.insertion_space(nodes, start, end, held),
bottom_floats.clone(),
);
return Some((
fragment,
@@ -558,6 +565,7 @@ impl PageBuilder {
bottom,
order_stretches(&nodes[start..end]),
self.insertion_space(nodes, start, end, held),
bottom_floats.clone(),
);
return Some((
fragment,
@@ -623,6 +631,7 @@ impl PageBuilder {
best.bottom,
order_stretches(&nodes[start..best.end]),
self.insertion_space(nodes, start, best.end, held),
bottom_floats.clone(),
);
Some((
fragment,
@@ -762,6 +771,7 @@ impl PageBuilder {
bottom: i64,
stretches: [i64; 4],
insertions: Vec<InsertionSpace>,
bottom_floats: Vec<i64>,
) -> PageFragment {
let reserved: i64 = insertions.iter().map(|space| space.height).sum();
let target = (self.page_goal - bottom - reserved).max(0);
@@ -792,6 +802,7 @@ impl PageBuilder {
stretches,
set,
insertions,
bottom_floats,
}
}