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
qabstracttextdocumentlayout.cpp
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
qdistancefield_p.h
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
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
qfontengine.cpp Replace Q_NULLPTR with nullptr where possible 2017-09-19 11:53:55 +00:00
qfontengineglyphcache_p.h
qfontengineglyphcache.cpp
qfontinfo.h
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
qfontsubset_p.h
qfontsubset.cpp Fix rounding errors in generation of '/W' and '/DW' entries 2017-02-17 08:14:19 +00:00
qfragmentmap_p.h
qfragmentmap.cpp
qglyphrun_p.h
qglyphrun.cpp
qglyphrun.h
qharfbuzzng_p.h
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
qrawfont.cpp
qrawfont.h
qstatictext_p.h
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
qtextcursor_p.h
qtextcursor.cpp
qtextcursor.h
qtextdocument_p.cpp Add QTextOption/QTextEdit/QPlainTextEdit::tabStopDistance property 2017-08-06 08:16:06 +00:00
qtextdocument_p.h
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
qtextdocumentfragment.cpp QTextDocument: improve import of DIV tags 2017-04-10 09:44:01 +00:00
qtextdocumentfragment.h
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
qtextdocumentwriter.h
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
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
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
qtextlist.h
qtextobject_p.h
qtextobject.cpp
qtextobject.h Replace Q_NULLPTR with nullptr where possible 2017-09-19 11:53:55 +00:00
qtextodfwriter_p.h
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
qtexttable.h Replace Q_NULLPTR with nullptr where possible 2017-09-19 11:53:55 +00:00
qzip.cpp
qzipreader_p.h
qzipwriter_p.h
text.pri