diff options
| author | Laurenz <laurmaedje@gmail.com> | 2023-02-02 19:50:14 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2023-02-02 19:50:14 +0100 |
| commit | 3f85d005bb5f343bb32a86d663f5dcfeef27f38a (patch) | |
| tree | 1349c139b22911e52e92eaf5c088ca1c29221f6e | |
| parent | 10675cd6d510521715c5e33508d80c4193ad9d74 (diff) | |
Fix root index placement again
| -rw-r--r-- | library/src/math/root.rs | 6 | ||||
| -rw-r--r-- | tests/ref/math/root.png | bin | 9126 -> 9467 bytes | |||
| -rw-r--r-- | tests/typ/math/root.typ | 3 |
3 files changed, 4 insertions, 5 deletions
diff --git a/library/src/math/root.rs b/library/src/math/root.rs index e1c8d987..fa41167d 100644 --- a/library/src/math/root.rs +++ b/library/src/math/root.rs @@ -1,7 +1,5 @@ use super::*; -const MIN_INDEX_SHIFT: Em = Em::new(0.35); - /// # Square Root /// A square root. /// @@ -123,12 +121,12 @@ fn layout( let inner_ascent = extra_ascender + thickness + gap + radicand.ascent(); let mut sqrt_offset = Abs::zero(); + let mut shift_up = Abs::zero(); let mut ascent = inner_ascent; - let mut shift_up = raise_factor * sqrt.height() - descent; if let Some(index) = &index { sqrt_offset = kern_before + index.width() + kern_after; - shift_up.set_max(index.descent() + MIN_INDEX_SHIFT.scaled(ctx)); + shift_up = raise_factor * sqrt.height() - descent + index.descent(); ascent.set_max(shift_up + index.ascent()); } diff --git a/tests/ref/math/root.png b/tests/ref/math/root.png Binary files differindex 8d906394..1f08de70 100644 --- a/tests/ref/math/root.png +++ b/tests/ref/math/root.png diff --git a/tests/typ/math/root.typ b/tests/typ/math/root.typ index 8d3e2de0..fdb37bc1 100644 --- a/tests/typ/math/root.typ +++ b/tests/typ/math/root.typ @@ -35,4 +35,5 @@ $ v = sqrt((1/2) / (4/5)) // Test large index. $ root(2, x) quad root(3/(2/1), x) quad - root(1/11, x) $ + root(1/11, x) quad + root(1/2/3, 1) $ |
