From 345fac8441317c0b6d675cc2866d85a537b7f97a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 21 Feb 2018 23:09:36 +0530 Subject: [PATCH] Workaround for Qt 5.10 on linux resetting the global font --- src/calibre/gui2/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/calibre/gui2/__init__.py b/src/calibre/gui2/__init__.py index 72253dc75b..55184171c4 100644 --- a/src/calibre/gui2/__init__.py +++ b/src/calibre/gui2/__init__.py @@ -844,6 +844,11 @@ class Application(QApplication): if s is not None: font.setStretch(s) QApplication.setFont(font) + if not isosx and not iswindows: + # Qt 5.10.1 on Linux resets the global font on first event loop tick. + # So workaround it by setting the font once again in a timer. + font_from_prefs = self.font() + QTimer.singleShot(0, lambda : QApplication.setFont(font_from_prefs)) self.line_height = max(12, QFontMetrics(self.font()).lineSpacing()) dl = QLocale(get_lang())