From fa4a1bad42fc6282b72e17d2bbcab305975b42a0 Mon Sep 17 00:00:00 2001 From: Andrew Janke Date: Sat, 9 Mar 2019 19:04:32 -0500 Subject: [PATCH] Fix default font on macOS Qt does not support fontconfig on macOS, so we need to work around it and provide a "real" font family name for the default font. Otherwise, "Monospace" will be unrecognized and it will fall back to a variable-width font. --- lib/qtermwidget.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/qtermwidget.cpp b/lib/qtermwidget.cpp index 5c3e56f..4a5172a 100644 --- a/lib/qtermwidget.cpp +++ b/lib/qtermwidget.cpp @@ -33,6 +33,12 @@ #include "SearchBar.h" #include "qtermwidget.h" +#ifdef Q_OS_MACOS +// Qt does not support fontconfig on macOS, so we need to use a "real" font name. +#define DEFAULT_FONT_FAMILY "Menlo" +#else +#define DEFAULT_FONT_FAMILY "Monospace" +#endif #define STEP_ZOOM 1 @@ -321,7 +327,7 @@ void QTermWidget::init(int startnow) // m_impl->m_terminalDisplay->setSize(80, 40); QFont font = QApplication::font(); - font.setFamily(QLatin1String("Monospace")); + font.setFamily(QLatin1String(DEFAULT_FONT_FAMILY)); font.setPointSize(10); font.setStyleHint(QFont::TypeWriter); setTerminalFont(font);