Offset math scripts by the base italic correction

This commit is contained in:
gloamxun committed 2026-10-20 21:34:09 +08:00
1 parent 6a7e79fa03
commit 6dd4f6bf83
3 files changed
+34 -5

No files matched your search

+3 -2
View File
@@ -567,12 +567,13 @@ impl Page {
MathAtom::Script { base, sub, sup } => {
let base_box = math::layout_math(base, font);
Self::paint_math(base, font, x, baseline, size, list);
let italic = math::italic_correction(base, font);
let small = (size as f64 * 0.7) as i64;
if let Some(sup) = sup {
Self::paint_math(
sup,
font,
x + base_box.width,
x + base_box.width + italic,
baseline - base_box.height * 2 / 3,
small,
list,
@@ -582,7 +583,7 @@ impl Page {
Self::paint_math(
sub,
font,
x + base_box.width,
x + base_box.width + italic,
baseline + base_box.depth * 2 / 3,
small,
list,