render: Fix spanned width distribution for cells not at top or left.
authorBen Pfaff <blp@cs.stanford.edu>
Sun, 22 Jan 2023 20:32:59 +0000 (12:32 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Fri, 27 Jan 2023 19:50:31 +0000 (11:50 -0800)
This code always used the widths of rules at the left or top side of the
table, even in cases where the spanned cells were not at the top of left
side of the table.  This obviously made the calculations wrong sometimes.

src/output/render.c

index 32e6f4513710dbd8696a296e207d7362b24b717f..57ccd5f95c1c1dde2509b4d4f037bb008cc04eac 100644 (file)
@@ -718,8 +718,10 @@ render_page_create (const struct render_params *params, struct table *table,
             params->ops->measure_cell_width (params->aux, &cell,
                                              &w[MIN], &w[MAX]);
             for (int i = 0; i < 2; i++)
-              distribute_spanned_width (w[i], &columns[i][cell.d[H][0]],
-                                        rules[H], table_cell_colspan (&cell));
+              distribute_spanned_width (w[i],
+                                        &columns[i][cell.d[H][0]],
+                                        &rules[H][cell.d[H][0]],
+                                        table_cell_colspan (&cell));
           }
         x = cell.d[H][1];
       }
@@ -795,7 +797,9 @@ render_page_create (const struct render_params *params, struct table *table,
           {
             int w = joined_width (page, H, cell.d[H][0], cell.d[H][1]);
             int h = params->ops->measure_cell_height (params->aux, &cell, w);
-            distribute_spanned_width (h, &rows[cell.d[V][0]], rules[V],
+            distribute_spanned_width (h,
+                                      &rows[cell.d[V][0]],
+                                      &rules[V][cell.d[V][0]],
                                       table_cell_rowspan (&cell));
           }
         x = cell.d[H][1];