summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-02-03 17:47:05 +0100
committerLaurenz <laurmaedje@gmail.com>2023-02-03 17:47:05 +0100
commit93138e2d4bb7dbc09ab6ef3c6e139881a8f3bc61 (patch)
treea15d42a6b1c185e37ef73bf907025289f76ffa32
parent9e918d06adfdd680f153784e85657e45e9675ec6 (diff)
Fix font switch in math
-rw-r--r--library/src/math/mod.rs6
-rw-r--r--tests/ref/math/content.pngbin5372 -> 6731 bytes
-rw-r--r--tests/typ/math/content.typ5
3 files changed, 11 insertions, 0 deletions
diff --git a/library/src/math/mod.rs b/library/src/math/mod.rs
index 3e461150..5aeedf6f 100644
--- a/library/src/math/mod.rs
+++ b/library/src/math/mod.rs
@@ -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());
diff --git a/tests/ref/math/content.png b/tests/ref/math/content.png
index f0204526..3476dbc4 100644
--- a/tests/ref/math/content.png
+++ b/tests/ref/math/content.png
Binary files differ
diff --git a/tests/typ/math/content.typ b/tests/typ/math/content.typ
index 271e00a5..c5a62fb4 100644
--- a/tests/typ/math/content.typ
+++ b/tests/typ/math/content.typ
@@ -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]$.