Apply script-style to numbers consistently in math (#6320)
@ -65,18 +65,13 @@ fn layout_inline_text(
|
|||||||
// Small optimization for numbers. Note that this lays out slightly
|
// Small optimization for numbers. Note that this lays out slightly
|
||||||
// differently to normal text and is worth re-evaluating in the future.
|
// differently to normal text and is worth re-evaluating in the future.
|
||||||
let mut fragments = vec![];
|
let mut fragments = vec![];
|
||||||
let is_single = text.chars().count() == 1;
|
|
||||||
for unstyled_c in text.chars() {
|
for unstyled_c in text.chars() {
|
||||||
let c = styled_char(styles, unstyled_c, false);
|
let c = styled_char(styles, unstyled_c, false);
|
||||||
let mut glyph = GlyphFragment::new(ctx, styles, c, span);
|
let mut glyph = GlyphFragment::new(ctx, styles, c, span);
|
||||||
if is_single {
|
match EquationElem::size_in(styles) {
|
||||||
// Duplicate what `layout_glyph` does exactly even if it's
|
MathSize::Script => glyph.make_script_size(ctx),
|
||||||
// probably incorrect here.
|
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());
|
fragments.push(glyph.into());
|
||||||
}
|
}
|
||||||
|
Before Width: | Height: | Size: 465 B After Width: | Height: | Size: 461 B |
Before Width: | Height: | Size: 644 B After Width: | Height: | Size: 716 B |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 670 B After Width: | Height: | Size: 687 B |
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 902 B After Width: | Height: | Size: 897 B |
Before Width: | Height: | Size: 648 B After Width: | Height: | Size: 640 B |