From efdc82c823ac9e197c5342f78430d2b0368094de Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sun, 18 Sep 2022 17:02:22 +0400 Subject: [PATCH] Add Cascadia Code as preferred monospace font And switch macOS to system monospace font as Cascadia Code is more likely to be installed by the user --- ui/style/style_core_font.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ui/style/style_core_font.cpp b/ui/style/style_core_font.cpp index 3df73c8..c488a0a 100644 --- a/ui/style/style_core_font.cpp +++ b/ui/style/style_core_font.cpp @@ -98,6 +98,7 @@ bool LoadCustomFont(const QString &filePath, const QString &familyName, int flag [[nodiscard]] QString ManualMonospaceFont() { const auto kTryFirst = std::initializer_list{ + "Cascadia Code", "Consolas", "Liberation Mono", "Menlo", @@ -259,15 +260,15 @@ QString MonospaceFont() { const auto manual = ManualMonospaceFont(); const auto system = SystemMonospaceFont(); -#if defined Q_OS_WIN || defined Q_OS_MAC +#ifdef Q_OS_WIN // Prefer our monospace font. const auto useSystem = manual.isEmpty(); -#else // Q_OS_WIN || Q_OS_MAC +#else // Q_OS_WIN // Prefer system monospace font. const auto metrics = QFontMetrics(QFont(system)); const auto useSystem = manual.isEmpty() || (metrics.horizontalAdvance(QChar('i')) == metrics.horizontalAdvance(QChar('W'))); -#endif // Q_OS_WIN || Q_OS_MAC +#endif // Q_OS_WIN return useSystem ? system : manual; }();