diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-02-01 10:21:04 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-02-08 11:22:08 +0100 |
commit | 0ffdbb21261eee3a9ec1cd541478ee883a12065c (patch) | |
tree | 68fca7d51dec9245f5bc4dfb652b65f8b1dd9d22 /src/gui/text | |
parent | 4e5d0cf5e51bede27016ae52fee9199547d0c658 (diff) | |
download | qtbase-0ffdbb21261eee3a9ec1cd541478ee883a12065c.tar.gz |
Handle macOS 11 issues in softHyphens test
Calculate the effective width of the hyphen better, and compare with
ceiled sizes.
Pick-to: 6.1 6.0
Fixes: QTBUG-90698
Change-Id: I7ed2eb44c54240ecb2f8a38e5acf1f32608b2bfb
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'src/gui/text')
-rw-r--r-- | src/gui/text/qtextengine.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 28802c9bed..675e87b322 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -1373,9 +1373,15 @@ static void applyVisibilityRules(ushort ucs, QGlyphLayout *glyphs, uint glyphPos if (!fontEngine->symbol) { // U+00AD [SOFT HYPHEN] is a default ignorable codepoint, // so we replace its glyph and metrics with ones for - // U+002D [HYPHEN-MINUS] and make it visible if it appears at line-break + // U+002D [HYPHEN-MINUS] or U+2010 [HYPHEN] and make + // it visible if it appears at line-break const uint engineIndex = glyphs->glyphs[glyphPosition] & 0xff000000; - glyphs->glyphs[glyphPosition] = fontEngine->glyphIndex('-'); + glyph_t glyph = fontEngine->glyphIndex(0x002d); + if (glyph == 0) + glyph = fontEngine->glyphIndex(0x2010); + if (glyph == 0) + glyph = fontEngine->glyphIndex(0x00ad); + glyphs->glyphs[glyphPosition] = glyph; if (Q_LIKELY(glyphs->glyphs[glyphPosition] != 0)) { glyphs->glyphs[glyphPosition] |= engineIndex; QGlyphLayout tmp = glyphs->mid(glyphPosition, 1); |