Check stacked limits against pdfLaTeX

This commit is contained in:
gloamxun committed 2026-10-26 00:59:19 +08:00
1 parent 52a74755f7
commit 569160f805
6 files changed
+107 -13

No files matched your search

+9 -4
View File
@@ -1232,23 +1232,28 @@ impl Page {
Self::paint_math(base, font, x, baseline, size, list);
let small = (size as f64 * 0.7) as i64;
if let Some(sup) = sup {
let sup_box = math::layout_math(sup, font);
let sup_box = math::script_metrics(math::layout_math(sup, font));
Self::paint_math(
sup,
font,
x + (base_box.width - sup_box.width).max(0) / 2,
baseline - base_box.height - small,
baseline - base_box.height - sup_box.depth + 96_993,
small,
list,
);
}
if let Some(sub) = sub {
let sub_box = math::layout_math(sub, font);
let sub_box = math::script_metrics(math::layout_math(sub, font));
Self::paint_math(
sub,
font,
x + (base_box.width - sub_box.width).max(0) / 2,
baseline + base_box.depth + small,
baseline
+ math::intrinsic_depth(base, font)
+ 131_072
+ sub_box.height
+ 65_536
+ 46_531,
small,
list,
);