Shape and render explicit OpenType fonts in native Unicode jobs

This commit is contained in:
gloamxun committed 2026-11-21 10:35:03 +08:00
1 parent 3caf1eced2
commit 70822cbd94
33 files changed
+1255 -80

No files matched your search

@@ -13,6 +13,7 @@ pub enum DiagnosticNode {
expansion: i32,
ligature: Option<String>,
},
OpenType { font: FontId, text: String, glyphs: Vec<u16> },
Box(DiagnosticBox),
EmptyBox(i32),
Glue {
@@ -181,6 +182,10 @@ pub(super) fn text_nodes(nodes: &[TextNode]) -> Vec<DiagnosticNode> {
)
}),
},
TextNode::OpenType(run) => DiagnosticNode::OpenType {
font: run.font.id, text: run.text.clone(),
glyphs: run.glyphs.iter().map(|glyph| glyph.id).collect(),
},
TextNode::Box(b) if b.native_box.is_some() => {
DiagnosticNode::Box(box_view(b.native_box.as_ref().unwrap()))
}
@@ -474,6 +479,12 @@ impl Printer<'_> {
self.literal(")");
}
}
DiagnosticNode::OpenType { font, text, .. } => {
let name = self.state.fonts.font(*font)?.identifier_text();
self.command(&name);
self.literal(" ");
self.literal(text);
}
DiagnosticNode::Box(b) => self.box_(b, prefix)?,
DiagnosticNode::EmptyBox(w) => {
self.command("hbox");