return page->cp[axis][page->n[axis] * 2 + 1];
}
+/* If PAGE is smaller than SIZE along AXIS, inserts extra space to increase
+ its size to SIZE. */
+void
+render_page_stretch (struct render_page *page, enum table_axis axis,
+ int size)
+{
+ int extra = size - render_page_get_size (page, axis);
+ if (extra > 0)
+ {
+ int n = page->n[axis];
+ int error = 0;
+ int adjust = 0;
+ int i;
+
+ for (i = 2; i <= 2 * n + 1; i++)
+ {
+ if (!(i & 1))
+ {
+ error += extra;
+ adjust += error / n;
+ error %= n;
+ }
+ page->cp[axis][i] += adjust;
+ }
+ }
+}
+
int
render_page_get_best_breakpoint (const struct render_page *page, int height)
{
struct render_break y_break;
};
-static const struct render_page *
+static struct render_page *
render_pager_add_table (struct render_pager *p, struct table *table)
{
struct render_page *page;
const char *caption = table_item_get_caption (table_item);
const char *title = table_item_get_title (table_item);
const struct render_page *body_page;
+ struct render_page *title_page;
struct render_pager *p;
p = xzalloc (sizeof *p);
p->params = params;
/* Title. */
- if (title)
- render_pager_add_table (p, table_from_string (TAB_LEFT, title));
+ title_page = (title
+ ? render_pager_add_table (
+ p, table_from_string (TAB_CENTER | TAB_EMPH, title))
+ : NULL);
/* Body. */
body_page = render_pager_add_table (p, table_ref (table_item_get_table (
table_item)));
+ if (title_page && body_page)
+ {
+ int body_page_size = render_page_get_size (body_page, H);
+ render_page_stretch (title_page, H,
+ MIN (body_page_size, params->size[H]));
+ }
/* Caption. */
if (caption)