From cb62f0c8a85010fecefc602178e9ed99640c827e Mon Sep 17 00:00:00 2001 From: Rui Matos Date: Thu, 5 Dec 2013 23:07:41 +0100 Subject: [PATCH 2/5] GSettingsFontButtonTweak: filter out fonts that gtk+ 3 doesn't honor --- gtweak/widgets.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gtweak/widgets.py b/gtweak/widgets.py index 072081e..f7abd99 100644 --- a/gtweak/widgets.py +++ b/gtweak/widgets.py @@ -174,7 +174,19 @@ class GSettingsFontButtonTweak(_GSettingsTweak): def __init__(self, schema_name, key_name, **options): _GSettingsTweak.__init__(self, schema_name, key_name, **options) + def font_filter(family, face, data): + desc = face.describe() + if (desc.get_style() != Pango.Style.NORMAL or + desc.get_variant() != Pango.Variant.NORMAL or + desc.get_weight() != Pango.Weight.NORMAL or + desc.get_stretch() != Pango.Stretch.NORMAL): + return False + else: + return True + w = Gtk.FontButton() + if key_name == "font-name": + w.set_filter_func(font_filter, None) self.settings.bind(key_name, w, "font-name", Gio.SettingsBindFlags.DEFAULT) self.widget = build_label_beside_widget(self.name, w) self.widget_for_size_group = w -- 1.8.3.1