From e6bb779b866f297b736a7f93a0c8aa741131726f Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Wed, 26 Dec 2018 14:14:51 -0800 Subject: [PATCH] output: Rename a few struct members for consistency. --- src/output/cairo.c | 6 +++--- src/output/table-provider.h | 8 ++++---- src/output/table.c | 6 +++--- src/output/text-item.c | 11 ++++++----- src/output/text-item.h | 4 ++-- 5 files changed, 18 insertions(+), 17 deletions(-) diff --git a/src/output/cairo.c b/src/output/cairo.c index 32369a7a0e..4584181d32 100644 --- a/src/output/cairo.c +++ b/src/output/cairo.c @@ -1225,11 +1225,11 @@ xr_layout_cell_text (struct xr_driver *xr, const struct table_cell *cell, : options & TAB_EMPH ? &xr->fonts[XR_FONT_EMPHASIS] : &xr->fonts[XR_FONT_PROPORTIONAL]); struct xr_font local_font; - if (cell->style->font) + if (cell->style->typeface) { PangoFontDescription *desc = parse_font ( - style->font, - style->font_size ? style->font_size * 1000 * 72 / 128 : 10000, + style->typeface, + style->size ? style->size * 1000 * 72 / 128 : 10000, style->bold, style->italic); if (desc) { diff --git a/src/output/table-provider.h b/src/output/table-provider.h index 14c3656e4a..ab39b4b25c 100644 --- a/src/output/table-provider.h +++ b/src/output/table-provider.h @@ -50,8 +50,8 @@ struct cell_style { struct cell_color fg[2], bg[2]; int margin[TABLE_N_AXES][2]; - char *font; - int font_size; + char *typeface; + int size; bool bold, italic, underline; }; @@ -61,8 +61,8 @@ struct cell_style .bg = { [0] = CELL_COLOR_WHITE, [1] = CELL_COLOR_WHITE}, \ .margin = { [TABLE_HORZ][0] = 8, [TABLE_HORZ][1] = 11, \ [TABLE_VERT][0] = 1, [TABLE_VERT][1] = 1 }, \ - .font = NULL, \ - .font_size = 0, \ + .typeface = NULL, \ + .size = 0, \ .bold = false, \ .italic = false, \ .underline = false, \ diff --git a/src/output/table.c b/src/output/table.c index b83d66fb20..f909bf3ade 100644 --- a/src/output/table.c +++ b/src/output/table.c @@ -135,8 +135,8 @@ cell_style_clone (struct pool *pool, const struct cell_style *old) { struct cell_style *new = pool_malloc (pool, sizeof *new); *new = *old; - if (new->font) - new->font = pool_strdup (pool, new->font); + if (new->typeface) + new->typeface = pool_strdup (pool, new->typeface); return new; } @@ -145,7 +145,7 @@ cell_style_free (struct cell_style *style) { if (style) { - free (style->font); + free (style->typeface); free (style); } } diff --git a/src/output/text-item.c b/src/output/text-item.c index 231a5c1fb7..5b18e54c5d 100644 --- a/src/output/text-item.c +++ b/src/output/text-item.c @@ -101,9 +101,9 @@ text_item_to_table_item (struct text_item *text_item) 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; + if (text_item->typeface) + style->typeface = pool_strdup (tab->container, text_item->typeface); + style->size = text_item->size; style->bold = text_item->bold; style->italic = text_item->italic; style->underline = text_item->underline; @@ -118,13 +118,14 @@ text_item_to_table_item (struct text_item *text_item) struct table_item *table_item = table_item_create (&tab->table, NULL, NULL); text_item_unref (text_item); return table_item; -} +} + 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); } diff --git a/src/output/text-item.h b/src/output/text-item.h index 659a28bd0f..a8f1e493e9 100644 --- a/src/output/text-item.h +++ b/src/output/text-item.h @@ -50,8 +50,8 @@ struct text_item struct output_item output_item; char *text; /* The content. */ enum text_item_type type; /* Type. */ - char *font; - int font_size; + char *typeface; + int size; bool bold, italic, underline, markup; }; -- 2.30.2