CoreText: Avoid populating font family aliases if family was populated

When trying to match a font request to fonts in the database we might
end up with a mismatch due to the style not being available, but the
font family itself was.

If that's the case there's no point in trying to populate font aliases.

Fixes: QTBUG-98369
Fixes: QTBUG-99216
Pick-to: 6.3 6.2 5.15
Change-Id: I8776e5b89588a13749c9c7e414c5bfac86feab58
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
This commit is contained in:
Tor Arne Vestbø 2022-03-30 12:32:05 +02:00
parent b01ee1d44c
commit 64dd5a8183

View File

@ -151,6 +151,12 @@ void QCoreTextFontDatabase::populateFontDatabase()
bool QCoreTextFontDatabase::populateFamilyAliases(const QString &missingFamily)
{
#if defined(Q_OS_MACOS)
if (isFamilyPopulated(missingFamily)) {
// We got here because one of the other properties of the font mismatched,
// for example the style, so there's no point in populating font aliases.
return false;
}
if (m_hasPopulatedAliases)
return false;