Include unboxed inline math in pdfTeX font expansion
This commit is contained in:
1 parent
8cd0263b97
commit
0f10163b5b
4 files changed
+91
-8
No files matched your search
@@ -73,17 +73,21 @@ struct Character<'a> {
|
||||
}
|
||||
|
||||
fn character(node: &TextNode) -> Option<Character<'_>> {
|
||||
let TextNode::Glyph { font: id, glyph, slot, .. } = node else {
|
||||
return None;
|
||||
let (glyph, text_character) = match node {
|
||||
TextNode::Glyph { font, glyph, slot, .. } => (glyph, Some((*font, *slot))),
|
||||
// Inline math contributes its unboxed characters to the paragraph.
|
||||
TextNode::MathChar(glyph) => (glyph, None),
|
||||
_ => return None,
|
||||
};
|
||||
let geometry = glyph.math_geometry.as_ref()?;
|
||||
let MathItem::NativeGlyph { font, .. } = &geometry.items.first()?.item else {
|
||||
let MathItem::NativeGlyph { font, slot, .. } = &geometry.items.first()?.item else {
|
||||
return None;
|
||||
};
|
||||
let (id, slot) = text_character.unwrap_or((font.id, *slot));
|
||||
Some(Character {
|
||||
font,
|
||||
id: *id,
|
||||
slot: *slot,
|
||||
id,
|
||||
slot,
|
||||
width: glyph.width,
|
||||
})
|
||||
}
|
||||
@@ -445,10 +449,14 @@ pub(super) fn pack(
|
||||
let metrics = state.fonts.character(selected, glyph.slot)?
|
||||
.ok_or_else(|| format!("expanded font has no TFM slot {}", glyph.slot))?;
|
||||
let face = state.fonts.glyph_font(selected)?;
|
||||
let TextNode::Glyph { font, glyph, .. } = &mut material[i] else {
|
||||
unreachable!()
|
||||
let glyph = match &mut material[i] {
|
||||
TextNode::Glyph { font, glyph, .. } => {
|
||||
*font = selected;
|
||||
glyph
|
||||
}
|
||||
TextNode::MathChar(glyph) => glyph,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
*font = selected;
|
||||
glyph.width = metrics.width;
|
||||
glyph.height = metrics.height;
|
||||
glyph.depth = metrics.depth;
|
||||
|
||||
Reference in new issue
Block a user