diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2017-07-03 11:30:43 +0200 |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2017-07-26 10:51:00 +0000 |
commit | 73176d2922baae1ccaa702e4900b0473071d0a96 (patch) | |
tree | fc049297630455d6ea0b7f4161acfba610aed2d1 /src/gui/text/qfontengine.cpp | |
parent | 8719660416986702c1ee9f65c4e347efa37ac770 (diff) |
Add API to disable text shaping on fonts
In the past, we had an undocumented text flag that worked with
one of the QPainter::drawText() overloads. This was never intended
as public API and served a specific cause in Qt WebKit at one point.
But there is a general need for such API, as disabling shaping features
easily gives 25% performance improvement on text rendering even for
fairly short strings.
This patch adds a new style strategy flag to disable shaping and
will just uses the CMAP and HDMX tables to get glyph indices and advances
for the characters. In Qt 6, the TextBypassShaping flag can be removed
completely and be replaced by the style strategy.
[ChangeLog][QtGui][Text] Added QFont::PreferNoShaping style strategy to support
improvements to performance at the expense of some cosmetic font features.
Task-number: QTBUG-56728
Change-Id: I48e025dcc06afe02824bf5b5011702a7e0036f6d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/gui/text/qfontengine.cpp')
-rw-r--r-- | src/gui/text/qfontengine.cpp | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index 596c79fd05..e4f9b8b9d4 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -359,10 +359,8 @@ bool QFontEngine::supportsScript(QChar::Script script) const // ### TODO: This only works for scripts that require OpenType. More generally // for scripts that do not require OpenType we should just look at the list of // supported writing systems in the font's OS/2 table. - if (!((script >= QChar::Script_Syriac && script <= QChar::Script_Sinhala) - || script == QChar::Script_Khmer || script == QChar::Script_Nko)) { + if (!scriptRequiresOpenType(script)) return true; - } #if QT_CONFIG(harfbuzz) if (qt_useHarfbuzzNG()) { |