diff --git a/crates/typst-layout/src/math/text.rs b/crates/typst-layout/src/math/text.rs index 59ac5b089..7ecbcfbaf 100644 --- a/crates/typst-layout/src/math/text.rs +++ b/crates/typst-layout/src/math/text.rs @@ -65,18 +65,13 @@ fn layout_inline_text( // Small optimization for numbers. Note that this lays out slightly // differently to normal text and is worth re-evaluating in the future. let mut fragments = vec![]; - let is_single = text.chars().count() == 1; for unstyled_c in text.chars() { let c = styled_char(styles, unstyled_c, false); let mut glyph = GlyphFragment::new(ctx, styles, c, span); - if is_single { - // Duplicate what `layout_glyph` does exactly even if it's - // probably incorrect here. - match EquationElem::size_in(styles) { - MathSize::Script => glyph.make_script_size(ctx), - MathSize::ScriptScript => glyph.make_script_script_size(ctx), - _ => {} - } + match EquationElem::size_in(styles) { + MathSize::Script => glyph.make_script_size(ctx), + MathSize::ScriptScript => glyph.make_script_script_size(ctx), + _ => {} } fragments.push(glyph.into()); } diff --git a/tests/ref/issue-4828-math-number-multi-char.png b/tests/ref/issue-4828-math-number-multi-char.png index ff0a9bab9..b365645d3 100644 Binary files a/tests/ref/issue-4828-math-number-multi-char.png and b/tests/ref/issue-4828-math-number-multi-char.png differ diff --git a/tests/ref/issue-5489-matrix-stray-linebreak.png b/tests/ref/issue-5489-matrix-stray-linebreak.png index 2d278bd5c..f4e41bf99 100644 Binary files a/tests/ref/issue-5489-matrix-stray-linebreak.png and b/tests/ref/issue-5489-matrix-stray-linebreak.png differ diff --git a/tests/ref/math-attach-kerning-mixed.png b/tests/ref/math-attach-kerning-mixed.png index 9d0bea27a..64a546869 100644 Binary files a/tests/ref/math-attach-kerning-mixed.png and b/tests/ref/math-attach-kerning-mixed.png differ diff --git a/tests/ref/math-attach-limit-long.png b/tests/ref/math-attach-limit-long.png index b79e6ed4a..555f9c66c 100644 Binary files a/tests/ref/math-attach-limit-long.png and b/tests/ref/math-attach-limit-long.png differ diff --git a/tests/ref/math-attach-prescripts.png b/tests/ref/math-attach-prescripts.png index f0d21cb8a..bcd60c0a0 100644 Binary files a/tests/ref/math-attach-prescripts.png and b/tests/ref/math-attach-prescripts.png differ diff --git a/tests/ref/math-frac-precedence.png b/tests/ref/math-frac-precedence.png index fd16f2e6b..bddcb43c3 100644 Binary files a/tests/ref/math-frac-precedence.png and b/tests/ref/math-frac-precedence.png differ diff --git a/tests/ref/math-root-frame-size-index.png b/tests/ref/math-root-frame-size-index.png index 41d4df2e9..f47049568 100644 Binary files a/tests/ref/math-root-frame-size-index.png and b/tests/ref/math-root-frame-size-index.png differ diff --git a/tests/ref/math-root-large-index.png b/tests/ref/math-root-large-index.png index 85689823d..29dd478fe 100644 Binary files a/tests/ref/math-root-large-index.png and b/tests/ref/math-root-large-index.png differ