Execute explicit XeTeX glyph nodes across native layout and export

This commit is contained in:
gloamxun committed 2026-11-26 11:54:39 +08:00
1 parent a0922d0105
commit b88283f493
17 files changed
+185 -43

No files matched your search

@@ -60,6 +60,7 @@ pub enum DiagnosticNode {
SpaceAdjustment(i32),
MarginKern { width: i32, right: bool },
Direction(DirectionBoundary),
OpenTypeGlyph { font: FontId, glyph: u16 },
}
/// A semantic view, without recursively copying the box's painted contents.
#[derive(Clone, Debug, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
@@ -188,6 +189,10 @@ pub(super) fn text_nodes(nodes: &[TextNode]) -> Vec<DiagnosticNode> {
font: run.font.id, text: run.text.clone(),
glyphs: run.glyphs.iter().map(|glyph| glyph.id).collect(),
},
TextNode::ExplicitOpenTypeGlyph(run) => DiagnosticNode::OpenTypeGlyph {
font: run.font.id,
glyph: run.glyphs[0].id,
},
TextNode::Box(b) if b.native_box.is_some() => {
DiagnosticNode::Box(box_view(b.native_box.as_ref().unwrap()))
}
@@ -489,6 +494,11 @@ impl Printer<'_> {
self.literal(" ");
self.literal(text);
}
DiagnosticNode::OpenTypeGlyph { font, glyph } => {
let name = self.state.fonts.font(*font)?.identifier_text();
self.command(&name);
self.literal(&format!(" glyph#{glyph}"));
}
DiagnosticNode::Box(b) => self.box_(b, prefix)?,
DiagnosticNode::EmptyBox(w) => {
self.command("hbox");