mirror of
https://github.com/typst/typst
synced 2025-05-14 04:56:26 +08:00
Fix root index placement again
This commit is contained in:
parent
10675cd6d5
commit
3f85d005bb
@ -1,7 +1,5 @@
|
|||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
const MIN_INDEX_SHIFT: Em = Em::new(0.35);
|
|
||||||
|
|
||||||
/// # Square Root
|
/// # Square Root
|
||||||
/// A square root.
|
/// A square root.
|
||||||
///
|
///
|
||||||
@ -123,12 +121,12 @@ fn layout(
|
|||||||
let inner_ascent = extra_ascender + thickness + gap + radicand.ascent();
|
let inner_ascent = extra_ascender + thickness + gap + radicand.ascent();
|
||||||
|
|
||||||
let mut sqrt_offset = Abs::zero();
|
let mut sqrt_offset = Abs::zero();
|
||||||
|
let mut shift_up = Abs::zero();
|
||||||
let mut ascent = inner_ascent;
|
let mut ascent = inner_ascent;
|
||||||
let mut shift_up = raise_factor * sqrt.height() - descent;
|
|
||||||
|
|
||||||
if let Some(index) = &index {
|
if let Some(index) = &index {
|
||||||
sqrt_offset = kern_before + index.width() + kern_after;
|
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());
|
ascent.set_max(shift_up + index.ascent());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 8.9 KiB After Width: | Height: | Size: 9.2 KiB |
@ -35,4 +35,5 @@ $ v = sqrt((1/2) / (4/5))
|
|||||||
// Test large index.
|
// Test large index.
|
||||||
$ root(2, x) quad
|
$ root(2, x) quad
|
||||||
root(3/(2/1), x) quad
|
root(3/(2/1), x) quad
|
||||||
root(1/11, x) $
|
root(1/11, x) quad
|
||||||
|
root(1/2/3, 1) $
|
||||||
|
Loading…
x
Reference in New Issue
Block a user