[Fonts] Keep CardText call sites on the app font and fix px sizes

- CardText's unset fallback is qApp->font() again: only the three counter
  painters (paintNumberEllipse, GeneralCounter, PlayerCounter) were Serif
  before the role existed, and they now ask for it through
  ThemeManager::cardTextFont(). Card names, player names, counters, the
  overlay, the Archidekt and EDHREC labels and the completer delegate keep the
  app font they used before.
- Use setPixelSize for the EDHREC card name (20px) and commander name (28px)
  and details (16px) sizes: the stylesheets said px, and setPointSize made
  them about a third larger.
This commit is contained in:
Lukas Brübach 2026-11-01 14:12:35 +01:00
parent 2593824e93
commit a7e151d871
7 changed files with 28 additions and 18 deletions

View file

@ -660,15 +660,10 @@ QFont ThemeManager::appFont(AppFont::Role role) const
}
// Role fallbacks preserve the pre-theme defaults when no fonts.toml is
// 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"));
}
// No per-role scaling: every other unset role resolves to the application
// font, so with no fonts.toml present the result is identical to before.
// present: an unset role resolves to the application font, so the result is
// identical to before. The report dialogs that used to hardcode monospace
// ask for it explicitly (report_utils::reportLogFont), and the counter
// painters that used to hardcode Serif ask for it through cardTextFont().
return qApp->font();
}
@ -677,6 +672,16 @@ bool ThemeManager::hasAppFont(AppFont::Role role) const
return currentFonts.fonts.contains(role);
}
QFont ThemeManager::cardTextFont() const
{
if (hasAppFont(AppFont::CardText)) {
return appFont(AppFont::CardText);
}
QFont serifFont(QStringLiteral("Serif"));
serifFont.setStyleHint(QFont::Serif);
return serifFont;
}
QFont ThemeManager::defaultAppFont(AppFont::Role /*role*/) const
{
// No per-role scaling and no preview: an unset role resolves to the font