Set multline rows flush to the margins

This commit is contained in:
gloamxun committed 2026-10-26 00:46:22 +08:00
1 parent 4edc951958
commit 29d363d47a
6 files changed
+209 -10

No files matched your search

+29
View File
@@ -1091,6 +1091,35 @@ impl Page {
});
}
}
MathAtom::Multline { rows, tag } => {
let layout = math::multline_layout(rows, tag.as_deref(), font);
let first_baseline = baseline - layout.height + layout.first_height;
for (index, row) in rows.iter().enumerate() {
Self::paint_math(
row,
font,
x + layout.offsets[index],
first_baseline + layout.baselines[index],
size,
list,
);
}
if let Some(tag) = tag {
let row_baseline =
first_baseline + layout.baselines.last().copied().unwrap_or(0);
let mut tag_x = x + layout.body_width;
for character in tag.chars() {
list.push(DisplayItem::Text {
font: FontFace::Roman,
x: tag_x,
y: row_baseline,
size,
text: character.to_string(),
});
tag_x += Cmr10Metrics::Roman.width(character);
}
}
}
MathAtom::Accent { accent, base } => {
let base_box = math::layout_math(base, font);
Self::paint_math(base, font, x, baseline, size, list);