[accerciser] IPython console: also use a font which shows U+FFFC
- From: Samuel Thibault <sthibaul src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [accerciser] IPython console: also use a font which shows U+FFFC
- Date: Thu, 20 Jun 2019 14:59:32 +0000 (UTC)
commit 67bddf4f8b1549ea6daa982e1f6acedbd8bf965d
Author: Samuel Thibault <samuel thibault ens-lyon org>
Date: Thu Jun 20 16:53:31 2019 +0200
IPython console: also use a font which shows U+FFFC
And preferrably mono
Fixes #8
plugins/ipython_view.py | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
---
diff --git a/plugins/ipython_view.py b/plugins/ipython_view.py
index f718877..b4a787f 100755
--- a/plugins/ipython_view.py
+++ b/plugins/ipython_view.py
@@ -380,7 +380,20 @@ class ConsoleView(gtk.TextView):
Initialize console view.
'''
gtk.TextView.__init__(self)
- self.modify_font(Pango.FontDescription('Mono'))
+ pango_ctx = self.get_pango_context()
+ chosen = None
+ 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", "Courier Mono" ]:
+ chosen = name
+ break
+ if name in [ "Liberation Sans" ]:
+ chosen = name
+ # But prefer a monospace one if possible
+ if chosen == None:
+ chosen = "Mono"
+ self.modify_font(Pango.FontDescription(chosen))
self.set_cursor_visible(True)
self.text_buffer = self.get_buffer()
self.mark = self.text_buffer.create_mark('scroll_mark',
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]