Details
-
Bug
-
Resolution: Done
-
P2: Important
-
4.7.4, 4.8.0, 4.8.5, 5.5.0
-
None
-
Mac OS X
-
-
ffeefaac6273b8bdb81876a5cc26e15cb9353955
-
Bug Fixing Week Q2/2020
Description
The fix to QTBUG-19366 made it possible to access all styles of all fonts on the Mac, which is welcome. However, this sometimes fails, particularly if the regular font face has already been used.
To reproduce this, build and run the attached test app on the Mac. This selects Helvetica Neue by default and draws a QTextDocument containing the style name that uses the current font. It also offers a list of the other styles that are available (using CoreText directly - there is no API for this in Qt). Try choosing any other style, eg. 'Semibold'. You'll see that the font (and the reported style name) doesn't change.
The problem seems to be that the QFontCache thinks it's already loaded a font engine for the semibold font, and returns the regular font engine. This seems to be because the QFontDef comparison operators (and exactMatch) special-case the empty style name case so that if either of the style names are empty then the comparison will not take style name into account. This means that comparing any named style with the regular font that has no style name set will not work correctly.
I'm not sure why this special case exists - it was introduced in 15e6ac8f but I don't really understand why.
Attachments
For Gerrit Dashboard: QTBUG-22813 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
244211,2 | Support style name property in QTextCharFormat | dev | qt/qtbase | Status: MERGED | +2 | 0 |