output-item: Add 'name' member to class structure.
[pspp] / src / output / text-item.c
index 9c3645bd3e9966408de6e419e148c1a5bbd4fc8a..2aba955eb33e240cecc377d3cdea90a40928546e 100644 (file)
@@ -99,34 +99,40 @@ text_item_to_table_item (struct text_item *text_item)
 {
   struct tab_table *tab = tab_create (1, 1);
 
-  struct cell_style *style = pool_alloc (tab->container, sizeof *style);
-  *style = (struct cell_style) CELL_STYLE_INITIALIZER;
-  if (text_item->font)
-    style->font = pool_strdup (tab->container, text_item->font);
-  style->font_size = text_item->font_size;
-  style->bold = text_item->bold;
-  style->italic = text_item->italic;
-  style->underline = text_item->underline;
+  struct area_style *style = pool_alloc (tab->container, sizeof *style);
+  *style = (struct area_style) AREA_STYLE_INITIALIZER;
+  struct font_style *font_style = &style->font_style;
+  if (text_item->typeface)
+    font_style->typeface = pool_strdup (tab->container, text_item->typeface);
+  font_style->size = text_item->size;
+  font_style->bold = text_item->bold;
+  font_style->italic = text_item->italic;
+  font_style->underline = text_item->underline;
+  font_style->markup = text_item->markup;
   tab->styles[0] = style;
 
   int opts = TAB_LEFT;
   if (text_item->markup)
     opts |= TAB_MARKUP;
+  if (text_item->type == TEXT_ITEM_SYNTAX || text_item->type == TEXT_ITEM_LOG)
+    opts |= TAB_FIX;
   tab_text (tab, 0, 0, opts, text_item_get_text (text_item));
   struct table_item *table_item = table_item_create (&tab->table, NULL, NULL);
   text_item_unref (text_item);
   return table_item;
-}\f
+}
+\f
 static void
 text_item_destroy (struct output_item *output_item)
 {
   struct text_item *item = to_text_item (output_item);
   free (item->text);
-  free (item->font);
+  free (item->typeface);
   free (item);
 }
 
 const struct output_item_class text_item_class =
   {
+    "text",
     text_item_destroy,
   };