-static void
-xr_init_caption_cell (const char *caption, struct table_cell *cell,
- struct cell_contents *contents)
-{
- contents->options = TAB_LEFT;
- contents->text = CONST_CAST (char *, caption);
- contents->table = NULL;
- cell->contents = contents;
- cell->n_contents = 1;
- cell->destructor = NULL;
-}
-
-static struct render_pager *
-xr_render_table_item (struct xr_driver *xr, const struct table_item *item,
- int *caption_widthp, int *caption_heightp)
-{
- const char *caption = table_item_get_caption (item);
-
- if (caption != NULL)
- {
- /* XXX doesn't do well with very large captions */
- struct cell_contents contents;
- int min_width, max_width;
- struct table_cell cell;
-
- xr_init_caption_cell (caption, &cell, &contents);
-
- xr_measure_cell_width (xr, &cell, &min_width, &max_width);
- *caption_widthp = MIN (max_width, xr->width);
- *caption_heightp = xr_measure_cell_height (xr, &cell, *caption_widthp);
- }
- else
- *caption_heightp = 0;
-
- return render_pager_create (xr->params, item);
-}
-