- /* Use GTK+ default font as proportional font. */
- PangoFontDescription *font_desc;
- gtk_style_context_get (context, state, "font", &font_desc, NULL);
- char *font_name = pango_font_description_to_string (font_desc);
- string_map_insert (options, "prop-font", font_name);
- g_free (font_name);
-
- /* Derived emphasized font from proportional font. */
- pango_font_description_set_style (font_desc, PANGO_STYLE_ITALIC);
- font_name = pango_font_description_to_string (font_desc);
- string_map_insert (options, "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_nocopy (options, xstrdup ("paper-size"),
- xasprintf ("%dx1000000pt", view->render_width));
- string_map_insert (options, "left-margin", "0");
- string_map_insert (options, "right-margin", "0");
- string_map_insert (options, "top-margin", "0");
- string_map_insert (options, "bottom-margin", "0");
-}
-
-static void
-create_xr (struct psppire_output_view *view)
-{
- get_xr_options (view, &view->render_opts);
-
- struct string_map options;
- string_map_clone (&options, &view->render_opts);
- cairo_t *cr = gdk_cairo_create (
- gtk_widget_get_window (GTK_WIDGET (view->output)));
- view->xr = xr_driver_create (cr, &options);
- string_map_destroy (&options);
-
- struct text_item *text_item = text_item_create (TEXT_ITEM_LOG, "X");
- struct xr_rendering *r = xr_rendering_create (
- view->xr, text_item_super (text_item), cr);
- xr_rendering_measure (r, NULL, &view->font_height);
- text_item_unref (text_item);
+ int xr_width = view->render_width * 1000;
+
+ PangoFontDescription *pf;
+ gtk_style_context_get (context, state, "font", &pf, NULL);
+ PangoFontDescription *ff = pango_font_description_from_string ("Monospace");
+ pango_font_description_set_size (ff, pango_font_description_get_size (pf));
+
+ struct xr_fsm_style *style = xmalloc (sizeof *style);
+ *style = (struct xr_fsm_style) {
+ .ref_cnt = 1,
+ .size = { [TABLE_HORZ] = xr_width, [TABLE_VERT] = INT_MAX },
+ .min_break = { [TABLE_HORZ] = xr_width / 2, [TABLE_VERT] = 0 },
+ .fonts = {
+ [XR_FONT_PROPORTIONAL] = pf,
+ [XR_FONT_FIXED] = ff,
+ },
+ .use_system_colors = true,
+ .transparent = true,
+ .font_resolution = 96.0,
+ };