summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qtextengine.cpp
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2019-10-16 15:24:07 +0200
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2019-10-21 09:01:17 +0200
commitcc4087b18a488ffb02105d31da6f05acad65b728 (patch)
tree98cce0f94971ed1260b5f92287b929fcc3cbeeea /src/gui/text/qtextengine.cpp
parent51edfdd212ed8be611ce6719db7ef454de5b5bcc (diff)
Remove mapping from CJK/Latin to Common script in Harfbuzz NG
The original commit message says this is to ensure compatibility with the old Harfbuzz, but since OpenType features such as kerning are often matched based on the writing system of the glyphs, it will break kerning (and other OpenType features) for text in these languages in some fonts. Even font that were successfully kerned by the old Harfbuzz are broken. To avoid regressing on finding cursor positions inside ligatures, we need to amend 9f837af9458ea4825b9a8061de444f62d8a7a048. This would enable cursor positions inside ligatures for languages where they are only used for cosmetic purposes, and this was generalized to Common and Greek at the time. This now has to be expanded to include all the writing systems that were previously covered by "Common". [ChangeLog][Text] Fixed kerning error with certain fonts. Fixes: QTBUG-77908 Change-Id: Id261fef05f86841b1533b7d87207c3d17e01e96e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/gui/text/qtextengine.cpp')
-rw-r--r--src/gui/text/qtextengine.cpp24
1 files changed, 7 insertions, 17 deletions
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index b37353bf2c..209433dac5 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -2125,22 +2125,7 @@ void QTextEngine::itemize() const
}
#if QT_CONFIG(harfbuzz)
analysis = scriptAnalysis.data();
- if (qt_useHarfbuzzNG()) {
- // ### pretend HB-old behavior for now
- for (int i = 0; i < length; ++i) {
- switch (analysis[i].script) {
- case QChar::Script_Latin:
- case QChar::Script_Hiragana:
- case QChar::Script_Katakana:
- case QChar::Script_Bopomofo:
- case QChar::Script_Han:
- analysis[i].script = QChar::Script_Common;
- break;
- default:
- break;
- }
- }
- } else {
+ if (!qt_useHarfbuzzNG()) {
for (int i = 0; i < length; ++i)
analysis[i].script = hbscript_to_script(script_to_hbscript(analysis[i].script));
}
@@ -3619,7 +3604,12 @@ int QTextEngine::positionInLigature(const QScriptItem *si, int end,
int clusterLength = 0;
if (si->analysis.script != QChar::Script_Common &&
- si->analysis.script != QChar::Script_Greek) {
+ si->analysis.script != QChar::Script_Greek &&
+ si->analysis.script != QChar::Script_Latin &&
+ si->analysis.script != QChar::Script_Hiragana &&
+ si->analysis.script != QChar::Script_Katakana &&
+ si->analysis.script != QChar::Script_Bopomofo &&
+ si->analysis.script != QChar::Script_Han) {
if (glyph_pos == -1)
return si->position + end;
else {