tab: Fix overlap between table enumerations.
authorBen Pfaff <blp@cs.stanford.edu>
Wed, 25 Dec 2019 21:28:32 +0000 (21:28 +0000)
committerBen Pfaff <blp@cs.stanford.edu>
Sun, 29 Dec 2019 05:28:10 +0000 (05:28 +0000)
These enumerations overlapped with TAB_STYLE_MASK.

src/output/tab.h
src/output/text-item.c

index f81a010c65c718a6988d1438f2a7b2c99c3f65ef..5b9f5d1fc5d64da9f9cb4f9ce5fd80c24afe624b 100644 (file)
 enum
   {
     /* Horizontal alignment of cell contents. */
-    TAB_RIGHT      = 0 << (TAB_FIRST_AVAILABLE + 2),
-    TAB_LEFT       = 1 << (TAB_FIRST_AVAILABLE + 2),
-    TAB_CENTER     = 2 << (TAB_FIRST_AVAILABLE + 2),
-    TAB_HALIGN     = 3 << (TAB_FIRST_AVAILABLE + 2), /* Alignment mask. */
+    TAB_RIGHT      = 0 << (TAB_FIRST_AVAILABLE + 4),
+    TAB_LEFT       = 1 << (TAB_FIRST_AVAILABLE + 4),
+    TAB_CENTER     = 2 << (TAB_FIRST_AVAILABLE + 4),
+    TAB_HALIGN     = 3 << (TAB_FIRST_AVAILABLE + 4), /* Alignment mask. */
 
     /* Vertical alignment of cell contents. */
-    TAB_TOP        = 0 << (TAB_FIRST_AVAILABLE + 4),
-    TAB_MIDDLE     = 1 << (TAB_FIRST_AVAILABLE + 4),
-    TAB_BOTTOM     = 2 << (TAB_FIRST_AVAILABLE + 4),
-    TAB_VALIGN     = 3 << (TAB_FIRST_AVAILABLE + 4), /* Alignment mask. */
+    TAB_TOP        = 0 << (TAB_FIRST_AVAILABLE + 6),
+    TAB_MIDDLE     = 1 << (TAB_FIRST_AVAILABLE + 6),
+    TAB_BOTTOM     = 2 << (TAB_FIRST_AVAILABLE + 6),
+    TAB_VALIGN     = 3 << (TAB_FIRST_AVAILABLE + 6), /* Alignment mask. */
   };
 
 /* Rule masks. */
index b4b1223ea0da746883c9eaf0d26d09bdc342c803..7ef12de247daef225141897c6375cf75312328c4 100644 (file)
@@ -122,7 +122,8 @@ text_item_to_table_item (struct text_item *text_item)
   struct tab_table *tab = tab_create (1, 1);
 
   struct area_style *style = pool_alloc (tab->container, sizeof *style);
-  *style = (struct area_style) AREA_STYLE_INITIALIZER;
+  *style = (struct area_style) { AREA_STYLE_INITIALIZER__,
+                                 .cell_style.halign = TABLE_HALIGN_LEFT };
   struct font_style *font_style = &style->font_style;
   if (text_item->typeface)
     font_style->typeface = pool_strdup (tab->container, text_item->typeface);
@@ -133,7 +134,7 @@ text_item_to_table_item (struct text_item *text_item)
   font_style->markup = text_item->markup;
   tab->styles[0] = style;
 
-  int opts = TAB_LEFT;
+  int opts = 0;
   if (text_item->markup)
     opts |= TAB_MARKUP;
   if (text_item->type == TEXT_ITEM_SYNTAX || text_item->type == TEXT_ITEM_LOG)