FontDatabase[win/freetype] implement population of aliases
We rely on this function discovering extra fonts if we cannot find any or only find poor matches for our font request. Whether that be because we had only partially populated the fonts of a given family or because the user specified a font using a localized name. It's a copy-paste of the implementation in qwindowsfontdatabase Fixes: QTBUG-111854 Pick-to: 6.5 Change-Id: I0dd97b68d84417a26ce82a46f39804b36602ed67 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
This commit is contained in:
parent
b3424c7027
commit
7a92304040
@ -295,6 +295,21 @@ static int QT_WIN_CALLBACK storeFont(const LOGFONT *logFont, const TEXTMETRIC *t
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool QWindowsFontDatabaseFT::populateFamilyAliases(const QString &missingFamily)
|
||||
{
|
||||
Q_UNUSED(missingFamily);
|
||||
|
||||
if (m_hasPopulatedAliases)
|
||||
return false;
|
||||
|
||||
QStringList families = QFontDatabase::families();
|
||||
for (const QString &family : families)
|
||||
populateFamily(family);
|
||||
m_hasPopulatedAliases = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
\brief Populates the font database using EnumFontFamiliesEx().
|
||||
|
||||
|
@ -25,6 +25,7 @@ class Q_GUI_EXPORT QWindowsFontDatabaseFT : public QFreeTypeFontDatabase
|
||||
{
|
||||
public:
|
||||
void populateFontDatabase() override;
|
||||
bool populateFamilyAliases(const QString &familyName) override;
|
||||
void populateFamily(const QString &familyName) override;
|
||||
QFontEngine *fontEngine(const QFontDef &fontDef, void *handle) override;
|
||||
QFontEngine *fontEngine(const QByteArray &fontData, qreal pixelSize,
|
||||
@ -36,6 +37,8 @@ public:
|
||||
|
||||
QString fontDir() const override;
|
||||
QFont defaultFont() const override;
|
||||
|
||||
bool m_hasPopulatedAliases = false;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
Loading…
x
Reference in New Issue
Block a user