Expose page stretch and shrink to the output routine

This commit is contained in:
gloamxun committed 2026-10-23 03:23:57 +08:00
1 parent 62d3c4154e
commit ca36c94eb3
5 files changed
+69 -6

No files matched your search

+8
View File
@@ -1651,6 +1651,8 @@ impl Engine {
let mut pages = Vec::new();
let mut page_penalties = Vec::new();
let mut page_depths = Vec::new();
let mut page_stretches = Vec::new();
let mut page_shrinks = Vec::new();
let mut held: BTreeMap<u8, Vec<VerticalItem>> = BTreeMap::new();
for fragment in builder.build(&nodes) {
let mut items = Vec::new();
@@ -1709,6 +1711,8 @@ impl Engine {
pages.push(page);
page_penalties.push(fragment.penalty);
page_depths.push(fragment.depth);
page_stretches.push(fragment.stretch);
page_shrinks.push(fragment.shrink);
}
// Insertion material that did not fit its class limit on the page where
@@ -1733,6 +1737,8 @@ impl Engine {
pages.push(page);
page_penalties.push(0);
page_depths.push(0);
page_stretches.push(0);
page_shrinks.push(0);
}
if let Some(source) = &document.output_routine {
let program = output::OutputProgram::parse(source).ok()?;
@@ -1743,6 +1749,8 @@ impl Engine {
page_goal: document.page_goal,
page_total,
page_depth: page_depths.get(index).copied().unwrap_or(0),
page_stretch: page_stretches.get(index).copied().unwrap_or(0),
page_shrink: page_shrinks.get(index).copied().unwrap_or(0),
vsize: document.page_goal,
top_skip: document.top_skip,
max_depth: document.max_depth,