Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
5.15.2
-
None
-
-
fccd419dd632306a4bd85928223e0a56a59510ef (qt/qtbase/dev) dbaac6e5c1c1725055187bd5473f95de78f5b408 (qt/tqtc-qtbase/tqtc/lts-5.15) ed3edec3bacb4f2000f8732ba12e90c353c2c543 (qt/qtbase/6.0) 065527825e19a8a5eb2efa0ab481980dc86ad58a (qt/qtbase/6.1)
Description
This code:
QFontDatabase::addApplicationFont("EmojiOneColor-SVGinOT.ttf"); auto image = QImage(256, 256, QImage::Format_ARGB32_Premultiplied); const auto string = QString() + QChar(8205) + QChar(9794) + QChar(65039); auto p = QPainter(&image); p.setFont(QFont("Emoji One Color")); p.drawText(0, 0, string);
With "EmojiOneColor-SVGinOT.ttf" file being in the app folder (so it could load the font) crashes with assertion violation in text shaping:
ASSERT failure in Q_UNREACHABLE(): "Q_UNREACHABLE was reached", file text\qtextengine.cpp, line 1551. (for Qt 5.15.2)
This leads to crashes in production for my project =(
UPD
I've done some debugging, the minimal example is now this:
QFontDatabase::addApplicationFont("EmojiOneColor-SVGinOT.ttf"); const auto metrics = QFontMetrics(QFont("Emoji One Color")); const auto width = metrics.horizontalAdvance(QString() + QChar(8205));
This appears when a font doesn't have a glyph for a space (' ') and we try to shape a string, that contains only "default ignorables" (in this example - only one). Then hb_ot_hide_default_ignorables() tries to replace it by space (' '), but the space is not in this font, so it removes the glyph and tries to merge clusters. But this is the only character, so the shaped buffer is empty, it doesn't have any glyphs at all and Qt asserts that it should have at least one glyph.
Attachments
For Gerrit Dashboard: QTBUG-89155 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
329078,3 | Remove false Q_UNREACHABLE from shaping code | dev | qt/qtbase | Status: MERGED | +2 | 0 |
332587,2 | Remove false Q_UNREACHABLE from shaping code | 6.0 | qt/qtbase | Status: MERGED | +2 | 0 |
332588,2 | Remove false Q_UNREACHABLE from shaping code | tqtc/lts-5.15 | qt/tqtc-qtbase | Status: MERGED | +2 | 0 |
332708,3 | Remove false Q_UNREACHABLE from shaping code | 6.1 | qt/qtbase | Status: MERGED | +2 | 0 |
389733,6 | Fix crash when text shaping fails | dev | qt/qtbase | Status: MERGED | +2 | 0 |
390159,2 | Fix crash when text shaping fails | 6.3 | qt/qtbase | Status: MERGED | +2 | 0 |
390160,2 | Fix crash when text shaping fails | 6.2 | qt/qtbase | Status: MERGED | +2 | 0 |
390167,2 | Fix crash when text shaping fails | tqtc/lts-5.15 | qt/tqtc-qtbase | Status: MERGED | +2 | 0 |