Continue XeTeX text layout on missing legacy glyphs
This commit is contained in:
1 parent
cb6525ffca
commit
90f174283e
5 files changed
+114
-15
No files matched your search
@@ -442,19 +442,20 @@ impl Executor {
|
||||
return Ok(());
|
||||
}
|
||||
let font = self.state.text_font();
|
||||
let opentype = if self.state.input_profile() != super::super::InputProfile::TeX8Bit {
|
||||
let profile = self.state.input_profile();
|
||||
let opentype = if profile != InputProfile::TeX8Bit {
|
||||
self.state.fonts.font(font).map_err(|e| self.error(e, token.span))?.opentype().cloned()
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let slot = u8::try_from(c as u32).ok();
|
||||
if slot.is_none() && opentype.is_none() {
|
||||
if profile != InputProfile::XeTeX && slot.is_none() && opentype.is_none() {
|
||||
return Err(self.error("native TFM text font requires an 8-bit character slot", token.span));
|
||||
}
|
||||
if self.paragraph.is_none() {
|
||||
self.begin_paragraph(token.invocation.unwrap_or(token.span), true)?;
|
||||
}
|
||||
let space_factor = if slot.is_some() || self.state.input_profile() == InputProfile::XeTeX {
|
||||
let space_factor = if slot.is_some() || profile == InputProfile::XeTeX {
|
||||
self.read_space_factor_code(u32::from(c))
|
||||
} else {
|
||||
1000
|
||||
@@ -478,7 +479,7 @@ impl Executor {
|
||||
self.reads.insert(Dependency::FontResources);
|
||||
self.reads.insert(Dependency::TextFont);
|
||||
if let Some(font) = opentype {
|
||||
if self.state.input_profile() == InputProfile::XeTeX {
|
||||
if profile == InputProfile::XeTeX {
|
||||
self.reads.insert(Dependency::Parameter(Parameter::XeTeXuseglyphmetrics));
|
||||
self.reads.insert(Dependency::Parameter(Parameter::XeTeXgenerateactualtext));
|
||||
self.reads.insert(Dependency::Parameter(Parameter::XeTeXinterwordspaceshaping));
|
||||
@@ -495,6 +496,15 @@ impl Executor {
|
||||
.opentype_character(c, TokenOrigin::from(token), &self.state, font)
|
||||
.map_err(|e| self.error(e, token.invocation.unwrap_or(token.span)));
|
||||
}
|
||||
if slot.is_none() {
|
||||
// The pending character saw this scalar as lookahead, so there
|
||||
// is no right-boundary ligature and no new legacy character node.
|
||||
let paragraph = self.paragraph.as_mut().unwrap();
|
||||
paragraph.finish_text(false, &self.state)
|
||||
.map_err(|e| self.error(e, token.invocation.unwrap_or(token.span)))?;
|
||||
self.paragraph.as_mut().unwrap().cancel_boundary = false;
|
||||
return self.missing_glyph(font, u32::from(c), token.invocation.unwrap_or(token.span), files);
|
||||
}
|
||||
let missing = self
|
||||
.paragraph
|
||||
.as_mut()
|
||||
|
||||
Reference in new issue
Block a user