Fix margins
authorBen Pfaff <blp@cs.stanford.edu>
Fri, 26 Dec 2025 00:39:43 +0000 (16:39 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Fri, 26 Dec 2025 00:39:43 +0000 (16:39 -0800)
rust/pspp/src/output/drivers/cairo/fsm.rs
rust/pspp/src/output/pivot/value.rs

index 786c1a3c9e78a823cd12aeeb93f7548ccdefa219..9567e25792bb724639b9e2fbecbd8e5f7f493d41 100644 (file)
@@ -544,7 +544,7 @@ impl Device for CairoDevice<'_> {
     fn measure_cell_height(&self, cell: &DrawCell, width: isize) -> isize {
         let margins = &cell.cell_style.margins;
         let bb = Rect2::new(
-            0..width.saturating_sub(px_to_xr(margins[Axis2::X].len() as isize)),
+            0..width.saturating_sub(margin(cell, Axis2::X)),
             0..isize::MAX,
         );
         self.measure_cell(cell, bb).y() + margin(cell, Axis2::Y)
index 9127658e661e7290059937395408c21283666b35..1f37966f31988b64047d424c66948674b9a44ed0 100644 (file)
@@ -272,6 +272,7 @@ impl Value {
         self
     }
 
+    /// Returns this `Value` with the added `footnotes`.
     pub fn with_footnotes<'a>(
         mut self,
         footnotes: impl IntoIterator<Item = &'a Arc<Footnote>>,
@@ -289,6 +290,7 @@ impl Value {
         footnotes.sort_by_key(|f| f.index);
     }
 
+    /// Returns this `Value` with the added `subscripts`.
     pub fn with_subscripts<'a>(
         mut self,
         subscripts: impl IntoIterator<Item = impl Into<String>>,
@@ -299,11 +301,13 @@ impl Value {
         self
     }
 
+    /// Returns this `Value` with the added `subscript`.
     pub fn with_subscript(mut self, subscript: impl Into<String>) -> Self {
         self.add_subscript(subscript);
         self
     }
 
+    /// Adds `subscript` to this `Value`.
     pub fn add_subscript(&mut self, subscript: impl Into<String>) {
         self.styling_mut().subscripts.push(subscript.into());
     }
@@ -1202,6 +1206,8 @@ impl ValueInner {
         }
     }
 
+    /// Constructs a new text `ValueInner` from `s`, which should have been
+    /// provided by the user.
     pub fn new_user_text(s: impl Into<String>) -> Self {
         let s: String = s.into();
         if !s.is_empty() {