output: Remove support for bottom and right side headers.
authorBen Pfaff <blp@cs.stanford.edu>
Sun, 22 Jan 2023 00:56:40 +0000 (16:56 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Thu, 16 Feb 2023 22:24:55 +0000 (14:24 -0800)
src/output/html.c
src/output/odt.c
src/output/pivot-output.c
src/output/render.c
src/output/table.c
src/output/table.h
src/output/tex.c

index d3049e6564bd95e5c925a99a605c7bb2e96cd8a8..99390f9ded51e5cebc0571f5ab4346d100c6aae0 100644 (file)
@@ -672,10 +672,10 @@ html_output_table_layer (struct html_driver *html, const struct pivot_table *pt,
           table_get_cell (body, x, y, &cell);
           if (x == cell.d[TABLE_HORZ][0] && y == cell.d[TABLE_VERT][0])
             {
           table_get_cell (body, x, y, &cell);
           if (x == cell.d[TABLE_HORZ][0] && y == cell.d[TABLE_VERT][0])
             {
-              bool is_header = (y < body->h[V][0]
-                                || y >= body->n[V] - body->h[V][1]
-                                || x < body->h[H][0]
-                                || x >= body->n[H] - body->h[H][1]);
+              bool is_header = (y < body->h[V]
+                                || y >= body->n[V]
+                                || x < body->h[H]
+                                || x >= body->n[H]);
               const char *tag = is_header ? "th" : "td";
               html_put_table_cell (html, pt, &cell, tag, body);
             }
               const char *tag = is_header ? "th" : "td";
               html_put_table_cell (html, pt, &cell, tag, body);
             }
index b0cf5cef9ef0c9e8cb9937662bae3c2d78255948..ee23b076ad8ca35e2d36645aef2ee46799867ebb 100644 (file)
@@ -495,7 +495,7 @@ write_table_layer (struct odt_driver *odt, const struct pivot_table *pt,
 
 
   /* Deal with row headers */
 
 
   /* Deal with row headers */
-  if (body->h[V][0] > 0)
+  if (body->h[V] > 0)
     xmlTextWriterStartElement (odt->content_wtr, _xml("table:table-header-rows"));
 
 
     xmlTextWriterStartElement (odt->content_wtr, _xml("table:table-header-rows"));
 
 
@@ -532,7 +532,7 @@ write_table_layer (struct odt_driver *odt, const struct pivot_table *pt,
 
               xmlTextWriterStartElement (odt->content_wtr, _xml("text:p"));
 
 
               xmlTextWriterStartElement (odt->content_wtr, _xml("text:p"));
 
-              if (r < body->h[V][0] || c < body->h[H][0])
+              if (r < body->h[V] || c < body->h[H])
                 xmlTextWriterWriteAttribute (odt->content_wtr, _xml("text:style-name"), _xml("Table_20_Heading"));
               else
                 xmlTextWriterWriteAttribute (odt->content_wtr, _xml("text:style-name"), _xml("Table_20_Contents"));
                 xmlTextWriterWriteAttribute (odt->content_wtr, _xml("text:style-name"), _xml("Table_20_Heading"));
               else
                 xmlTextWriterWriteAttribute (odt->content_wtr, _xml("text:style-name"), _xml("Table_20_Contents"));
@@ -551,7 +551,7 @@ write_table_layer (struct odt_driver *odt, const struct pivot_table *pt,
 
       xmlTextWriterEndElement (odt->content_wtr); /* row */
 
 
       xmlTextWriterEndElement (odt->content_wtr); /* row */
 
-      int ht = body->h[V][0];
+      int ht = body->h[V];
       if (ht > 0 && r == ht - 1)
        xmlTextWriterEndElement (odt->content_wtr); /* table-header-rows */
     }
       if (ht > 0 && r == ht - 1)
        xmlTextWriterEndElement (odt->content_wtr); /* table-header-rows */
     }
index 3666ffbcee00b0c88df8b1f8743cff77b094e1f0..6d5d8b015cdd1b2fcce5c47ac4a166491992fe74 100644 (file)
@@ -358,7 +358,7 @@ static struct table *
 create_aux_table (const struct pivot_table *pt, int nc, int nr,
                   int style_idx)
 {
 create_aux_table (const struct pivot_table *pt, int nc, int nr,
                   int style_idx)
 {
-  struct table *table = table_create (nc, nr, 0, 0, 0, 0);
+  struct table *table = table_create (nc, nr, 0, 0);
   table->styles[style_idx] = table_area_style_override (
       table->container, &pt->look->areas[style_idx], NULL, NULL, false);
   return table;
   table->styles[style_idx] = table_area_style_override (
       table->container, &pt->look->areas[style_idx], NULL, NULL, false);
   return table;
@@ -518,7 +518,7 @@ pivot_output (const struct pivot_table *pt,
   };
   struct table *body = table_create (data[H] + stub[H],
                                      data[V] + stub[V],
   };
   struct table *body = table_create (data[H] + stub[H],
                                      data[V] + stub[V],
-                                     stub[H], 0, stub[V], 0);
+                                     stub[H], stub[V]);
   for (size_t i = 0; i < PIVOT_N_AREAS; i++)
     body->styles[i] = table_area_style_override (
       body->container, &pt->look->areas[i], NULL, NULL, false);
   for (size_t i = 0; i < PIVOT_N_AREAS; i++)
     body->styles[i] = table_area_style_override (
       body->container, &pt->look->areas[i], NULL, NULL, false);
index dcb320a9d0cd5486016deb8d31270941aaab4341..fbf055029a6f2e24686c9c6b96aca52b0c0f5448 100644 (file)
@@ -58,16 +58,16 @@ struct render_page
 
     /* Region of 'table' to render.
 
 
     /* Region of 'table' to render.
 
-       The horizontal cells rendered are the leftmost h[H][0], then
-       r[H][0] through r[H][1], exclusive, then the rightmost h[H][1].
+       The horizontal cells rendered are the leftmost h[H], then
+       r[H] through r[H][1].
 
 
-       The vertical cells rendered are the topmost h[V][0], then r[V][0]
-       through r[V][1], exclusive, then the bottommost h[V][1].
+       The vertical cells rendered are the topmost h[V], then r[V][0]
+       through r[V][1].
 
 
-       n[H] = h[H][0] + (r[H][1] - r[H][0]) + h[H][1]
-       n[V] = h[V][0] + (r[V][1] - r[V][0]) + h[V][1]
+       n[H] = h[H] + (r[H][1] - r[H][0])
+       n[V] = h[V] + (r[V][1] - r[V][0])
     */
     */
-    int h[TABLE_N_AXES][2];
+    int h[TABLE_N_AXES];
     int r[TABLE_N_AXES][2];
     int n[TABLE_N_AXES];
 
     int r[TABLE_N_AXES][2];
     int n[TABLE_N_AXES];
 
@@ -129,20 +129,6 @@ struct render_page
        contain a node for each cell along that edge. */
     bool is_edge_cutoff[TABLE_N_AXES][2];
 
        contain a node for each cell along that edge. */
     bool is_edge_cutoff[TABLE_N_AXES][2];
 
-    /* If part of a joined cell would be cut off by breaking a table along
-       'axis' at the rule with offset 'z' (where 0 <= z <= n[axis]), then
-       join_crossing[axis][z] is the thickness of the rule that would be cut
-       off.
-
-       This is used to know to allocate extra space for breaking at such a
-       position, so that part of the cell's content is not lost.
-
-       This affects breaking a table only when headers are present.  When
-       headers are not present, the rule's thickness is used for cell content,
-       so no part of the cell's content is lost (and in fact it is duplicated
-       across both pages). */
-    int *join_crossing[TABLE_N_AXES];
-
     /* Minimum and maximum widths of columns based on headings.
 
        For this purpose, a table has the following three regions:
     /* Minimum and maximum widths of columns based on headings.
 
        For this purpose, a table has the following three regions:
@@ -230,12 +216,7 @@ table_width (const struct render_page *page, int axis)
 static int
 headers_width (const struct render_page *page, int axis)
 {
 static int
 headers_width (const struct render_page *page, int axis)
 {
-  int h0 = page->h[axis][0];
-  int w0 = axis_width (page, axis, rule_ofs (0), cell_ofs (h0));
-  int n = page->n[axis];
-  int h1 = page->h[axis][1];
-  int w1 = axis_width (page, axis, rule_ofs_r (page, axis, h1), cell_ofs (n));
-  return w0 + w1;
+  return axis_width (page, axis, rule_ofs (0), cell_ofs (page->h[axis]));
 }
 
 /* Returns the width of cell X along AXIS in PAGE. */
 }
 
 /* Returns the width of cell X along AXIS in PAGE. */
@@ -272,9 +253,8 @@ joined_width (const struct render_page *page, int axis, int x0, int x1)
 static int
 max_cell_width (const struct render_page *page, int axis)
 {
 static int
 max_cell_width (const struct render_page *page, int axis)
 {
-  int n = page->n[axis];
-  int x0 = page->h[axis][0];
-  int x1 = n - page->h[axis][1];
+  int x0 = page->h[axis];
+  int x1 = page->n[axis];
 
   int max = 0;
   for (int x = x0; x < x1; x++)
 
   int max = 0;
   for (int x = x0; x < x1; x++)
@@ -544,10 +524,7 @@ render_page_allocate__ (const struct render_params *params,
   page->n[V] = n[V];
 
   for (int i = 0; i < TABLE_N_AXES; i++)
   page->n[V] = n[V];
 
   for (int i = 0; i < TABLE_N_AXES; i++)
-    {
-      page->cp[i] = xcalloc ((2 * n[i] + 2) , sizeof *page->cp[i]);
-      page->join_crossing[i] = xcalloc ((n[i] + 1) , sizeof *page->join_crossing[i]);
-    }
+    page->cp[i] = xcalloc ((2 * n[i] + 2) , sizeof *page->cp[i]);
 
   hmap_init (&page->overflows);
   memset (page->is_edge_cutoff, 0, sizeof page->is_edge_cutoff);
 
   hmap_init (&page->overflows);
   memset (page->is_edge_cutoff, 0, sizeof page->is_edge_cutoff);
@@ -564,10 +541,9 @@ render_page_allocate (const struct render_params *params, struct table *table)
   struct render_page *page = render_page_allocate__ (params, table, table->n);
   for (enum table_axis a = 0; a < TABLE_N_AXES; a++)
     {
   struct render_page *page = render_page_allocate__ (params, table, table->n);
   for (enum table_axis a = 0; a < TABLE_N_AXES; a++)
     {
-      page->h[a][0] = table->h[a][0];
-      page->h[a][1] = table->h[a][1];
-      page->r[a][0] = table->h[a][0];
-      page->r[a][1] = table->n[a] - table->h[a][1];
+      page->h[a] = table->h[a];
+      page->r[a][0] = table->h[a];
+      page->r[a][1] = table->n[a];
     }
   return page;
 }
     }
   return page;
 }
@@ -630,14 +606,6 @@ create_page_with_interpolated_widths (const struct render_params *params,
   return page;
 }
 \f
   return page;
 }
 \f
-static void
-set_join_crossings (struct render_page *page, enum table_axis axis,
-                    const struct table_cell *cell, int *rules)
-{
-  for (int z = cell->d[axis][0] + 1; z <= cell->d[axis][1] - 1; z++)
-    page->join_crossing[axis][z] = rules[z];
-}
-
 /* Maps a contiguous range of cells from a page to the underlying table along
    the horizontal or vertical dimension. */
 struct map
 /* Maps a contiguous range of cells from a page to the underlying table along
    the horizontal or vertical dimension. */
 struct map
@@ -653,24 +621,19 @@ static void
 get_map (const struct render_page *page, enum table_axis a, int z,
          struct map *m)
 {
 get_map (const struct render_page *page, enum table_axis a, int z,
          struct map *m)
 {
-  if (z < page->h[a][0])
+  if (z < page->h[a])
     {
       m->p0 = 0;
       m->t0 = 0;
     {
       m->p0 = 0;
       m->t0 = 0;
-      m->n = page->h[a][0];
+      m->n = page->h[a];
     }
     }
-  else if (z < page->n[a] - page->h[a][1])
+  else
     {
     {
-      m->p0 = page->h[a][0];
+      assert (z < page->n[a]);
+      m->p0 = page->h[a];
       m->t0 = page->r[a][0];
       m->n = page->r[a][1] - page->r[a][0];
     }
       m->t0 = page->r[a][0];
       m->n = page->r[a][1] - page->r[a][0];
     }
-  else
-    {
-      m->p0 = page->n[a] - page->h[a][1];
-      m->t0 = page->table->n[a] - page->table->h[a][1];
-      m->n = page->h[a][1];
-    }
 }
 
 /* Initializes CELL with the contents of the table cell at column X and row Y
 }
 
 /* Initializes CELL with the contents of the table cell at column X and row Y
@@ -761,8 +724,8 @@ render_page_create (const struct render_params *params, struct table *table,
 
                 if (params->px_size)
                   {
 
                 if (params->px_size)
                   {
-                    const int *wr = (x < table->h[H][0] ? row_heading_width_range
-                                     : y < table->h[V][0] ? col_heading_width_range
+                    const int *wr = (x < table->h[H] ? row_heading_width_range
+                                     : y < table->h[V] ? col_heading_width_range
                                      : NULL);
                     if (wr)
                       {
                                      : NULL);
                     if (wr)
                       {
@@ -861,21 +824,13 @@ render_page_create (const struct render_params *params, struct table *table,
         struct table_cell cell;
 
         render_get_cell (page, x, y, &cell);
         struct table_cell cell;
 
         render_get_cell (page, x, y, &cell);
-        if (y == cell.d[V][0])
+        if (y == cell.d[V][0] && table_cell_rowspan (&cell) == 1)
           {
           {
-            if (table_cell_rowspan (&cell) == 1)
-              {
-                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);
-                if (h > r->unspanned)
-                  r->unspanned = r->width = h;
-              }
-            else
-              set_join_crossings (page, V, &cell, rules[V]);
-
-            if (table_cell_colspan (&cell) > 1)
-              set_join_crossings (page, H, &cell, rules[H]);
+            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);
+            if (h > r->unspanned)
+              r->unspanned = r->width = h;
           }
         x = cell.d[H][1];
       }
           }
         x = cell.d[H][1];
       }
@@ -912,7 +867,7 @@ render_page_create (const struct render_params *params, struct table *table,
       if (hw * 2 >= page->params->size[axis]
           || hw + max_cell_width (page, axis) > page->params->size[axis])
         {
       if (hw * 2 >= page->params->size[axis]
           || hw + max_cell_width (page, axis) > page->params->size[axis])
         {
-          page->h[axis][0] = page->h[axis][1] = 0;
+          page->h[axis] = 0;
           page->r[axis][0] = 0;
           page->r[axis][1] = page->n[axis];
         }
           page->r[axis][0] = 0;
           page->r[axis][1] = page->n[axis];
         }
@@ -949,10 +904,7 @@ render_page_unref (struct render_page *page)
       table_unref (page->table);
 
       for (int i = 0; i < TABLE_N_AXES; ++i)
       table_unref (page->table);
 
       for (int i = 0; i < TABLE_N_AXES; ++i)
-       {
-         free (page->join_crossing[i]);
-         free (page->cp[i]);
-       }
+        free (page->cp[i]);
 
       free (page);
     }
 
       free (page);
     }
@@ -994,19 +946,14 @@ get_rule (const struct render_page *page, enum table_axis axis,
   int d2 = -1;
 
   enum table_axis a = axis;
   int d2 = -1;
 
   enum table_axis a = axis;
-  if (d[a] < page->h[a][0])
+  if (d[a] < page->h[a])
     /* Nothing to do */;
     /* Nothing to do */;
-  else if (d[a] <= page->n[a] - page->h[a][1])
+  else if (d[a] <= page->n[a])
     {
     {
-      if (page->h[a][0] && d[a] == page->h[a][0])
-        d2 = page->h[a][0];
-      else if (page->h[a][1] && d[a] == page->n[a] - page->h[a][1])
-        d2 = page->table->n[a] - page->h[a][1];
-      d[a] += page->r[a][0] - page->h[a][0];
+      if (page->h[a] && d[a] == page->h[a])
+        d2 = page->h[a];
+      d[a] += page->r[a][0] - page->h[a];
     }
     }
-  else
-    d[a] += ((page->table->n[a] - page->table->h[a][1])
-             - (page->n[a] - page->h[a][1]));
 
   enum table_axis b = !axis;
   struct map m;
 
   enum table_axis b = !axis;
   struct map m;
@@ -1187,10 +1134,9 @@ render_cell (const struct render_page *page, const int ofs[TABLE_N_AXES],
       spill[axis][1] = rule_width (page, axis, cell->d[axis][1]) / 2;
     }
 
       spill[axis][1] = rule_width (page, axis, cell->d[axis][1]) / 2;
     }
 
-  int color_idx = (cell->d[V][0] < page->h[V][0]
-                   || page->n[V] - (cell->d[V][0] + 1) < page->h[V][1]
+  int color_idx = (cell->d[V][0] < page->h[V]
                    ? 0
                    ? 0
-                   : (cell->d[V][0] - page->h[V][0]) & 1);
+                   : (cell->d[V][0] - page->h[V]) & 1);
   page->params->ops->draw_cell (page->params->aux, cell, color_idx,
                                 bb, valign_offset, spill, clip);
 }
   page->params->ops->draw_cell (page->params->aux, cell, color_idx,
                                 bb, valign_offset, spill, clip);
 }
@@ -1330,7 +1276,7 @@ render_break_init (struct render_break *b, struct render_page *page,
 {
   b->page = page;
   b->axis = axis;
 {
   b->page = page;
   b->axis = axis;
-  b->z = page->h[axis][0];
+  b->z = page->h[axis];
   b->pixel = 0;
   b->hw = headers_width (page, axis);
 }
   b->pixel = 0;
   b->hw = headers_width (page, axis);
 }
@@ -1366,7 +1312,7 @@ render_break_has_next (const struct render_break *b)
   const struct render_page *page = b->page;
   enum table_axis axis = b->axis;
 
   const struct render_page *page = b->page;
   enum table_axis axis = b->axis;
 
-  return page != NULL && b->z < page->n[axis] - page->h[axis][1];
+  return page != NULL && b->z < page->n[axis];
 }
 
 /* Returns a new render_page that is up to SIZE pixels wide along B's axis.
 }
 
 /* Returns a new render_page that is up to SIZE pixels wide along B's axis.
@@ -1386,7 +1332,7 @@ render_break_next (struct render_break *b, int size)
 
   int pixel = 0;
   int z;
 
   int pixel = 0;
   int z;
-  for (z = b->z; z < page->n[axis] - page->h[axis][1]; z++)
+  for (z = b->z; z < page->n[axis]; z++)
     {
       int needed = needed_size (b, z + 1);
       if (needed > size)
     {
       int needed = needed_size (b, z + 1);
       if (needed > size)
@@ -1400,9 +1346,7 @@ render_break_next (struct render_break *b, int size)
                  cell.
 
                  This is similar to code for the left side in needed_size(). */
                  cell.
 
                  This is similar to code for the left side in needed_size(). */
-              int rule_allowance = (page->h[axis][1]
-                                    ? 0
-                                    : rule_width (page, axis, z));
+              int rule_allowance = rule_width (page, axis, z);
 
               /* The amount that, if we added cell 'z', the rendering would
                  overfill the allocated 'size'. */
 
               /* The amount that, if we added cell 'z', the rendering would
                  overfill the allocated 'size'. */
@@ -1487,7 +1431,7 @@ needed_size (const struct render_break *b, int cell)
   enum table_axis axis = b->axis;
 
   /* Width of left header not including its rightmost rule.  */
   enum table_axis axis = b->axis;
 
   /* Width of left header not including its rightmost rule.  */
-  int size = axis_width (page, axis, 0, rule_ofs (page->h[axis][0]));
+  int size = axis_width (page, axis, 0, rule_ofs (page->h[axis]));
 
   /* If we have a pixel offset and there is no left header, then we omit the
      leftmost rule of the body.  Otherwise the rendering is deceptive because
 
   /* If we have a pixel offset and there is no left header, then we omit the
      leftmost rule of the body.  Otherwise the rendering is deceptive because
@@ -1497,24 +1441,15 @@ needed_size (const struct render_break *b, int cell)
      rightmost rule in the header and the leftmost rule in the body.  We assume
      that the width of a merged rule is the larger of the widths of either rule
      invidiually. */
      rightmost rule in the header and the leftmost rule in the body.  We assume
      that the width of a merged rule is the larger of the widths of either rule
      invidiually. */
-  if (b->pixel == 0 || page->h[axis][0])
-    size += MAX (rule_width (page, axis, page->h[axis][0]),
+  if (b->pixel == 0 || page->h[axis])
+    size += MAX (rule_width (page, axis, page->h[axis]),
                  rule_width (page, axis, b->z));
 
   /* Width of body, minus any pixel offset in the leftmost cell. */
   size += joined_width (page, axis, b->z, cell) - b->pixel;
 
   /* Width of rightmost rule in body merged with leftmost rule in headers. */
                  rule_width (page, axis, b->z));
 
   /* Width of body, minus any pixel offset in the leftmost cell. */
   size += joined_width (page, axis, b->z, cell) - b->pixel;
 
   /* Width of rightmost rule in body merged with leftmost rule in headers. */
-  size += MAX (rule_width_r (page, axis, page->h[axis][1]),
-               rule_width (page, axis, cell));
-
-  /* Width of right header not including its leftmost rule. */
-  size += axis_width (page, axis, rule_ofs_r (page, axis, page->h[axis][1]),
-                      rule_ofs_r (page, axis, 0));
-
-  /* Join crossing. */
-  if (page->h[axis][0] && page->h[axis][1])
-    size += page->join_crossing[axis][b->z];
+  size += MAX (rule_width_r (page, axis, 0), rule_width (page, axis, cell));
 
   return size;
 }
 
   return size;
 }
