-/* Writes STRING at location (X,Y) trimmed to the given MAX_WIDTH
- and with the given cell OPTIONS for XR. */
-static int
-draw_text (struct xr_driver *xr, const char *string, int x, int y,
- int max_width, unsigned int options)
-{
- struct table_cell cell;
- int bb[TABLE_N_AXES][2];
- int w, h;
-
- cell.contents = string;
- cell.options = options;
- bb[H][0] = x;
- bb[V][0] = y - xr->y;
- bb[H][1] = x + max_width;
- bb[V][1] = xr->font_height - xr->y;
- xr_layout_cell (xr, &cell, bb, bb, PANGO_WRAP_WORD_CHAR, &w, &h);
- return w;
-}
-
-/* Writes LEFT left-justified and RIGHT right-justified within
- (X0...X1) at Y. LEFT or RIGHT or both may be null. */
-static void
-draw_header_line (struct xr_driver *xr, const char *left, const char *right,
- int x0, int x1, int y)
-{
- int right_width = 0;
- if (right != NULL)
- right_width = (draw_text (xr, right, x0, y, x1 - x0, TAB_RIGHT)
- + xr->font_height / 2);
- if (left != NULL)
- draw_text (xr, left, x0, y, x1 - x0 - right_width, TAB_LEFT);
-}
-
-/* Draw top of page headers for XR. */
-static void
-draw_headers (struct xr_driver *xr)
-{
- char *r1, *r2;
- int x0, x1;
- int y;
-
- if (!xr->headers || xr->cairo == NULL)
- return;
-
- y = -3 * xr->font_height;
- x0 = xr->font_height / 2;
- x1 = xr->width - xr->font_height / 2;
-
- /* Draw box. */
- cairo_rectangle (xr->cairo, 0, xr_to_pt (y), xr_to_pt (xr->width),
- xr_to_pt (2 * (xr->font_height
- + xr->line_width + xr->line_gutter)));
- cairo_save (xr->cairo);
- cairo_set_source_rgb (xr->cairo, 0.9, 0.9, 0.9);
- cairo_fill_preserve (xr->cairo);
- cairo_restore (xr->cairo);
- cairo_stroke (xr->cairo);
-
- y += xr->line_width + xr->line_gutter;
-
- r1 = xasprintf (_("%s - Page %d"), get_start_date (), xr->page_number);
- r2 = xasprintf ("%s - %s", version, host_system);
-
- draw_header_line (xr, xr->title, r1, x0, x1, y);
- y += xr->font_height;
-
- draw_header_line (xr, xr->subtitle, r2, x0, x1, y);
-
- free (r1);
- free (r2);
-}
-\f