forked from qt-creator/qt-creator
Utils: Support "Inter Variable" as design font
Qt 6.7 supports variable fonts. The variable variant of "Inter" has "Inter Variable" as family name. Change-Id: I3d91fa46da48106169183ea30e33b8e1e81caae6 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include "stylehelper.h"
|
#include "stylehelper.h"
|
||||||
|
|
||||||
|
#include "algorithm.h"
|
||||||
#include "theme/theme.h"
|
#include "theme/theme.h"
|
||||||
#include "hostosinfo.h"
|
#include "hostosinfo.h"
|
||||||
#include "qtcassert.h"
|
#include "qtcassert.h"
|
||||||
@@ -917,9 +918,10 @@ QColor StyleHelper::ensureReadableOn(const QColor &background, const QColor &des
|
|||||||
static const QStringList &applicationFontFamilies()
|
static const QStringList &applicationFontFamilies()
|
||||||
{
|
{
|
||||||
const static QStringList families = [] {
|
const static QStringList families = [] {
|
||||||
const QLatin1String familyName("Inter");
|
|
||||||
// Font is either installed in the system, or was loaded from share/qtcreator/fonts/
|
// Font is either installed in the system, or was loaded from share/qtcreator/fonts/
|
||||||
return QFontDatabase::hasFamily(familyName) ? QStringList(familyName) : QStringList();
|
const QStringList candidates = {"Inter", "Inter Variable"};
|
||||||
|
const QString family = Utils::findOrDefault(candidates, &QFontDatabase::hasFamily);
|
||||||
|
return family.isEmpty() ? QStringList() : QStringList(family);
|
||||||
}();
|
}();
|
||||||
return families;
|
return families;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user