Skip to content

Commit eea8f13

Browse files
mkorjelaurmaedje
authored andcommitted
Fix bug in math.frac layout code (#5177)
1 parent d21cb2c commit eea8f13

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+9
-4
lines changed

crates/typst/src/math/frac.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,9 @@ fn layout(
130130
)?;
131131

132132
let around = FRAC_AROUND.at(font_size);
133-
let num_gap = (shift_up - axis - num.descent()).max(num_min + thickness / 2.0);
134-
let denom_gap = (shift_down + axis - denom.ascent()).max(denom_min + thickness / 2.0);
133+
let num_gap = (shift_up - (axis + thickness / 2.0) - num.descent()).max(num_min);
134+
let denom_gap =
135+
(shift_down + (axis - thickness / 2.0) - denom.ascent()).max(denom_min);
135136

136137
let line_width = num.width().max(denom.width());
137138
let width = line_width + 2.0 * around;

tests/ref/gradient-math-dir.png

33 Bytes

tests/ref/gradient-math-frac.png

-54 Bytes

tests/ref/gradient-math-root.png

-19 Bytes

tests/ref/issue-3658-math-size.png

2 Bytes
1 Byte
-20 Bytes

tests/ref/math-accent-bounds.png

-6 Bytes

tests/ref/math-attach-high.png

-24 Bytes
4 Bytes

0 commit comments

Comments
 (0)