- struct tab_joined_cell *j
- = (struct tab_joined_cell *) ss_data (*content);
-
- if (j->x1 == col && j->y1 == row)
- {
- struct outp_text text;
- text.font = options_to_font (type);
- text.justification = translate_justification (type);
- text.string = j->contents;
- text.x = x;
- text.y = y;
- text.h = strip_width (r, j->x1, MIN (j->x2, c1));
- text.v = strip_height (r, j->y1, MIN (j->y2, r1));
- r->driver->class->text_draw (r->driver, &text);
- }
- }
-}
-
-/* Render contiguous strip consisting of columns C0...C1, exclusive,
- on row ROW, at (X,Y). Returns X position after rendering.
- Also renders joined cells that extend beyond that strip,
- cropping them to lie within rendering region (C0,R0)-(C1,R1).
- C0 and C1 count vertical rules as columns.
- ROW counts horizontal rules as rows, but R0 and R1 do not. */
-static int
-render_strip (const struct tab_rendering *r,
- int x, int y, int row, int c0, int c1, int r0 UNUSED, int r1)
-{
- int col;
-
- for (col = c0; col < c1; col++)
- if (col & 1)
- {
- if (row & 1)
- render_cell (r, x, y, col / 2, row / 2, c1 / 2, r1);
- else
- render_horz_rule (r, x, y, col / 2, row / 2);
- x += r->w[col / 2];
- }
- else
- {
- if (row & 1)
- render_vert_rule (r, x, y, col / 2, row / 2);
- else
- render_rule_intersection (r, x, y, col / 2, row / 2);
- x += r->wrv[col / 2];
- }
-
- return x;
-}
-
-/* Sets COMMAND_NAME as the name of the current command,
- for embedding in output. */
-void
-tab_set_command_name (const char *command_name_)
-{
- free (command_name);
- command_name = command_name_ ? xstrdup (command_name_) : NULL;
+ const struct pivot_value *v = cc ? cc : &empty_value;
+ const struct pivot_value_ex *ex = pivot_value_ex (v);
+ *cell = (struct table_cell) {
+ .d = { [H] = { x, x + 1 }, [V] = { y, y + 1 } },
+ .options = opt,
+ .value = v,
+ .font_style = ex->font_style ? ex->font_style : &style->font_style,
+ .cell_style = ex->cell_style ? ex->cell_style : &style->cell_style,
+ };
+ }
+
+ assert (cell->font_style);
+ assert (cell->cell_style);
+}
+
+/* Returns one of the TABLE_STROKE_* enumeration constants (declared in
+ output/table.h) representing a rule running alongside one of the cells in
+ TABLE.
+
+ Suppose NC is the number of columns in TABLE and NR is the number of rows.
+ Then, if AXIS is TABLE_HORZ, then 0 <= X <= NC and 0 <= Y < NR. If (X,Y) =
+ (0,0), the return value is the rule that runs vertically on the left side of
+ cell (0,0); if (X,Y) = (1,0), it is the vertical rule between that cell and
+ cell (1,0); and so on, up to (NC,0), which runs vertically on the right of
+ cell (NC-1,0).
+
+ The following diagram illustrates the meaning of (X,Y) for AXIS = TABLE_HORZ
+ within a 7x7 table. The '|' characters at the intersection of the X labels
+ and Y labels show the rule whose style would be returned by calling
+ table_get_rule with those X and Y values:
+
+ 0 1 2 3 4 5 6 7
+ +--+--+--+--+--+--+--+
+ 0 | | | | | | | |
+ +--+--+--+--+--+--+--+
+ 1 | | | | | | | |
+ +--+--+--+--+--+--+--+
+ 2 | | | | | | | |
+ +--+--+--+--+--+--+--+
+ 3 | | | | | | | |
+ +--+--+--+--+--+--+--+
+ 4 | | | | | | | |
+ +--+--+--+--+--+--+--+
+ 5 | | | | | | | |
+ +--+--+--+--+--+--+--+
+ 6 | | | | | | | |
+ +--+--+--+--+--+--+--+
+
+ Similarly, if AXIS is TABLE_VERT, then 0 <= X < NC and 0 <= Y <= NR. If
+ (X,Y) = (0,0), the return value is the rule that runs horizontally above
+ the top of cell (0,0); if (X,Y) = (0,1), it is the horizontal rule
+ between that cell and cell (0,1); and so on, up to (0,NR), which runs
+ horizontally below cell (0,NR-1). */
+struct table_border_style
+table_get_rule (const struct table *table, enum table_axis axis, int x, int y)
+{
+ assert (x >= 0 && x < table->n[TABLE_HORZ] + (axis == TABLE_HORZ));
+ assert (y >= 0 && y < table->n[TABLE_VERT] + (axis == TABLE_VERT));
+
+ size_t border_idx = (axis == TABLE_VERT
+ ? table->rh[x + table->n[H] * y]
+ : table->rv[x + (table->n[H] + 1) * y]);
+ return (border_idx < table->n_borders
+ ? table->borders[border_idx]
+ : (struct table_border_style) { TABLE_STROKE_NONE,
+ CELL_COLOR_BLACK });