[Fonts] Keep ChatView on the app font and share the report log font

- ChatLog's unset fallback is qApp->font() again: ChatView never set a font
  before the role existed, so an unset role must not switch chat and the game
  log to monospace at the system GeneralFont size.
- Move the monospace fallback the report dialogs used before into
  report_utils::reportLogFont(), which returns the theme's ChatLog role when it
  is set and the old monospace otherwise. tab_report, dlg_my_reports and
  dlg_report_user now share it, so they cannot drift and they honour a themed
  size instead of overriding it.
This commit is contained in:
Lukas Brübach 2026-11-01 14:06:05 +01:00
parent 2a3a31c24c
commit 145f7adf73
7 changed files with 39 additions and 34 deletions

View file

@ -660,13 +660,11 @@ QFont ThemeManager::appFont(AppFont::Role role) const
// present: chat logs rendered monospace (matching the report dialogs),
// card text from a serif basis, everything else from the app font.
if (role == AppFont::ChatLog) {
QFont monoFont(QStringLiteral("monospace"));
monoFont.setStyleHint(QFont::Monospace);
const int systemPointSize = QFontDatabase::systemFont(QFontDatabase::GeneralFont).pointSize();
if (systemPointSize > 0) {
monoFont.setPointSize(systemPointSize);
}
return monoFont;
// ChatView never set a font before the theme role existed, so an unset
// ChatLog must keep resolving to the application font. The report
// dialogs that used to hardcode monospace ask for it explicitly
// (report_utils::reportLogFont) instead of through this fallback.
return qApp->font();
}
if (role == AppFont::CardText) {
return QFont(QStringLiteral("Serif"));
@ -677,6 +675,11 @@ QFont ThemeManager::appFont(AppFont::Role role) const
return qApp->font();
}
bool ThemeManager::hasAppFont(AppFont::Role role) const
{
return currentFonts.fonts.contains(role);
}
QFont ThemeManager::defaultAppFont(AppFont::Role /*role*/) const
{
// No per-role scaling and no preview: an unset role resolves to the font