Break pages only at legal glue points

This commit is contained in:
gloamxun committed 2026-10-23 14:38:35 +08:00
1 parent 247cbf2b9e
commit 2b2ccd511c
4 files changed
+71 -9

No files matched your search

+7 -1
View File
@@ -404,7 +404,13 @@ impl PageBuilder {
float_total += 1;
}
VerticalNode::Glue(glue) => {
if index > start {
// TeX only allows a break at glue that follows a
// non-discardable item: glue after glue is not a legal
// breakpoint, and the glue at a break is discarded rather
// than counted towards the page height.
let legal_break =
index > start && !matches!(nodes[index - 1], VerticalNode::Glue(_));
if legal_break {
candidates.push(self.candidate(
height,
depth,