diff --git a/library/src/math/mod.rs b/library/src/math/mod.rs index 3e461150b..5aeedf6f8 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::() { + 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 f02045269..3476dbc48 100644 Binary files a/tests/ref/math/content.png and b/tests/ref/math/content.png differ diff --git a/tests/typ/math/content.typ b/tests/typ/math/content.typ index 271e00a52..c5a62fb41 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]$.