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

@@ -51,6 +51,7 @@ pub enum DiagnosticNode {
Output(OutputNode),
Unsupported(String),
AccentKern(i32),
MarginKern { width: i32, right: bool },
}
/// A semantic view, without recursively copying the box's painted contents.
#[derive(Clone, Debug, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
@@ -211,6 +212,10 @@ pub(super) fn text_nodes(nodes: &[TextNode]) -> Vec<DiagnosticNode> {
},
TextNode::Leaders(leader) => leader_node(leader),
TextNode::AccentKern(width) => DiagnosticNode::AccentKern(*width),
TextNode::MarginKern { width, right, .. } => DiagnosticNode::MarginKern {
width: *width,
right: *right,
},
TextNode::Kern { width, explicit } => DiagnosticNode::Kern {
width: *width,
explicit: *explicit,
@@ -473,6 +478,11 @@ impl Printer<'_> {
&format!("{prefix}."),
)?;
}
DiagnosticNode::MarginKern { width, right } => {
self.command("kern");
self.number(i64::from(*width));
self.literal(if *right { " (right margin)" } else { " (left margin)" });
}
DiagnosticNode::AccentKern(width) => {
self.command("kern");
self.literal(" ");