qt5base-lts/src/gui/text
Eskil Abrahamsen Blomfeldt 5d2b12d71c Fix synchronization error when matching font with empty family
We currently match font family names in cross-platform code, before
asking the system to load it. In the case of an empty family name, we
will return the first font in the list which matches the other
conditions.

After that, though, we would pass the empty family name to the
platform font database, and some old platform-specific matching
was invoked. In the case of Windows, we would default to
MS Sans Serif, which is the old Windows 1.0 raster font and which
is probably used by Qt exclusively in the world at this point.

The problem in the end was that the font info would be out of sync.
If the font matched by Qt happened to be smoothly scalable, then
we would treat MS Sans Serif as smoothly scalable, giving us
random glyphs when displaying text in Qt Quick. We would also
overwrite the family name with the one matched by Qt, so even
when MS Sans Serif was used to render the text, we would report
that it was something else.

For empty font families, we therefore pass the family we have
actually matched into the platform database. This will have
the side effect of trusting the font matching in Qt, but only
for the rare case where someone actually explicitly sets the
font family to the empty string.

Note that the random glyph bug that triggered the investigation is not
happening anymore after 1eedfd0e66
because we will detect the glyph outlines as unreliable in the
MS Sans Serif font now instead of trusting the smoothly scalable
flag. But there would still be a mismatch between the font used
for rendering and the matched font.

