- cr = gdk_cairo_create (GTK_WIDGET (view->output)->window);
- if (view->xr == NULL)
- {
- const GtkStyle *style = gtk_widget_get_style (GTK_WIDGET (view->output));
- struct text_item *text_item;
- PangoFontDescription *font_desc;
- char *font_name;
- int font_width;
-
- /* Set the widget's text color as the foreground color for the output driver */
- gchar *fgc = gdk_color_to_string (&style->text[gtk_widget_get_state (GTK_WIDGET (view->output))]);
-
- string_map_insert (&view->render_opts, "foreground-color", fgc);
- g_free (fgc);
-
- /* Use GTK+ default font as proportional font. */
- font_name = pango_font_description_to_string (style->font_desc);
- string_map_insert (&view->render_opts, "prop-font", font_name);
- g_free (font_name);
-
- /* Derived emphasized font from proportional font. */
- font_desc = pango_font_description_copy (style->font_desc);
- pango_font_description_set_style (font_desc, PANGO_STYLE_ITALIC);
- font_name = pango_font_description_to_string (font_desc);
- string_map_insert (&view->render_opts, "emph-font", font_name);
- g_free (font_name);
- pango_font_description_free (font_desc);
-
- /* Pretend that the "page" has a reasonable width and a very big length,
- so that most tables can be conveniently viewed on-screen with vertical
- scrolling only. (The length should not be increased very much because
- it is already close enough to INT_MAX when expressed as thousands of a
- point.) */
- string_map_insert (&view->render_opts, "paper-size", "300x200000mm");
- string_map_insert (&view->render_opts, "left-margin", "0");
- string_map_insert (&view->render_opts, "right-margin", "0");
- string_map_insert (&view->render_opts, "top-margin", "0");
- string_map_insert (&view->render_opts, "bottom-margin", "0");
-
- view->xr = xr_driver_create (cr, &view->render_opts);
-
- text_item = text_item_create (TEXT_ITEM_PARAGRAPH, "X");
- r = xr_rendering_create (view->xr, text_item_super (text_item), cr);
- xr_rendering_measure (r, &font_width, &view->font_height);
- /* xr_rendering_destroy (r); */
- text_item_unref (text_item);
- }
-
- if (view->y > 0)
- view->y += view->font_height / 2;