From 7fcfaa9dd56136b9eb9e9f0ecf7aa7fe6321f74f Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sun, 28 Apr 2024 17:06:07 +0400 Subject: [PATCH] Detect the lack of semibold style --- ui/style/style_core_font.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ui/style/style_core_font.cpp b/ui/style/style_core_font.cpp index b290c5b..91b33cd 100644 --- a/ui/style/style_core_font.cpp +++ b/ui/style/style_core_font.cpp @@ -227,6 +227,14 @@ bool LoadCustomFont(const QString &filePath) { result.setWeight(((flags & FontBold) || (flags & FontSemibold)) ? QFont::DemiBold : QFont::Normal); + if (result.bold()) { + const auto style = QFontInfo(result).styleName(); + if (!style.isEmpty() && !style.startsWith( + "Semibold", + Qt::CaseInsensitive)) { + result.setBold(true); + } + } result.setItalic(flags & FontItalic); result.setUnderline(flags & FontUnderline); result.setStrikeOut(flags & FontStrikeOut);