Fix font switch in math

This commit is contained in:
Laurenz 2023-02-03 17:47:05 +01:00
parent 9e918d06ad
commit 93138e2d4b
3 changed files with 11 additions and 0 deletions

View File

@ -252,6 +252,12 @@ impl LayoutMath for Content {
}
if let Some(styled) = self.to::<StyledNode>() {
if styled.map.contains(TextNode::FAMILY) {
let frame = ctx.layout_content(self)?;
ctx.push(FrameFragment::new(ctx, frame).with_spaced(true));
return Ok(());
}
let prev_map = std::mem::replace(&mut ctx.map, styled.map.clone());
let prev_size = ctx.size;
ctx.map.apply(prev_map.clone());

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

@ -12,3 +12,8 @@ $ x := #table(columns: 2)[x][y]/mat(1, 2, 3) $
---
// Test non-formula math directly in content.
#math.attach($a$, top: [b])
---
// Test font switch.
#let here = text.with("Noto Sans")
$#here[f] := #here[Hi there]$.