Centre raster images inside floats

Add an x offset to VerticalItem::Image and use it when placing a decoded image
in a float, so a 0.4\textwidth plot is centred while its caption remains
centred across the float. Other image uses keep x=0.

Test count stays 1074.
This commit is contained in:
gloamxun committed 2026-10-27 23:37:54 +08:00
1 parent bbedf7676c
commit aa2f3cb0af
4 files changed
+12 -4

No files matched your search

+2 -1
View File
@@ -617,6 +617,7 @@ impl Page {
y += box_.height;
}
VerticalItem::Image {
x: image_x,
width,
height,
image,
@@ -627,7 +628,7 @@ impl Page {
rgb: image.rgb.clone(),
});
list.push(DisplayItem::Image {
x: 0,
x: *image_x,
y,
width: *width,
height: *height,