diff options
| author | Max <max@mkor.je> | 2025-06-04 08:20:54 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-04 08:20:54 +0000 |
| commit | 128c40d839398374c69725a5b19c24e07fb23c3d (patch) | |
| tree | e35b05647dcc1c43baf9147d0048837d013879fc /crates/typst-layout | |
| parent | 4a8367e90add92a0a316bcc258e39d522b484c25 (diff) | |
Apply script-style to numbers consistently in math (#6320)
Diffstat (limited to 'crates/typst-layout')
| -rw-r--r-- | crates/typst-layout/src/math/text.rs | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/crates/typst-layout/src/math/text.rs b/crates/typst-layout/src/math/text.rs index 59ac5b08..7ecbcfba 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()); } |
