Continue XeTeX text layout on missing legacy glyphs

This commit is contained in:
gloamxun committed 2026-11-29 00:28:09 +08:00
1 parent cb6525ffca
commit 90f174283e
5 files changed
+114 -15

No files matched your search

@@ -385,6 +385,7 @@ impl Executor {
files: &mut impl SourceProvider,
) -> Result<(), Error> {
let slot = slot.into();
let xetex = self.state.input_profile() == InputProfile::XeTeX;
let tracing = self.read_parameter(Parameter::Tracinglostchars).width();
let online = self.read_parameter(Parameter::Tracingonline).width();
let destination = if tracing <= 0 {
@@ -403,7 +404,8 @@ impl Executor {
match slot {
0..=31 => format!("^^{}", char::from(slot as u8 + 64)),
127 => "^^?".into(),
128..=255 => format!("^^{slot:02x}"),
128..=159 => format!("^^{slot:02x}"),
160..=255 if !xetex => format!("^^{slot:02x}"),
_ => char::from_u32(slot)
.map(|c| c.to_string())
.unwrap_or_else(|| format!("U+{slot:04X}")),
@@ -423,17 +425,14 @@ impl Executor {
} else {
"Missing character: There is no "
});
let tail = literal(&if tracing > 2 {
format!(
" (\"{slot:X}) in font {}.",
self.state.fonts.font(font).expect("loaded font").name()
)
let code = if xetex || tracing > 2 {
format!(" (\"{slot:X})")
} else {
format!(
" in font {}!",
self.state.fonts.font(font).expect("loaded font").name()
)
});
String::new()
};
let font = self.state.fonts.font(font).expect("loaded font").name();
let end = if tracing > 2 { '.' } else { '!' };
let tail = literal(&format!("{code} in font {font}{end}"));
format!("{head}{printed}{tail}")
});
self.events.push(Event::MissingGlyph(MissingGlyph {