Read XeTeX font character ranges from active charmaps
This commit is contained in:
1 parent
fc6d704edf
commit
4e16531a62
9 files changed
+4672
-8
No files matched your search
@@ -196,12 +196,19 @@ impl Executor {
|
||||
}
|
||||
|
||||
let id = self.font_identifier(files)?;
|
||||
let font = self.state.fonts.font(id).map_err(|error| self.error(error, self.current))?
|
||||
.opentype().cloned();
|
||||
let instance = self.state.fonts.font(id).map_err(|error| self.error(error, self.current))?;
|
||||
let font = instance.opentype();
|
||||
if matches!(command, XeTeXfirstfontchar | XeTeXlastfontchar) {
|
||||
let range = match font {
|
||||
Some(font) => font.character_range().map_err(|error| self.error(error, self.current))?,
|
||||
None => instance.metrics().map_or([1, 0], crate::tfm::TfmMetrics::character_range),
|
||||
};
|
||||
return Ok(range[usize::from(command == XeTeXlastfontchar)] as i32);
|
||||
}
|
||||
if command == XeTeXfonttype {
|
||||
return Ok(if font.is_some() { 2 } else { 0 });
|
||||
}
|
||||
let Some(font) = font else {
|
||||
let Some(font) = font.cloned() else {
|
||||
return match command {
|
||||
XeTeXcountglyphs | XeTeXOTcountscripts => Ok(0),
|
||||
_ => self.fail("XeTeX OpenType layout query requires a native OpenType font"),
|
||||
|
||||
Reference in new issue
Block a user