QFontDatabase: Track empty slots in application font list via file name
This allows us to use the properties of the application font as a way to distinguish whether the font has been populated or not. Change-Id: Iccce32b23c1b987f2f75fef955227bddc2495fa3 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
This commit is contained in:
parent
c159546401
commit
88c0a317ec
@ -1296,10 +1296,9 @@ QFontDatabasePrivate *QFontDatabasePrivate::ensureFontDatabase()
|
||||
auto *platformFontDatabase = QGuiApplicationPrivate::platformIntegration()->fontDatabase();
|
||||
platformFontDatabase->populateFontDatabase();
|
||||
for (int i = 0; i < d->applicationFonts.count(); i++) {
|
||||
if (!d->applicationFonts.at(i).properties.isEmpty()) {
|
||||
auto *font = &d->applicationFonts[i];
|
||||
auto *font = &d->applicationFonts[i];
|
||||
if (!font->isNull())
|
||||
platformFontDatabase->addApplicationFont(font->data, font->fileName, font);
|
||||
}
|
||||
}
|
||||
}
|
||||
return d;
|
||||
@ -2107,7 +2106,7 @@ int QFontDatabasePrivate::addAppFont(const QByteArray &fontData, const QString &
|
||||
|
||||
int i;
|
||||
for (i = 0; i < applicationFonts.count(); ++i)
|
||||
if (applicationFonts.at(i).properties.isEmpty())
|
||||
if (applicationFonts.at(i).isNull())
|
||||
break;
|
||||
if (i >= applicationFonts.count()) {
|
||||
applicationFonts.append(ApplicationFont());
|
||||
|
@ -244,6 +244,8 @@ public:
|
||||
QString fileName;
|
||||
QByteArray data;
|
||||
|
||||
bool isNull() const { return fileName.isEmpty(); }
|
||||
|
||||
struct Properties {
|
||||
QString familyName;
|
||||
QString styleName;
|
||||
|
Loading…
Reference in New Issue
Block a user