From 143dba446101d082314ca5d753a3f3a673865af2 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 30 Jan 2014 04:56:16 +0100 Subject: [PATCH] Fix harfbuzz issues by setting QT_HARFBUZZ=old --- TODO | 1 - qutebrowser/app.py | 6 ++++++ qutebrowser/utils/harfbuzz.py | 22 ++++++++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 qutebrowser/utils/harfbuzz.py diff --git a/TODO b/TODO index 65f1300c0..842ad9a07 100644 --- a/TODO +++ b/TODO @@ -38,7 +38,6 @@ proper exception handling with saving pages Minor features/bugs =================== -Mayhaps set QT_HARFBUZZ=old -- this doesn't seem to be possible the easy way (os.environ) progress bar is often red titles are still weird (and not attached to tab obj) Hiding scrollbars diff --git a/qutebrowser/app.py b/qutebrowser/app.py index b92fab3e4..7462765a2 100644 --- a/qutebrowser/app.py +++ b/qutebrowser/app.py @@ -6,6 +6,12 @@ import faulthandler from signal import signal, SIGINT from argparse import ArgumentParser +# This is a really old place to do this, but we have to do this before +# importing PyQt or it won't work. +# See https://bugreports.qt-project.org/browse/QTBUG-36099 +import qutebrowser.utils.harfbuzz as harfbuzz +harfbuzz.fix() + from PyQt5.QtWidgets import QApplication from PyQt5.QtCore import QUrl, QTimer diff --git a/qutebrowser/utils/harfbuzz.py b/qutebrowser/utils/harfbuzz.py new file mode 100644 index 000000000..a8fdef63b --- /dev/null +++ b/qutebrowser/utils/harfbuzz.py @@ -0,0 +1,22 @@ +"""Fixer to set QT_HARFBUZZ variable. + +In its own file so it doesn't include any Qt stuff, because if it did, it +wouldn't work. +""" + +import os +import sys + + +def fix(): + """Fix harfbuzz issues. + + This switches to an older (but more stable) harfbuzz font rendering engine + instead of using the system wide one. + + This fixes crashes on various sites. + See https://bugreports.qt-project.org/browse/QTBUG-36099 + """ + if sys.platform.startswith('linux'): + # Switch to old but stable font rendering engine + os.environ['QT_HARFBUZZ'] = 'old'