Use shaped glyph edges for XeTeX protrusion and line breaking
This commit is contained in:
1 parent
5df90f113c
commit
6826efbeb1
12 files changed
+231
-39
No files matched your search
@@ -103,6 +103,38 @@ impl Executor {
|
||||
_ => unreachable!(),
|
||||
} as i32)
|
||||
}
|
||||
pub(super) fn protrusion_target(
|
||||
&mut self,
|
||||
files: &mut impl SourceProvider,
|
||||
) -> Result<(FontId, i32), Error> {
|
||||
self.reads.insert(Dependency::FontResources);
|
||||
if self.state.input_profile() != InputProfile::XeTeX {
|
||||
let (font, slot) = self.font_character_target(files)?;
|
||||
return Ok((font, i32::from(slot)));
|
||||
}
|
||||
|
||||
let id = self.font_identifier(files)?;
|
||||
let opentype = self.state.fonts.font(id)
|
||||
.map_err(|error| self.error(error, self.current))?.opentype().cloned();
|
||||
let slot = if let Some(font) = opentype {
|
||||
if self.keyword("/", files)? {
|
||||
let name = self.filename(files)?;
|
||||
font.face().map_err(|error| self.error(error, self.current))?
|
||||
.glyph_index_by_name(&name).map_or(0, |glyph| i32::from(glyph.0))
|
||||
} else if self.keyword("u", files)? {
|
||||
let slot = self.character_number("XeTeX glyph character", 65535, files)?;
|
||||
let face = font.face().map_err(|error| self.error(error, self.current))?;
|
||||
char::from_u32(slot).and_then(|c| face.glyph_index(c))
|
||||
.map_or(0, |glyph| i32::from(glyph.0))
|
||||
} else {
|
||||
self.integer(files)?
|
||||
}
|
||||
} else {
|
||||
self.character_number("XeTeX font character", 65535, files)? as i32
|
||||
};
|
||||
Ok((id, slot))
|
||||
}
|
||||
|
||||
pub(super) fn xetex_font_query(
|
||||
&mut self,
|
||||
command: Primitive,
|
||||
|
||||
Reference in new issue
Block a user