More intelligent harfbuzz choosing. Fixes rendering segfaults.
This commit is contained in:
parent
9be3b0499d
commit
361dc94a21
1
TODO
1
TODO
@ -44,7 +44,6 @@ Improvements / minor features
|
||||
|
||||
- Print nicer error message when platform plugin is missing
|
||||
(on Arch: libxkbcommon-x11)
|
||||
- Force new harfbuzz engine with linux and 5.3.0
|
||||
- Add harfbuzz forcing to version info
|
||||
- Print some meaningful message (via qInstallMsgHandler) when platform plugins
|
||||
are missing, especially with xcb (on Arch: libxkbcommon-x11)
|
||||
|
@ -66,16 +66,38 @@ def fix_harfbuzz(args):
|
||||
args: The argparse namespace.
|
||||
"""
|
||||
from qutebrowser.utils.log import init as logger
|
||||
from PyQt5.QtCore import qVersion
|
||||
if 'PyQt5.QtWidgets' in sys.modules:
|
||||
logger.warning("Harfbuzz fix attempted but QtWidgets is already "
|
||||
"imported!")
|
||||
if sys.platform.startswith('linux') and args.harfbuzz == 'auto':
|
||||
os.environ['QT_HARFBUZZ'] = 'old'
|
||||
elif args.harfbuzz == 'old':
|
||||
os.environ['QT_HARFBUZZ'] = 'old'
|
||||
elif args.harfbuzz == 'new':
|
||||
os.environ['QT_HARFBUZZ'] = 'new'
|
||||
# else: use system default harfbuzz
|
||||
# Lets use the most stable variant.
|
||||
#
|
||||
# - On Qt 5.2 (and probably earlier) the new engine probably has more
|
||||
# crashes and is also experimental.
|
||||
#
|
||||
# - On Qt 5.3.0 there's a bug that affects a lot of websites:
|
||||
# https://bugreports.qt-project.org/browse/QTBUG-39278
|
||||
# So the new engine will be more stable.
|
||||
#
|
||||
# - On Qt 5.3.1 this bug hopefully will be fixed and the old engine
|
||||
# will be the more stable one again.
|
||||
if qVersion() == '5.3.0':
|
||||
logger.debug("Using new harfbuzz engine (auto)")
|
||||
os.environ['QT_HARFBUZZ'] = 'new'
|
||||
else:
|
||||
logger.debug("Using old harfbuzz engine (auto)")
|
||||
os.environ['QT_HARFBUZZ'] = 'old'
|
||||
elif args.harfbuzz in ['old', 'new']:
|
||||
# forced harfbuzz variant
|
||||
# FIXME looking at the Qt code, 'new' isn't a valid value, but leaving
|
||||
# it empty and using new yields different behaviour...
|
||||
logger.debug("Using {} harfbuzz engine (forced)".format(args.harfbuzz))
|
||||
os.environ['QT_HARFBUZZ'] = args.harfbuzz
|
||||
else:
|
||||
# use system default harfbuzz
|
||||
logger.debug("Using system harfbuzz engine")
|
||||
pass
|
||||
|
||||
|
||||
# At this point we can safely import Qt stuff, but we can't be sure it's
|
||||
|
Loading…
Reference in New Issue
Block a user