Implement native text accents for unmodified LaTeX jobs

This commit is contained in:
gloamxun committed 2026-11-20 16:15:30 +08:00
1 parent ca60c66a17
commit 4eeb5686b8
16 files changed
+269 -18

No files matched your search

@@ -70,6 +70,8 @@ pub enum TextNode {
post_break: Vec<TextNode>,
replacement_count: u8,
},
/// Spacing owned by a text accent and protected from leading discard.
AccentKern(i32),
}
#[derive(Clone, Debug, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub struct NativeParagraph {
@@ -383,6 +385,7 @@ fn width(n: &TextNode) -> i64 {
TextNode::Rule(r) => r.dimensions().0,
TextNode::Output(node) => node.dimensions().map_or(0, |(width, _, _)| width),
TextNode::Kern { width: n, .. }
| TextNode::AccentKern(n)
| TextNode::MathBoundary { width: n, .. }
| TextNode::Indent(n) => *n as i64,
_ => 0,
@@ -584,6 +587,7 @@ fn break_lines(
&& matches!(
projected[i - 1],
BreakNode::Content(_)
| BreakNode::AccentKern(_)
| BreakNode::Discretionary { .. }
| BreakNode::Kern {
explicit: false,
@@ -1316,6 +1320,7 @@ fn add_hyphens(
| TextNode::NamedGlue(_, _)
| TextNode::Leaders(_)
| TextNode::Penalty(_)
| TextNode::AccentKern(_)
| TextNode::Kern { explicit: true, .. }
)
})