From d8602ce58b6ef268be84b9aa0166b0c3fa6a96e8 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Mon, 19 Oct 2020 11:39:24 +0200 Subject: QFont: Prefer setFamilies() over setFamily() By depending on setFamilies() then we can be sure that font names with spaces, commas, quotes and so on are correctly handled without being misinterpreted. For now it will split on the comma when a string containing one is passed to setFamily. But from Qt 6.2 this will be removed to preserve the family string as a convenience function. [ChangeLog][QtGui][QFont] Indicated that setFamilies/families is preferred over setFamily/family to ensure that font family names are preserved when spaces, commas and so on are used in the name. Change-Id: Id3c1a4e827756a4c928fed461a4aafa5a0f06633 Reviewed-by: Qt CI Bot Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/text/unix/qfontconfigdatabase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gui/text/unix/qfontconfigdatabase.cpp') diff --git a/src/gui/text/unix/qfontconfigdatabase.cpp b/src/gui/text/unix/qfontconfigdatabase.cpp index a8e28618f4..dff11eb172 100644 --- a/src/gui/text/unix/qfontconfigdatabase.cpp +++ b/src/gui/text/unix/qfontconfigdatabase.cpp @@ -973,7 +973,7 @@ void QFontconfigDatabase::setupFontEngine(QFontEngineFT *engine, const QFontDef FcValue value; value.type = FcTypeString; - QByteArray cs = fontDef.family.toUtf8(); + QByteArray cs = fontDef.families.first().toUtf8(); value.u.s = (const FcChar8 *)cs.data(); FcPatternAdd(pattern,FC_FAMILY,value,true); -- cgit v1.2.3