Windows: Use the first entry in the requested families if available

If the font request has the families list set then it should use the
first entry in that if the face name is empty as this will be more
accurate than just the whole family setting which may contain a
comma separated list of family names.

Fixes: QTBUG-75333
Change-Id: Iccc9cde741544af5263cb318da56178adf34299b
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
This commit is contained in:
Andy Shaw 2019-05-27 23:02:23 +02:00
parent 87ca7c9688
commit 825b474363

View File

@ -1818,7 +1818,7 @@ LOGFONT QWindowsFontDatabase::fontDefToLOGFONT(const QFontDef &request, const QS
QString fam = faceName;
if (fam.isEmpty())
fam = request.family;
fam = request.families.size() > 0 ? request.families.at(0) : request.family;
if (Q_UNLIKELY(fam.size() >= LF_FACESIZE)) {
qCritical("%s: Family name '%s' is too long.", __FUNCTION__, qPrintable(fam));
fam.truncate(LF_FACESIZE - 1);