Hide EUDC font better when it is available

In ff2ae36551 we added support for
the End User Defined Characters font when it is available, and
it was added as the first fallback font to avoid being overridden
by a symbol font.

An unintended side effect was that we would also override the
default fonts for the selected style hint, so in e.g. the textedit
example, all the text would default to EUDC. We now add it after
the default style hint font instead. We also mark it as a
private font family, since it should not be shown in the font
combo box as a selectable font, but should only be used automatically
as fallback for PUA characters.

Task-number: QTBUG-65308
Change-Id: Id2ffd058a9f1d660cf2b9b1383ba1fdb10dcc97e
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
bb10
Eskil Abrahamsen Blomfeldt 2018-01-04 12:59:03 +01:00
parent b4869b8e93
commit cf35bc21c0
2 changed files with 8 additions and 1 deletions

View File

@ -1884,8 +1884,9 @@ QString QWindowsFontDatabase::familyForStyleHint(QFont::StyleHint styleHint)
QStringList QWindowsFontDatabase::fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const
{
QStringList result = m_eudcFonts;
QStringList result;
result.append(QWindowsFontDatabase::familyForStyleHint(styleHint));
result.append(m_eudcFonts);
result.append(QWindowsFontDatabase::extraTryFontsForFamily(family));
result.append(QPlatformFontDatabase::fallbacksForFamily(family, style, styleHint, script));
@ -2075,4 +2076,9 @@ QString QWindowsFontDatabase::readRegistryString(HKEY parentHandle, const wchar_
return result;
}
bool QWindowsFontDatabase::isPrivateFontFamily(const QString &family) const
{
return m_eudcFonts.contains(family) || QPlatformFontDatabase::isPrivateFontFamily(family);
}
QT_END_NAMESPACE

View File

@ -109,6 +109,7 @@ public:
bool fontsAlwaysScalable() const override;
void derefUniqueFont(const QString &uniqueFont);
void refUniqueFont(const QString &uniqueFont);
bool isPrivateFontFamily(const QString &family) const override;
static QFont systemDefaultFont();