Task-number: QTBUG-63147
Change-Id: I4a09ffddf9f8a0fabe7738e2944b6d874e4728f0
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-09-25 06:42:47 +00:00
..
qabstracttextdocumentlayout_p.h Add qtguiglobal.h and qtguiglobal_p.h 2016-07-03 07:55:57 +00:00
qabstracttextdocumentlayout.cpp Add QAbstractTextDocumentLayout::imageAt(), formatAt() 2016-03-18 19:02:13 +00:00
qabstracttextdocumentlayout.h Replace Q_NULLPTR with nullptr where possible 2017-09-19 11:53:55 +00:00
qcssparser_p.h qcssparser: Undef TILDE to fix compilation on Hurd 2017-02-15 19:56:34 +00:00
qcssparser.cpp Use case-insensitive compare more 2017-03-29 03:54:57 +00:00
qcssscanner.cpp Handle indirect sibling selector 2016-07-27 20:18:02 +00:00
qdistancefield_p.h Add qtguiglobal.h and qtguiglobal_p.h 2016-07-03 07:55:57 +00:00
qdistancefield.cpp Use qRadiansToDegrees() and qDegreesToRadians() more widely 2017-07-05 10:15:34 +00:00
qfont_p.h Replace Q_DECL_OVERRIDE with override where possible 2017-09-19 11:53:42 +00:00
qfont.cpp Replace Q_NULLPTR with nullptr where possible 2017-09-19 11:53:55 +00:00
qfont.h Add API to disable text shaping on fonts 2017-07-26 10:51:00 +00:00
qfontdatabase.cpp Fix synchronization error when matching font with empty family 2017-09-25 06:42:47 +00:00
qfontdatabase.h Add qtguiglobal.h and qtguiglobal_p.h 2016-07-03 07:55:57 +00:00
qfontengine_p.h Replace Q_DECL_OVERRIDE with override where possible 2017-09-19 11:53:42 +00:00
qfontengine_qpf2_p.h Replace Q_DECL_OVERRIDE with override where possible 2017-09-19 11:53:42 +00:00
qfontengine_qpf2.cpp Added capHeight() to QRawFont and QFontMetrics(F) 2016-08-15 18:27:06 +00:00
qfontengine.cpp Replace Q_NULLPTR with nullptr where possible 2017-09-19 11:53:55 +00:00
qfontengineglyphcache_p.h Add qtguiglobal.h and qtguiglobal_p.h 2016-07-03 07:55:57 +00:00
qfontengineglyphcache.cpp Updated license headers 2016-01-15 12:25:24 +00:00
qfontinfo.h Add qtguiglobal.h and qtguiglobal_p.h 2016-07-03 07:55:57 +00:00
qfontmetrics.cpp Add API to disable text shaping on fonts 2017-07-26 10:51:00 +00:00
qfontmetrics.h Replace Q_NULLPTR with nullptr where possible 2017-09-19 11:53:55 +00:00
qfontsubset_agl.cpp Updated license headers 2016-01-15 12:25:24 +00:00
qfontsubset_p.h Add qtguiglobal.h and qtguiglobal_p.h 2016-07-03 07:55:57 +00:00
qfontsubset.cpp Fix rounding errors in generation of '/W' and '/DW' entries 2017-02-17 08:14:19 +00:00
qfragmentmap_p.h Add qtguiglobal.h and qtguiglobal_p.h 2016-07-03 07:55:57 +00:00
qfragmentmap.cpp Updated license headers 2016-01-15 12:25:24 +00:00
qglyphrun_p.h Add qtguiglobal.h and qtguiglobal_p.h 2016-07-03 07:55:57 +00:00
qglyphrun.cpp Use QFlags::setFlag where prudent in qtbase 2016-02-12 19:32:05 +00:00
qglyphrun.h Add qtguiglobal.h and qtguiglobal_p.h 2016-07-03 07:55:57 +00:00
qharfbuzzng_p.h Use harfbuzz feature to check for HarfBuzz 2016-11-24 08:38:39 +00:00
qharfbuzzng.cpp Update HB-to-Qt bridging code to deal with latest HB 2017-02-02 15:10:31 +00:00
qinputcontrol_p.h Introduce QInputControl::isCommonTextEditShortcut 2017-03-27 11:32:30 +00:00
qinputcontrol.cpp Introduce QInputControl::isCommonTextEditShortcut 2017-03-27 11:32:30 +00:00
qplatformfontdatabase.cpp Add debug operators for font database structs for easier debugging 2017-04-18 09:40:41 +00:00
qplatformfontdatabase.h macOS: Defer population of localized font family aliases until needed 2017-04-21 10:36:00 +00:00
qrawfont_p.h Add qtguiglobal.h and qtguiglobal_p.h 2016-07-03 07:55:57 +00:00
qrawfont.cpp QRawFont: Add a qHash overload 2016-11-16 18:13:41 +00:00
qrawfont.h QRawFont: Add a qHash overload 2016-11-16 18:13:41 +00:00
qstatictext_p.h Add qtguiglobal.h and qtguiglobal_p.h 2016-07-03 07:55:57 +00:00
qstatictext.cpp Replace Q_DECL_OVERRIDE with override where possible 2017-09-19 11:53:42 +00:00
qstatictext.h QStaticText: mark constructor as explicit 2017-04-05 07:58:08 +00:00
qsyntaxhighlighter.cpp Doc: updated QSyntaxHighlighter documentation and use QRegularExpression 2017-04-12 22:09:43 +00:00
qsyntaxhighlighter.h Add qtguiglobal.h and qtguiglobal_p.h 2016-07-03 07:55:57 +00:00
qtextcursor_p.h Add qtguiglobal.h and qtguiglobal_p.h 2016-07-03 07:55:57 +00:00
qtextcursor.cpp Support C++17 fallthrough attribute 2016-08-19 18:38:53 +00:00
qtextcursor.h Add qtguiglobal.h and qtguiglobal_p.h 2016-07-03 07:55:57 +00:00
qtextdocument_p.cpp Add QTextOption/QTextEdit/QPlainTextEdit::tabStopDistance property 2017-08-06 08:16:06 +00:00
qtextdocument_p.h Export QTextDocumentPrivate with Q_GUI_EXPORT 2016-08-01 11:03:35 +00:00
qtextdocument.cpp Mark some more functions with Q_DECL_CONST_FUNCTION 2017-04-05 08:00:04 +00:00
qtextdocument.h Replace Q_NULLPTR with nullptr where possible 2017-09-19 11:53:55 +00:00
qtextdocumentfragment_p.h Add qtguiglobal.h and qtguiglobal_p.h 2016-07-03 07:55:57 +00:00
qtextdocumentfragment.cpp QTextDocument: improve import of DIV tags 2017-04-10 09:44:01 +00:00
qtextdocumentfragment.h Add qtguiglobal.h and qtguiglobal_p.h 2016-07-03 07:55:57 +00:00
qtextdocumentlayout_p.h Replace Q_DECL_OVERRIDE with override where possible 2017-09-19 11:53:42 +00:00
qtextdocumentlayout.cpp Fix warnings for -no-feature-cssparser 2017-03-29 20:06:03 +00:00
qtextdocumentwriter.cpp QtGui: Introduce delegating constructors. 2016-05-09 19:47:53 +00:00
qtextdocumentwriter.h Add qtguiglobal.h and qtguiglobal_p.h 2016-07-03 07:55:57 +00:00
qtextengine_p.h QScriptItem: reduce boilerplate code 2017-03-29 04:28:48 +00:00
qtextengine.cpp Replace Q_NULLPTR with nullptr where possible 2017-09-19 11:53:55 +00:00
qtextformat_p.h QTextFormatCollection: replace copy ctor and op= with clear() 2017-02-23 18:11:55 +00:00
qtextformat.cpp Fix uninitialized members 2017-06-20 15:17:22 +00:00
qtextformat.h Add qtguiglobal.h and qtguiglobal_p.h 2016-07-03 07:55:57 +00:00
qtexthtmlparser_p.h Fix CSS line-height property multiplier value handling 2017-04-21 07:10:51 +00:00
qtexthtmlparser.cpp Replace Q_DECL_OVERRIDE with override where possible 2017-09-19 11:53:42 +00:00
qtextimagehandler_p.h Replace Q_DECL_OVERRIDE with override where possible 2017-09-19 11:53:42 +00:00
qtextimagehandler.cpp Replace QLatin1Literal with QLatin1String 2016-09-03 18:55:56 +00:00
qtextlayout.cpp Merge remote-tracking branch 'origin/5.9' into dev 2017-05-29 10:54:41 +02:00
qtextlayout.h Replace Q_NULLPTR with nullptr where possible 2017-09-19 11:53:55 +00:00
qtextlist.cpp Updated license headers 2016-01-15 12:25:24 +00:00
qtextlist.h Add qtguiglobal.h and qtguiglobal_p.h 2016-07-03 07:55:57 +00:00
qtextobject_p.h Add qtguiglobal.h and qtguiglobal_p.h 2016-07-03 07:55:57 +00:00
qtextobject.cpp Merge remote-tracking branch 'origin/5.6' into 5.7 2016-05-06 15:36:44 +02:00
qtextobject.h Replace Q_NULLPTR with nullptr where possible 2017-09-19 11:53:55 +00:00
qtextodfwriter_p.h Standardize some "We mean it" comments 2016-08-17 19:51:40 +00:00
qtextodfwriter.cpp Replace Q_DECL_OVERRIDE with override where possible 2017-09-19 11:53:42 +00:00
qtextoption.cpp Add QTextOption/QTextEdit/QPlainTextEdit::tabStopDistance property 2017-08-06 08:16:06 +00:00
qtextoption.h Add QTextOption/QTextEdit/QPlainTextEdit::tabStopDistance property 2017-08-06 08:16:06 +00:00
qtexttable_p.h Replace Q_DECL_OVERRIDE with override where possible 2017-09-19 11:53:42 +00:00
qtexttable.cpp Gui: use const (and const APIs) more 2016-06-01 09:35:29 +00:00
qtexttable.h Replace Q_NULLPTR with nullptr where possible 2017-09-19 11:53:55 +00:00
qzip.cpp Use QStringRef() more, exploiting its new ::chop() 2016-08-16 20:08:31 +00:00
qzipreader_p.h Add qtguiglobal.h and qtguiglobal_p.h 2016-07-03 07:55:57 +00:00
qzipwriter_p.h Add qtguiglobal.h and qtguiglobal_p.h 2016-07-03 07:55:57 +00:00
text.pri Accept ZWNJ, ZWJ and PUA characters in input widgets 2016-12-12 11:13:53 +00:00