Grow left-right delimiters with tall bodies

This commit is contained in:
gloamxun committed 2026-10-20 19:28:33 +08:00
1 parent b281738084
commit 72f7cfaf2a
2 files changed
+30 -9

No files matched your search

+8 -4
View File
@@ -639,22 +639,26 @@ impl Page {
}
MathAtom::Delimited { left, right, body } => {
let body_box = math::layout_math(body, font);
let scale = math::delimiter_scale(&body_box);
let delimiter_size = (size as f64 * scale) as i64;
let left_width = (font.width(*left) as f64 * scale) as i64;
let right_width = (font.width(*right) as f64 * scale) as i64;
if *left != '.' {
list.push(DisplayItem::Text {
font: FontFace::Roman,
x,
y: baseline,
size,
size: delimiter_size,
text: left.to_string(),
});
}
Self::paint_math(body, font, x + font.width(*left), baseline, size, list);
Self::paint_math(body, font, x + left_width, baseline, size, list);
if *right != '.' {
list.push(DisplayItem::Text {
font: FontFace::Roman,
x: x + font.width(*left) + body_box.width,
x: x + left_width + body_box.width,
y: baseline,
size,
size: delimiter_size,
text: right.to_string(),
});
}