Pad color boxes by fboxsep

This commit is contained in:
gloamxun committed 2026-10-26 04:11:42 +08:00
1 parent 8e274a252d
commit 0340878909
3 files changed
+19 -10

No files matched your search

+14 -8
View File
@@ -672,12 +672,18 @@ impl Page {
} else {
flush_link(&mut link_run, &mut list.items);
}
let padding =
if box_.background.is_some() || box_.frame.is_some() {
3 * 65_536
} else {
0
};
if let Some(background) = box_.background {
list.items.push(DisplayItem::Rect {
x,
y: baseline - box_.height,
width: box_.width,
height: box_.height + box_.depth,
x: x - padding,
y: baseline - box_.height - padding,
width: box_.width + 2 * padding,
height: box_.height + box_.depth + 2 * padding,
color: background,
});
list.items.push(DisplayItem::Fill([0, 0, 0]));
@@ -685,10 +691,10 @@ impl Page {
}
if let Some((frame_color, thickness)) = box_.frame {
list.items.push(DisplayItem::Frame {
x,
y: baseline - box_.height,
width: box_.width,
height: box_.height + box_.depth,
x: x - padding,
y: baseline - box_.height - padding,
width: box_.width + 2 * padding,
height: box_.height + box_.depth + 2 * padding,
color: frame_color,
thickness,
});