mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-05 09:33:25 -08:00
[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:
parent
1bdd43d921
commit
4e78edf794
7 changed files with 42 additions and 38 deletions
|
|
@ -660,17 +660,9 @@ QFont ThemeManager::appFont(AppFont::Role role) const
|
|||
}
|
||||
|
||||
// Role fallbacks preserve the pre-theme defaults when no fonts.toml is
|
||||
// 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;
|
||||
}
|
||||
// present: card text starts from a serif basis, everything else from the
|
||||
// application font. The report dialogs that used to hardcode monospace ask
|
||||
// for it explicitly (report_utils::reportLogFont).
|
||||
if (role == AppFont::CardText) {
|
||||
return QFont(QStringLiteral("Serif"));
|
||||
}
|
||||
|
|
@ -680,6 +672,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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue