Implement XeTeX native word ActualText across shaping and shipout

This commit is contained in:
gloamxun committed 2026-11-25 23:38:47 +08:00
1 parent 97319d751b
commit 7e5428ec35
15 files changed
+143 -24

No files matched your search

+8 -3
View File
@@ -60,6 +60,8 @@ pub enum DisplayItem {
glyph: u16,
text: String,
},
/// Word-level PDF replacement text. None closes the current word.
OpenTypeActualText(Option<String>),
/// A native math glyph. `face` preserves the optical master independently
/// of the painted size; `slot` preserves CMEX next-larger selection.
MathGlyph {
@@ -344,7 +346,8 @@ impl DisplayList {
fn svg_paint_items(&self) -> impl Iterator<Item = &DisplayItem> {
self.items
.iter()
.filter(|item| !matches!(item, DisplayItem::PdfImageObject(_)))
.filter(|item| !matches!(item,
DisplayItem::PdfImageObject(_) | DisplayItem::OpenTypeActualText(_)))
}
/// Compare the inputs consumed by SVG rendering. Font data for glyphs not
@@ -431,7 +434,8 @@ impl DisplayList {
*y += dy;
}
DisplayItem::Fill(_) | DisplayItem::Background(_) | DisplayItem::PdfColor(_) => {}
DisplayItem::Special(_) | DisplayItem::PdfImageObject(_) => {}
DisplayItem::Special(_) | DisplayItem::PdfImageObject(_)
| DisplayItem::OpenTypeActualText(_) => {}
}
}
}
@@ -715,7 +719,8 @@ impl DisplayList {
*thickness as f64 / 65_536.0
));
}
DisplayItem::Link { .. } | DisplayItem::PdfTextSpace { .. } => {}
DisplayItem::Link { .. } | DisplayItem::PdfTextSpace { .. }
| DisplayItem::OpenTypeActualText(_) => {}
DisplayItem::Special(content) => {
out.push_str(&format!(
"<!-- special: {} -->