[accerciser] interface_view: use Liberation Sans font if available



commit c369cd3dc58b387256b13a1434081c2bdfc208c8
Author: Samuel Thibault <samuel thibault ens-lyon org>
Date:   Thu Jun 20 16:48:49 2019 +0200

    interface_view: use Liberation Sans font if available
    
    In addition to Courier New which might not be available (e.g. not in
    Fedora 30)
    
    Fixes #8

 plugins/interface_view.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/plugins/interface_view.py b/plugins/interface_view.py
index d637e79..e364a99 100644
--- a/plugins/interface_view.py
+++ b/plugins/interface_view.py
@@ -1207,8 +1207,14 @@ class _SectionText(_InterfaceSection):
 
     self.offset_spin = ui_xml.get_object('spinbutton_text_offset')
     self.text_view = ui_xml.get_object('textview_text')
-    font = Pango.FontDescription("Courier New")
-    self.text_view.modify_font(font)
+    pango_ctx = self.text_view.get_pango_context()
+    for f in pango_ctx.list_families():
+        name = f.get_name()
+        # These are known to show e.g U+FFFC
+        if name in [ "Courier New", "Liberation Sans" ]:
+            self.text_view.modify_font(Pango.FontDescription(name))
+            break
+
     self.text_buffer = self.text_view.get_buffer()
     self.toggle_defaults = ui_xml.get_object('checkbutton_text_defaults')
     self.label_start = ui_xml.get_object('label_text_attr_start')


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]