Skip to content

Commit 7b4e6a1

Browse files
authored
fixing fixed width fonts in Qt6 (#887)
1 parent 63454e9 commit 7b4e6a1

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/Font.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,17 @@ QFont fromString(const QString &fontName) {
1414
QFont font;
1515
font.fromString(fontName);
1616
font.setStyleName(QString());
17-
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
17+
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
18+
QT_WARNING_PUSH
19+
QT_WARNING_DISABLE_DEPRECATED
20+
// NOTE(eteran): unfortunately, this line seems to matter
21+
// despite being marked as deprecated, and Qt doesn't suggest
22+
// a meaningful alternative
1823
font.setStyleStrategy(QFont::ForceIntegerMetrics);
24+
QT_WARNING_POP
25+
#else
26+
font.setHintingPreference(QFont::PreferFullHinting);
27+
font.setStyleStrategy(QFont::NoFontMerging);
1928
#endif
2029
return font;
2130
}

0 commit comments

Comments
 (0)