summaryrefslogtreecommitdiff
path: root/applets/clock/clock.c
diff options
context:
space:
mode:
author2387skju <[email protected]>2026-05-02 15:35:27 +0200
committerVictor Kareh <[email protected]>2026-05-20 07:32:34 -0400
commit414d0f6d92aba6dedbe9d2ee1f5e1e3a78e9d355 (patch)
tree94c1fe3e6f1398e810257c34c2cd5e3feac5df5f /applets/clock/clock.c
parentbdc435fe61063547141b34ac6ebe9a404ccdfdb2 (diff)
downloadmate-panel-414d0f6d92aba6dedbe9d2ee1f5e1e3a78e9d355.tar.bz2
mate-panel-414d0f6d92aba6dedbe9d2ee1f5e1e3a78e9d355.tar.xz
applet clock: fix proportional fonts by font-feature tabular numbersHEADmaster
Fixes #1338: The clock-time was jumping (and also the rest of the panel), due to different width of the digits. The font must support this feature, otherwise this fix will not work: Example: Font "Cantarell" OK ; Font "Quicksand" still buggy.
Diffstat (limited to 'applets/clock/clock.c')
-rw-r--r--applets/clock/clock.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/applets/clock/clock.c b/applets/clock/clock.c
index 2aff3878..0c104f31 100644
--- a/applets/clock/clock.c
+++ b/applets/clock/clock.c
@@ -1546,6 +1546,16 @@ create_main_clock_label (ClockData *cd)
GtkWidget *label;
label = gtk_label_new (NULL);
+
+ // Fix proportional font by font feature tabular numbers (tnum) (if supported by the font)
+ PangoAttribute *attr;
+ PangoAttrList *alist;
+ attr = pango_attr_font_features_new ("tnum=1");
+ alist = pango_attr_list_new ();
+ pango_attr_list_insert (alist, attr);
+ gtk_label_set_attributes (GTK_LABEL (label), alist);
+ pango_attr_list_unref (alist);
+
/*Fixme-this is invalid for labels with any recent GTK3 version, maybe all of them*/
/*
g_signal_connect (label, "size-request",