work
authorBen Pfaff <blp@cs.stanford.edu>
Tue, 9 Dec 2025 01:42:35 +0000 (17:42 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Tue, 9 Dec 2025 01:42:35 +0000 (17:42 -0800)
rust/pspp/src/output/drivers/cairo/pager.rs
rust/pspp/src/output/pivot.rs
rust/pspp/src/output/render.rs

index f197d5f4997ba8459d4b7f7951c7d77972c82ff8..6cb1152992938ae7553b5ce98e754d1cf4feb2f6 100644 (file)
@@ -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));
 
index 0ee01c6ba41fd73c7516d334dc4b2006095eb8de..95a8e80c8dea065c679c032c35a4f7b9acd3b016 100644 (file)
@@ -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,
index 4e8176da2490c4136da49366eb95fe06ce44f701..c1e6e84656a5ad9da6346ce752a66710c0222abb 100644 (file)
@@ -519,8 +519,13 @@ impl Page {
     }
 
     fn draw(&self, device: &mut dyn Device, ofs: Coord2) {
+        fn overlap(a: &Range<isize>, b: &Range<isize>) -> 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