struct table_item *
text_item_to_table_item (struct text_item *text_item)
{
- struct tab_table *tab = tab_create (1, 1);
+ struct pivot_value *text = pivot_value_new_user_text (
+ text_item_get_text (text_item), -1);
- 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;
+ struct font_style *font_style = xmalloc (sizeof *font_style);
if (text_item->typeface)
- font_style->typeface = pool_strdup (tab->container, text_item->typeface);
+ font_style->typeface = xstrdup (tab->container, text_item->typeface);
+ else if (text_item->type == TEXT_ITEM_SYNTAX
+ || text_item->type == TEXT_ITEM_LOG)
+ font_style->typeface = xstrdup ("Monospace");
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->font_style = font_style;
+
+ struct table_item *table_item = table_item_create (
+ pivot_table_create_for_text (NULL, text));
text_item_unref (text_item);
return table_item;
}