Qt: Start with a new QFont in setMonospaceFont

Always start with a new mono_font_ when setting the default font in
setMonospaceFont(), both when font_string is not given and when the
font name does not exist.

On macOS this will avoid getting .AppleSystemUIFont, which is not
a monospace font and not what we want.
This commit is contained in:
Stig Bjørlykke 2023-05-28 21:36:20 +02:00 committed by Gerald Combs
parent 25e01c6732
commit b0c582a82f
1 changed files with 1 additions and 2 deletions

View File

@ -382,9 +382,8 @@ void MainApplication::setMonospaceFont(const char *font_string) {
substitutes << x11_alt_fonts << win_default_font << win_alt_font << osx_default_font << osx_alt_fonts << fallback_fonts;
#endif // Q_OS
mono_font_.setFamily(default_font);
mono_font_ = QFont(default_font, mainApp->font().pointSize() + font_size_adjust);
mono_font_.insertSubstitutions(default_font, substitutes);
mono_font_.setPointSize(mainApp->font().pointSize() + font_size_adjust);
mono_font_.setBold(false);
// Retrieve the effective font and apply it.