Commit 4d47b18c authored by Eskil Abrahamsen Blomfeldt's avatar Eskil Abrahamsen Blomfeldt
Browse files

Revert "Support family names that end/start with space"

This reverts commit 7fd9ed32

.

While trimming the font name worked for cases with application fonts,
it actually introduced an assert for system fonts that ended with a
space, because enumerating these failed. So the original assumption
that all Windows APIs also trimmed the family name was wrong.

The original bug was that the font with the trailing space could
not be selected, but when using setFamilies(), it can. So there is
a perfectly fine way around the original bug when using a font that
has this problem. Therefore, no additional fix is needed for that.

[ChangeLog][Windows] Fixed an assert that happened when the system
had a font with a trailing or leading space in its name.

Pick-to: 5.15 6.1 6.2
Fixes: QTBUG-93885
Task-number: QTBUG-79140
Change-Id: I6d9df31a4f2c6555d38d51da374f69b6fb0f1ecb
Reviewed-by: default avatarLars Knoll <lars.knoll@qt.io>
parent 7ecb3d3f
......@@ -304,12 +304,10 @@ void QFontDatabasePrivate::invalidate()
emit static_cast<QGuiApplication *>(QCoreApplication::instance())->fontDatabaseChanged();
}
QtFontFamily *QFontDatabasePrivate::family(const QString &family, FamilyRequestFlags flags)
QtFontFamily *QFontDatabasePrivate::family(const QString &f, FamilyRequestFlags flags)
{
QtFontFamily *fam = nullptr;
const QString f = family.trimmed();
int low = 0;
int high = count;
int pos = count / 2;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment