summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2018-01-04 09:02:23 +0100
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2018-01-08 12:28:28 +0000
commit6ca48a847a1805c3826004c5b989b4ae14397a37 (patch)
tree6bf18cf3846e7597bc1a1cc76a19cfe52b71d487 /tests
parente586d9ea7f45c39d00d0fff2fdda4e20aa1c19cc (diff)
Fix fallback fonts for non-common writing system
When we request fallback fonts, we cannot discriminate the fonts based on the writing system support. This is especially important since common script is now merged with other scripts, meaning that a common script character will always go through the fallback mechanism when not supported by the main font. When drawing for instance a string of Devanagari characters on macOS, we would get a list of 33 fallback fonts, but almost all of them would be the default Devanagari font, since none of the other fallbacks would support that script. Meaning that we would just check the same font over and over, which makes no sense. The fallback list has been retrieved specifically for the given script, so we do not need to consider that when fetching the fonts. For most of the common set, we will not have noticed the bug, because at least one of the writing system-specific fallbacks will have had support for latin characters as well. But when trying to mix emojis and some non-common script, we would get a box in place of the emoji, which had been adopted to the main script and would only be looked for in the fonts supporting this. Note that this exposed an issue with the QRawFont test on some systems. When the sample text contained a space, it would be possible to get a fallback font for this character, since we now effectively support fallbacks. This is not the correct behavior, but it is unrelated to this fix, and it was not what the QRawFont::unsupportedWritingSystem() test was written to check. I have therefore removed the space from the sample text to make the test pass, and will make a separate task of fixing the issue of merging fonts for whitespace characters. [ChangeLog][QtGui][Text] Fixed a bug where mixing different writing systems with emojis could lead to missing glyphs. Task-number: QTBUG-61882 Change-Id: I00f6043bb01af1f2277723ccf643034aebf3e18f Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/gui/text/qrawfont/tst_qrawfont.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp b/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp
index 3cf108ed62..ee775d4a31 100644
--- a/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp
+++ b/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp
@@ -887,7 +887,7 @@ void tst_QRawFont::unsupportedWritingSystem()
QCOMPARE(rawFont.familyName(), QString::fromLatin1("QtBidiTestFont"));
QCOMPARE(rawFont.pixelSize(), 12.0);
- QString arabicText = QFontDatabase::writingSystemSample(QFontDatabase::Arabic);
+ QString arabicText = QFontDatabase::writingSystemSample(QFontDatabase::Arabic).simplified().remove(QLatin1Char(' '));
QTextLayout layout;
layout.setFont(font);