- const char *tag;
-
- table_get_cell (t, x, y, &cell);
- if (x != cell.d[TABLE_HORZ][0] || y != cell.d[TABLE_VERT][0])
- goto next_1;
-
- /* output <td> or <th> tag. */
- bool is_header = (y < t->h[V][0]
- || y >= t->n[V] - t->h[V][1]
- || x < t->h[H][0]
- || x >= t->n[H] - t->h[H][1]);
- tag = is_header ? "th" : "td";
- fprintf (html->file, "<%s", tag);
-
- struct css_style style;
- style_start (&style, html->file);
- enum table_halign halign = table_halign_interpret (
- cell.style->cell_style.halign, cell.options & TAB_NUMERIC);
-
- switch (halign)
- {
- case TABLE_HALIGN_RIGHT:
- put_style (&style, "text-align", "right");
- break;
- case TABLE_HALIGN_CENTER:
- put_style (&style, "text-align", "center");
- break;
- default:
- /* Do nothing */
- break;
- }
-
- if (cell.options & TAB_ROTATE)
- put_style (&style, "writing-mode", "sideways-lr");
-
- if (cell.style->cell_style.valign != TABLE_VALIGN_TOP)
- {
- put_style (&style, "vertical-align",
- (cell.style->cell_style.valign == TABLE_VALIGN_BOTTOM
- ? "bottom" : "middle"));
- }
-
- const struct font_style *fs = &cell.style->font_style;
- char bgcolor[32];
- if (format_color (fs->bg[y % 2],
- (struct cell_color) CELL_COLOR_WHITE,
- bgcolor, sizeof bgcolor))
- put_style (&style, "background", bgcolor);
-
- char fgcolor[32];
- if (format_color (fs->fg[y % 2],
- (struct cell_color) CELL_COLOR_BLACK,
- fgcolor, sizeof fgcolor))
- put_style (&style, "color", fgcolor);
-
- if (fs->typeface)
- {
- put_style (&style, "font-family", "\"");
- escape_string (html->file, fs->typeface, " ", "\n");
- putc ('"', html->file);
- }
- if (fs->bold)
- put_style (&style, "font-weight", "bold");
- if (fs->italic)
- put_style (&style, "font-style", "italic");
- if (fs->underline)
- put_style (&style, "text-decoration", "underline");
- if (fs->size)