Execute Unicode math codes and measured OpenType math characters

This commit is contained in:
gloamxun committed 2026-11-21 11:47:56 +08:00
1 parent ce8a780031
commit d17680fcd8
24 files changed
+687 -123

No files matched your search

@@ -13,11 +13,11 @@ impl Converter<'_> {
if let MathField::Char(c) = n.nucleus {
let base_id = self.font(c.family, style)?;
let base_font = self.state.math_font(style.size_index() as u8, c.family);
if !self.state.font_has_slot(base_font, c.slot) {
if !self.has_math_char(base_font, c.slot)? {
self.missing.borrow_mut().push((base_font, c.slot));
n.nucleus = MathField::Empty;
} else if let Ok(code) = u8::try_from(self.state.font_integers(base_font).skew) {
skew = base_id.metrics().kern(char::from(c.slot), char::from(code));
skew = base_id.metrics().kern(char::from(c.slot as u8), char::from(code));
}
}
let mut base = self.field(&n.nucleus, style.cramped_style(), &n.source.nucleus)?;
@@ -26,14 +26,14 @@ impl Converter<'_> {
// Larger accents are chosen by actual TFM list tags and advance widths.
let metrics = id.metrics();
let mut visited = std::collections::BTreeSet::new();
while let Some(next) = metrics.next_larger(char::from(accent.slot)) {
while let Some(next) = metrics.next_larger(char::from(accent.slot as u8)) {
if !visited.insert(accent.slot) {
return Err("cyclic native accent size list".into());
}
if !self.state.font_has_slot(font, next) || metrics.width(char::from(next)) > width {
break;
}
accent.slot = next;
accent.slot = u32::from(next);
}
let mut delta = height.min(i64::from(self.state.fonts.font(font)?.x_height()));
if matches!(n.nucleus, MathField::Char(_)) && (n.sub.is_some() || n.sup.is_some()) {