printing works; font sizes are weird
[pspp] / src / output / cairo-fsm.c
index 5d1b63e4f1937780333bbcae6e9e1a538d2e115e..54b65dd9c02d20ce66d6c59b455856274721a33c 100644 (file)
@@ -52,7 +52,7 @@
 /* This file uses TABLE_HORZ and TABLE_VERT enough to warrant abbreviating. */
 #define H TABLE_HORZ
 #define V TABLE_VERT
-
+\f
 struct xr_fsm_style *
 xr_fsm_style_ref (const struct xr_fsm_style *style_)
 {
@@ -63,6 +63,24 @@ xr_fsm_style_ref (const struct xr_fsm_style *style_)
   return style;
 }
 
+struct xr_fsm_style *
+xr_fsm_style_unshare (struct xr_fsm_style *old)
+{
+  assert (old->ref_cnt > 0);
+  if (old->ref_cnt == 1)
+    return old;
+
+  xr_fsm_style_unref (old);
+
+  struct xr_fsm_style *new = xmemdup (old, sizeof *old);
+  new->ref_cnt = 1;
+  for (int i = 0; i < XR_N_FONTS; i++)
+    if (old->fonts[i])
+      new->fonts[i] = pango_font_description_copy (old->fonts[i]);
+
+  return new;
+}
+
 void
 xr_fsm_style_unref (struct xr_fsm_style *style)
 {
@@ -608,7 +626,7 @@ xr_layout_cell_text (struct xr_fsm *xr, const struct table_cell *cell,
   if (font_style->typeface)
       desc = parse_font (
         font_style->typeface,
-        font_style->size ? font_style->size * 1000 * xr->style->font_scale : 10000,
+        (font_style->size ? font_style->size * 1000 : 10000) * xr->style->font_scale,
         font_style->bold, font_style->italic);
   if (!desc)
     desc = xr->style->fonts[font_type];
@@ -1094,7 +1112,6 @@ xr_fsm_create (const struct output_item *item_,
       .ops = &xrr_render_ops,
       .aux = fsm,
       .size = { [H] = style->size[H], [V] = style->size[V] },
-      /* XXX font_size */
       .line_widths = xr_line_widths,
       .min_break = { [H] = style->min_break[H], [V] = style->min_break[V] },
       .supports_margins = true,