Skip to content

Commit 414d0f6

Browse files
2387skjuvkareh
authored andcommitted
applet clock: fix proportional fonts by font-feature tabular numbers
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.
1 parent bdc435f commit 414d0f6

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

applets/clock/clock.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1546,6 +1546,16 @@ create_main_clock_label (ClockData *cd)
15461546
GtkWidget *label;
15471547

15481548
label = gtk_label_new (NULL);
1549+
1550+
// Fix proportional font by font feature tabular numbers (tnum) (if supported by the font)
1551+
PangoAttribute *attr;
1552+
PangoAttrList *alist;
1553+
attr = pango_attr_font_features_new ("tnum=1");
1554+
alist = pango_attr_list_new ();
1555+
pango_attr_list_insert (alist, attr);
1556+
gtk_label_set_attributes (GTK_LABEL (label), alist);
1557+
pango_attr_list_unref (alist);
1558+
15491559
/*Fixme-this is invalid for labels with any recent GTK3 version, maybe all of them*/
15501560
/*
15511561
g_signal_connect (label, "size-request",

0 commit comments

Comments
 (0)