@@ -1828,8 +1763,7 @@ render_page_select (const struct render_page *page, enum table_axis axis,
 
   /* Optimize case where all of PAGE is selected by just incrementing the
      reference count. */
 
   /* Optimize case where all of PAGE is selected by just incrementing the
      reference count. */
-  if (z0 == page->h[a][0] && p0 == 0
-      && z1 == page->n[a] - page->h[a][1] && p1 == 0)
+  if (z0 == page->h[a] && p0 == 0 && z1 == page->n[a] && p1 == 0)
     {
       struct render_page *page_rw = CONST_CAST (struct render_page *, page);
       page_rw->ref_cnt++;
     {
       struct render_page *page_rw = CONST_CAST (struct render_page *, page);
       page_rw->ref_cnt++;
@@ -1837,15 +1771,14 @@ render_page_select (const struct render_page *page, enum table_axis axis,
     }
 
   /* Allocate subpage. */
     }
 
   /* Allocate subpage. */
-  int trim[2] = { z0 - page->h[a][0], (page->n[a] - page->h[a][1]) - z1 };
+  int trim[2] = { z0 - page->h[a], page->n[a] - z1 };
   int n[TABLE_N_AXES] = { [H] = page->n[H], [V] = page->n[V] };
   n[a] -= trim[0] + trim[1];
   struct render_page *subpage = render_page_allocate__ (
     page->params, table_ref (page->table), n);
   for (enum table_axis k = 0; k < TABLE_N_AXES; k++)
     {
   int n[TABLE_N_AXES] = { [H] = page->n[H], [V] = page->n[V] };
   n[a] -= trim[0] + trim[1];
   struct render_page *subpage = render_page_allocate__ (
     page->params, table_ref (page->table), n);
   for (enum table_axis k = 0; k < TABLE_N_AXES; k++)
     {
-      subpage->h[k][0] = page->h[k][0];
-      subpage->h[k][1] = page->h[k][1];
+      subpage->h[k] = page->h[k];
       subpage->r[k][0] = page->r[k][0];
       subpage->r[k][1] = page->r[k][1];
     }
       subpage->r[k][0] = page->r[k][0];
       subpage->r[k][1] = page->r[k][1];
     }
@@ -1855,31 +1788,17 @@ render_page_select (const struct render_page *page, enum table_axis axis,
   /* An edge is cut off if it was cut off in PAGE or if we're trimming pixels
      off that side of the page and there are no headers. */
   subpage->is_edge_cutoff[a][0] =
   /* An edge is cut off if it was cut off in PAGE or if we're trimming pixels
      off that side of the page and there are no headers. */
   subpage->is_edge_cutoff[a][0] =
-    subpage->h[a][0] == 0 && (p0 || (z0 == 0 && page->is_edge_cutoff[a][0]));
+    subpage->h[a] == 0 && (p0 || (z0 == 0 && page->is_edge_cutoff[a][0]));
   subpage->is_edge_cutoff[a][1] =
   subpage->is_edge_cutoff[a][1] =
-    subpage->h[a][1] == 0 && (p1 || (z1 == page->n[a]
-                                     && page->is_edge_cutoff[a][1]));
+    p1 || (z1 == page->n[a] && page->is_edge_cutoff[a][1]);
   subpage->is_edge_cutoff[b][0] = page->is_edge_cutoff[b][0];
   subpage->is_edge_cutoff[b][1] = page->is_edge_cutoff[b][1];
 
   subpage->is_edge_cutoff[b][0] = page->is_edge_cutoff[b][0];
   subpage->is_edge_cutoff[b][1] = page->is_edge_cutoff[b][1];
 
-  /* Select join crossings from PAGE into subpage. */
-  int *jc = subpage->join_crossing[a];
-  for (int z = 0; z < page->h[a][0]; z++)
-    *jc++ = page->join_crossing[a][z];
-  for (int z = z0; z <= z1; z++)
-    *jc++ = page->join_crossing[a][z];
-  for (int z = page->n[a] - page->h[a][1]; z < page->n[a]; z++)
-    *jc++ = page->join_crossing[a][z];
-  assert (jc == &subpage->join_crossing[a][subpage->n[a] + 1]);
-
-  memcpy (subpage->join_crossing[b], page->join_crossing[b],
-          (subpage->n[b] + 1) * sizeof **subpage->join_crossing);
-
   /* Select widths from PAGE into subpage. */
   int *scp = page->cp[a];
   int *dcp = subpage->cp[a];
   *dcp = 0;
   /* Select widths from PAGE into subpage. */
   int *scp = page->cp[a];
   int *dcp = subpage->cp[a];
   *dcp = 0;
-  for (int z = 0; z <= rule_ofs (subpage->h[a][0]); z++, dcp++)
+  for (int z = 0; z <= rule_ofs (subpage->h[a]); z++, dcp++)
     {
       int w = !z && subpage->is_edge_cutoff[a][0] ? 0 : scp[z + 1] - scp[z];
       dcp[1] = dcp[0] + w;
     {
       int w = !z && subpage->is_edge_cutoff[a][0] ? 0 : scp[z + 1] - scp[z];
       dcp[1] = dcp[0] + w;
@@ -1888,15 +1807,11 @@ render_page_select (const struct render_page *page, enum table_axis axis,
     {
       dcp[1] = dcp[0] + (scp[z + 1] - scp[z]);
       if (z == cell_ofs (z0))
     {
       dcp[1] = dcp[0] + (scp[z + 1] - scp[z]);
       if (z == cell_ofs (z0))
-        {
-          dcp[1] -= p0;
-          if (page->h[a][0] && page->h[a][1])
-            dcp[1] += page->join_crossing[a][z / 2];
-        }
+        dcp[1] -= p0;
       if (z == cell_ofs (z1 - 1))
         dcp[1] -= p1;
     }
       if (z == cell_ofs (z1 - 1))
         dcp[1] -= p1;
     }
-  for (int z = rule_ofs_r (page, a, subpage->h[a][1]);
+  for (int z = rule_ofs_r (page, a, 0);
        z <= rule_ofs_r (page, a, 0); z++, dcp++)
     {
       if (z == rule_ofs_r (page, a, 0) && subpage->is_edge_cutoff[a][1])
        z <= rule_ofs_r (page, a, 0); z++, dcp++)
     {
       if (z == rule_ofs_r (page, a, 0) && subpage->is_edge_cutoff[a][1])
@@ -1921,7 +1836,7 @@ render_page_select (const struct render_page *page, enum table_axis axis,
     .subpage = subpage,
   };
 
     .subpage = subpage,
   };
 
-  if (!page->h[a][0] || z0 > page->h[a][0] || p0)
+  if (!page->h[a] || z0 > page->h[a] || p0)
     for (int z = 0; z < page->n[b];)
       {
         int d[TABLE_N_AXES];
     for (int z = 0; z < page->n[b];)
       {
         int d[TABLE_N_AXES];
@@ -1937,43 +1852,33 @@ render_page_select (const struct render_page *page, enum table_axis axis,
             struct render_overflow *ro = insert_overflow (&s, &cell);
 
             if (overflow0)
             struct render_overflow *ro = insert_overflow (&s, &cell);
 
             if (overflow0)
-              {
-                ro->overflow[a][0] += p0 + axis_width (
-                  page, a, cell_ofs (cell.d[a][0]), cell_ofs (z0));
-                if (page->h[a][0] && page->h[a][1])
-                  ro->overflow[a][0] -= page->join_crossing[a][cell.d[a][0]
-                                                               + 1];
-              }
+              ro->overflow[a][0] += p0 + axis_width (
+                page, a, cell_ofs (cell.d[a][0]), cell_ofs (z0));
 
             if (overflow1)
 
             if (overflow1)
-              {
-                ro->overflow[a][1] += p1 + axis_width (
-                  page, a, cell_ofs (z1), cell_ofs (cell.d[a][1]));
-                if (page->h[a][0] && page->h[a][1])
-                  ro->overflow[a][1] -= page->join_crossing[a][cell.d[a][1]];
-              }
+              ro->overflow[a][1] += p1 + axis_width (
+                page, a, cell_ofs (z1), cell_ofs (cell.d[a][1]));
           }
         z = cell.d[b][1];
       }
 
           }
         z = cell.d[b][1];
       }
 
-  if (!page->h[a][1] || z1 < page->n[a] - page->h[a][1] || p1)
-    for (int z = 0; z < page->n[b];)
-      {
-        int d[TABLE_N_AXES];
-        d[a] = z1 - 1;
-        d[b] = z;
+  for (int z = 0; z < page->n[b];)
+    {
+      int d[TABLE_N_AXES];
+      d[a] = z1 - 1;
+      d[b] = z;
 
 
-        struct table_cell cell;
-        render_get_cell (page, d[H], d[V], &cell);
-        if ((cell.d[a][1] > z1 || (cell.d[a][1] == z1 && p1))
-            && find_overflow_for_cell (&s, &cell) == NULL)
-          {
-            struct render_overflow *ro = insert_overflow (&s, &cell);
-            ro->overflow[a][1] += p1 + axis_width (page, a, cell_ofs (z1),
-                                                   cell_ofs (cell.d[a][1]));
-          }
-        z = cell.d[b][1];
-      }
+      struct table_cell cell;
+      render_get_cell (page, d[H], d[V], &cell);
+      if ((cell.d[a][1] > z1 || (cell.d[a][1] == z1 && p1))
+          && find_overflow_for_cell (&s, &cell) == NULL)
+        {
+          struct render_overflow *ro = insert_overflow (&s, &cell);
+          ro->overflow[a][1] += p1 + axis_width (page, a, cell_ofs (z1),
+                                                 cell_ofs (cell.d[a][1]));
+        }
+      z = cell.d[b][1];
+    }
 
   /* Copy overflows from PAGE into subpage. */
   struct render_overflow *ro;
 
   /* Copy overflows from PAGE into subpage. */
   struct render_overflow *ro;
@@ -2001,7 +1906,7 @@ cell_to_subpage (struct render_page_selection *s,
 {
   enum table_axis a = s->a;
   enum table_axis b = s->b;
 {
   enum table_axis a = s->a;
   enum table_axis b = s->b;
-  int ha0 = s->subpage->h[a][0];
+  int ha0 = s->subpage->h[a];
 
   subcell[a] = MAX (cell->d[a][0] - s->z0 + ha0, ha0);
   subcell[b] = cell->d[b][0];
 
   subcell[a] = MAX (cell->d[a][0] - s->z0 + ha0, ha0);
   subcell[b] = cell->d[b][0];
index 97a2793c55ea728c2cbe72cb6705469c8cf34f1c..3d07eb40d47563b27c059ee36d0473ce94d85c47 100644 (file)
@@ -249,20 +249,20 @@ cell_style_dump (const struct cell_style *c)
    header rows or columns.
 
    Sets the number of header rows on each side of TABLE to HL on the
    header rows or columns.
 
    Sets the number of header rows on each side of TABLE to HL on the
-   left, HR on the right, HT on the top, HB on the bottom.  Header rows
+   left, HT on the top.  Header rows
    are repeated when a table is broken across multiple columns or
    multiple pages.
 
    The table's cells are initially empty. */
 struct table *
    are repeated when a table is broken across multiple columns or
    multiple pages.
 
    The table's cells are initially empty. */
 struct table *
-table_create (int nc, int nr, int hl, int hr, int ht, int hb)
+table_create (int nc, int nr, int hl, int ht)
 {
   struct pool *pool = pool_create ();
   struct table *t = pool_alloc (pool, sizeof *t);
   *t = (struct table) {
     .container = pool,
     .n = { [H] = nc, [V] = nr },
 {
   struct pool *pool = pool_create ();
   struct table *t = pool_alloc (pool, sizeof *t);
   *t = (struct table) {
     .container = pool,
     .n = { [H] = nc, [V] = nr },
-    .h = { [H] = { hl, hr }, [V] = { ht, hb } },
+    .h = { [H] = hl, [V] = ht },
     .ref_cnt = 1,
     .cc = pool_calloc (pool, nr * nc, sizeof *t->cc),
     .cp = pool_calloc (pool, nr * nc, sizeof *t->cp),
     .ref_cnt = 1,
     .cc = pool_calloc (pool, nr * nc, sizeof *t->cc),
     .cp = pool_calloc (pool, nr * nc, sizeof *t->cp),
index 1fe78d8e767ab2e69bd636a643cfb3737d76b439..42bdf299e73605efe37d4f8a253ee4839db8ebb4 100644 (file)
@@ -205,11 +205,9 @@ struct table
        broken across more than one page for output, headers rows and columns
        are repeated on each page.
 
        broken across more than one page for output, headers rows and columns
        are repeated on each page.
 
-       h[TABLE_HORZ][0]: Left header columns.
-       h[TABLE_HORZ][1]: Right header columns.
-       h[TABLE_VERT][0]: Top header rows.
-       h[TABLE_VERT][1]: Bottom header rows. */
-    int h[TABLE_N_AXES][2];
+       h[TABLE_HORZ]: Left header columns.
+       h[TABLE_VERT]: Top header rows. */
+    int h[TABLE_N_AXES];
 
     /* Reference count.  A table may be shared between multiple owners,
        indicated by a reference count greater than 1.  When this is the case,
 
     /* Reference count.  A table may be shared between multiple owners,
        indicated by a reference count greater than 1.  When this is the case,
@@ -239,7 +237,7 @@ void table_unref (struct table *);
 bool table_is_shared (const struct table *);
 
 /* Tables. */
 bool table_is_shared (const struct table *);
 
 /* Tables. */
-struct table *table_create (int nc, int nr, int hl, int hr, int ht, int hb);
+struct table *table_create (int nc, int nr, int hl, int ht);
 
 /* Rules. */
 void table_hline (struct table *, int style, int x1, int x2, int y);
 
 /* Rules. */
 void table_hline (struct table *, int style, int x1, int x2, int y);
index 8a88452ec8a22760c146edd8f4c27e800d54a85b..c6227296b1a91cfd7745fb32cf677717e196c0b4 100644 (file)
@@ -498,7 +498,7 @@ tex_output_table_layer (struct tex_driver *tex, const struct pivot_table *pt,
   for (int y = 0; y < body->n[V]; y++)
     {
       enum { H = TABLE_HORZ, V = TABLE_VERT };
   for (int y = 0; y < body->n[V]; y++)
     {
       enum { H = TABLE_HORZ, V = TABLE_VERT };
-      bool is_column_header = y < body->h[V][0] || y >= body->n[V] - body->h[V][1];
+      bool is_column_header = y < body->h[V] || y >= body->n[V];
       int prev_x = -1;
       int skipped = 0;
       for (int x = 0; x < body->n[H];)
       int prev_x = -1;
       int skipped = 0;
       for (int x = 0; x < body->n[H];)