Apply native font protrusion during line breaking and packing

This commit is contained in:
gloamxun committed 2026-11-20 17:18:25 +08:00
1 parent 361e8d070f
commit 4777d66fc8
22 files changed
+441 -32

No files matched your search

@@ -165,7 +165,9 @@ impl Executor {
.as_mut()
.expect("unhbox starts an actual paragraph")
.nodes
.extend(nodes),
.extend(
nodes.into_iter().filter(|node| !matches!(node, TextNode::MarginKern { .. })),
),
BoxContent::Vertical(nodes) => self.append_unboxed_vertical(nodes),
}
Ok(())
@@ -407,6 +407,8 @@ impl Executor {
| Font
| Fontdimen
| Hyphenchar
| Lpcode
| Rpcode
| Skewchar
| Textfont
| Scriptfont
@@ -22,6 +22,7 @@ impl Tail {
| TextNode::Leaders(LeaderGlue { glue: g, .. }) => Self::Glue(*g, false),
TextNode::Kern { width, .. } | TextNode::AccentKern(width) => Self::Kern(*width),
TextNode::Penalty(n) => Self::Penalty(*n),
TextNode::MarginKern { .. } => Self::Other(15),
TextNode::Glyph { ligature, .. } => Self::Other(if *ligature { 7 } else { 0 }),
TextNode::MathChar(_) => Self::Other(0),
TextNode::Box(b) => Self::Other(b.native_box.as_ref().map_or(1, |b| {
@@ -783,7 +783,7 @@ impl Executor {
| Lccode | Uccode | Lowercase | Uppercase | Hyphenation | Patterns | Mathcode
| Delcode | Count | Countdef | Dimen | Dimendef | Skip | Skipdef | Muskip
| Muskipdef | Toks | Toksdef | Advance | Multiply | Divide | Read | Readline
| Font | Fontdimen | Hyphenchar | Skewchar | Textfont | Scriptfont
| Font | Fontdimen | Hyphenchar | Skewchar | Lpcode | Rpcode | Textfont | Scriptfont
| Scriptscriptfont | Endlinechar | Newlinechar | Escapechar | Globaldefs | Time
| Day | Month | Year | BeginGroup | EndGroup | Relax | Message | Errmessage
| Endinput | Showbox | Show | Showthe | Discretionary | DiscretionaryHyphen
@@ -223,6 +223,8 @@ impl Executor {
| Primitive::Prevgraf
| Primitive::Spacefactor
| Primitive::Hyphenchar
| Primitive::Lpcode
| Primitive::Rpcode
| Primitive::Skewchar
)
)