diff options
| author | Max <me@mkor.je> | 2025-02-24 16:05:36 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-24 16:05:36 +0000 |
| commit | 81efc82d3c0f7ccbcb40959ac8bddeca49e4c9f8 (patch) | |
| tree | 3bf8c9623574c49316b897ce6be11b291d342d81 /crates/typst-layout | |
| parent | 69c3f957051358eff961addbcae4ff02448513dc (diff) | |
Fix math accent base height calculation (#5941)
Diffstat (limited to 'crates/typst-layout')
| -rw-r--r-- | crates/typst-layout/src/math/accent.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/crates/typst-layout/src/math/accent.rs b/crates/typst-layout/src/math/accent.rs index 951870d6..f2dfa2c4 100644 --- a/crates/typst-layout/src/math/accent.rs +++ b/crates/typst-layout/src/math/accent.rs @@ -34,7 +34,7 @@ pub fn layout_accent( // Try to replace accent glyph with flattened variant. let flattened_base_height = scaled!(ctx, styles, flattened_accent_base_height); - if base.height() > flattened_base_height { + if base.ascent() > flattened_base_height { glyph.make_flattened_accent_form(ctx); } @@ -50,7 +50,7 @@ pub fn layout_accent( // minus the accent base height. Only if the base is very small, we need // a larger gap so that the accent doesn't move too low. let accent_base_height = scaled!(ctx, styles, accent_base_height); - let gap = -accent.descent() - base.height().min(accent_base_height); + let gap = -accent.descent() - base.ascent().min(accent_base_height); let size = Size::new(base.width(), accent.height() + gap + base.height()); let accent_pos = Point::with_x(base_attach - accent_attach); let base_pos = Point::with_y(accent.height() + gap); |
