From adbac27bbc8160a9f928e3100b3c180307eb7cdc Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Mon, 8 Dec 2025 17:42:35 -0800 Subject: [PATCH] work --- rust/pspp/src/output/drivers/cairo/pager.rs | 3 +-- rust/pspp/src/output/pivot.rs | 2 +- rust/pspp/src/output/render.rs | 13 ++++++++++++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/rust/pspp/src/output/drivers/cairo/pager.rs b/rust/pspp/src/output/drivers/cairo/pager.rs index f197d5f499..6cb1152992 100644 --- a/rust/pspp/src/output/drivers/cairo/pager.rs +++ b/rust/pspp/src/output/drivers/cairo/pager.rs @@ -146,8 +146,7 @@ impl CairoPager { }; // Prepare to render the current object. - let chunk = fsm.draw_slice(&context, dbg!((self.y_max - self.y).max(0))); - dbg!(chunk); + let chunk = fsm.draw_slice(&context, (self.y_max - self.y).max(0)); self.y += chunk + self.fsm_style.object_spacing; context.translate(0.0, xr_to_pt(chunk + self.fsm_style.object_spacing)); diff --git a/rust/pspp/src/output/pivot.rs b/rust/pspp/src/output/pivot.rs index 0ee01c6ba4..95a8e80c8d 100644 --- a/rust/pspp/src/output/pivot.rs +++ b/rust/pspp/src/output/pivot.rs @@ -2515,7 +2515,7 @@ impl Value { panic!("cannot create numeric pivot value with string format"); #[cfg(not(debug_assertions))] - Format::F8_2 + F8_2 } }, honor_small: false, diff --git a/rust/pspp/src/output/render.rs b/rust/pspp/src/output/render.rs index 4e8176da24..c1e6e84656 100644 --- a/rust/pspp/src/output/render.rs +++ b/rust/pspp/src/output/render.rs @@ -519,8 +519,13 @@ impl Page { } fn draw(&self, device: &mut dyn Device, ofs: Coord2) { + fn overlap(a: &Range, b: &Range) -> bool { + a.contains(&b.start) || b.contains(&a.start) + } + use Axis2::*; let cp = &self.table.cp; + let headers = Coord2::from_fn(|a| self.table.headers_width(a)); for (y, yr) in self.table.cp[Y] .iter() .copied() @@ -529,6 +534,9 @@ impl Page { .enumerate() .filter_map(|(y, yr)| if y % 2 == 1 { Some((y / 2, yr)) } else { None }) { + if yr.start >= headers[Y] && !overlap(&yr, &self.ranges[Y]) { + continue; + } for (x, xr) in self.table.cp[X] .iter() .copied() @@ -537,6 +545,9 @@ impl Page { .enumerate() .filter_map(|(x, xr)| if x % 2 == 1 { Some((x / 2, xr)) } else { None }) { + if xr.start >= headers[X] && !overlap(&xr, &self.ranges[X]) { + continue; + } let cell = self.table.table.get(CellPos { x, y }); // XXX skip if not top-left cell let rect = cell.rect(); @@ -989,7 +1000,7 @@ impl Pager { // Figure out the width of the body of the table. Use this to determine // the base scale. let body_page = Page::new(output.body, device, 0, &pivot_table.style.look); - let body_width = body_page.width(Axis2::X); + let body_width = body_page.width(Axis2::X).min(device.params().size.x()); let mut scale = if body_width > device.params().size[Axis2::X] && pivot_table.style.look.shrink_to_fit[Axis2::X] && device.params().can_scale -- 2.30.2