[evolution/zbrown/tnum-dates] ECellText/ECellDate: Use tabular numbers for date
- From: Zander Brown <zbrown src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/zbrown/tnum-dates] ECellText/ECellDate: Use tabular numbers for date
- Date: Wed, 29 Jul 2020 17:30:18 +0000 (UTC)
commit ba4da82d013b4cd9c5d40821012b9f37d0c22b98
Author: Zander Brown <zbrown gnome org>
Date: Wed Jul 29 16:37:19 2020 +0100
ECellText/ECellDate: Use tabular numbers for date
Add a "use-tabular-numbers" property to ECellText that ECellDate sets to
true
This enables the tnum=1 font feature making digits equal width
src/e-util/e-cell-date.c | 1 +
src/e-util/e-cell-text.c | 27 ++++++++++++++++++++++++++-
src/e-util/e-cell-text.h | 1 +
3 files changed, 28 insertions(+), 1 deletion(-)
---
diff --git a/src/e-util/e-cell-date.c b/src/e-util/e-cell-date.c
index 1ac86a9d42..be77a93bc1 100644
--- a/src/e-util/e-cell-date.c
+++ b/src/e-util/e-cell-date.c
@@ -77,6 +77,7 @@ e_cell_date_class_init (ECellDateClass *class)
static void
e_cell_date_init (ECellDate *ecd)
{
+ g_object_set (ecd, "use-tabular-numbers", TRUE, NULL);
}
/**
diff --git a/src/e-util/e-cell-text.c b/src/e-util/e-cell-text.c
index 65adf2abb6..60fc32ed49 100644
--- a/src/e-util/e-cell-text.c
+++ b/src/e-util/e-cell-text.c
@@ -85,7 +85,8 @@ enum {
PROP_ITALIC_COLUMN,
PROP_STRIKEOUT_COLOR_COLUMN,
PROP_EDITABLE,
- PROP_BG_COLOR_COLUMN
+ PROP_BG_COLOR_COLUMN,
+ PROP_USE_TABULAR_NUMBERS,
};
enum {
@@ -471,6 +472,11 @@ build_attr_list (ECellTextView *text_view,
pango_attr_list_insert_before (attrs, attr);
}
+ if (ect->use_tabular_numbers) {
+ PangoAttribute *attr = pango_attr_font_features_new ("tnum=1");
+
+ pango_attr_list_insert_before (attrs, attr);
+ }
return attrs;
}
@@ -1602,6 +1608,10 @@ ect_set_property (GObject *object,
text->bg_color_column = g_value_get_int (value);
break;
+ case PROP_USE_TABULAR_NUMBERS:
+ text->use_tabular_numbers = g_value_get_boolean (value);
+ break;
+
default:
return;
}
@@ -1651,6 +1661,10 @@ ect_get_property (GObject *object,
g_value_set_int (value, text->bg_color_column);
break;
+ case PROP_USE_TABULAR_NUMBERS:
+ g_value_set_boolean (value, text->use_tabular_numbers);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -1802,6 +1816,16 @@ e_cell_text_class_init (ECellTextClass *class)
-1, G_MAXINT, -1,
G_PARAM_READWRITE));
+ g_object_class_install_property (
+ object_class,
+ PROP_USE_TABULAR_NUMBERS,
+ g_param_spec_boolean (
+ "use-tabular-numbers",
+ "Use tabular numbers",
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
if (!clipboard_atom)
clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE);
@@ -1975,6 +1999,7 @@ e_cell_text_init (ECellText *ect)
ect->color_column = -1;
ect->bg_color_column = -1;
ect->editable = TRUE;
+ ect->use_tabular_numbers = FALSE;
}
/**
diff --git a/src/e-util/e-cell-text.h b/src/e-util/e-cell-text.h
index c486cde8ae..dd1baa2e38 100644
--- a/src/e-util/e-cell-text.h
+++ b/src/e-util/e-cell-text.h
@@ -85,6 +85,7 @@ struct _ECellText {
guint use_ellipsis : 1; /* Whether to use the ellipsis. */
guint editable : 1; /* Whether the text can be edited. */
+ guint use_tabular_numbers : 1; /* Whether to use the tabular numbers. */
gint strikeout_column;
gint underline_column;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]