mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-09 11:33:25 -08:00
Compare commits
8 commits
4b616a17e8
...
e834339c71
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e834339c71 | ||
|
|
70f0f14665 | ||
|
|
e23efebd71 | ||
|
|
7b3d43c4ea | ||
|
|
0ff2c4e246 | ||
|
|
bbf055c483 | ||
|
|
eeb5cfc333 | ||
|
|
7472f69f01 |
5 changed files with 14 additions and 23 deletions
|
|
@ -117,11 +117,10 @@ GameView::GameView(GameScene *scene, QWidget *parent) : QGraphicsView(scene, par
|
|||
tallyLayout->setSpacing(2);
|
||||
tallyContainer->hide();
|
||||
|
||||
applyDeckListFont();
|
||||
connect(themeManager, &ThemeManager::fontsChanged, this, &GameView::applyDeckListFont);
|
||||
applyDeckOverlayFonts();
|
||||
}
|
||||
|
||||
void GameView::applyDeckListFont()
|
||||
void GameView::applyDeckOverlayFonts()
|
||||
{
|
||||
dragCountLabel->setFont(deckOverlayFont(14, true));
|
||||
totalCountLabel->setFont(deckOverlayFont(16, true));
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ private slots:
|
|||
void refreshShortcuts();
|
||||
void updateTotalSelectionCount(const QSize &viewSize = QSize());
|
||||
void setFocusDisabled(bool disabled);
|
||||
void applyDeckListFont();
|
||||
void applyDeckOverlayFonts();
|
||||
public slots:
|
||||
void updateSceneRect(const QRectF &rect);
|
||||
|
||||
|
|
|
|||
|
|
@ -76,11 +76,12 @@ void FontGridWidget::loadFonts(const FontConfig &cfg)
|
|||
auto role = static_cast<AppFont::Role>(fontEnum.value(i));
|
||||
const FontRow &row = fontRows[role];
|
||||
|
||||
// Roles absent from the file resolve to the startup font, not to the
|
||||
// live preview: appFont() would return the previewed config, so Reset
|
||||
// and a first load would both show the edited font instead of the
|
||||
// theme's real default.
|
||||
const QFont font = cfg.fonts.value(role, themeManager->defaultAppFont(role));
|
||||
// Roles absent from the file resolve the same way the runtime does: an unset
|
||||
// role falls back to the config's InterfaceDefault, and only then to the
|
||||
// startup font. appFont() would return the live preview instead, so Reset and
|
||||
// a first load must not measure against it.
|
||||
const QFont fallback = cfg.fonts.value(AppFont::InterfaceDefault, themeManager->defaultAppFont(role));
|
||||
const QFont font = cfg.fonts.value(role, fallback);
|
||||
row.familyCombo->setCurrentFont(font);
|
||||
|
||||
int size = font.pointSize();
|
||||
|
|
|
|||
|
|
@ -657,17 +657,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) {
|
||||
// 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();
|
||||
}
|
||||
// No per-role scaling: an unset role resolves to the application font, so
|
||||
// with no fonts.toml present the result is identical to before. The counter
|
||||
// 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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -150,9 +150,8 @@ public:
|
|||
// when present, otherwise a palette-accent-derived fallback.
|
||||
QColor appColor(AppColor::Role role) const;
|
||||
/** @brief Resolves an application font role: the theme's stored [Fonts]
|
||||
* value when present, otherwise a per-role fallback (monospace for
|
||||
* ChatLog, serif basis for CardText, the application font for the
|
||||
* remaining roles). */
|
||||
* value when present, otherwise a per-role fallback (serif basis
|
||||
* for CardText, the application font for the remaining roles). */
|
||||
QFont appFont(AppFont::Role role) const;
|
||||
/** @brief Whether the active theme defines this role in fonts.toml. */
|
||||
bool hasAppFont(AppFont::Role role) const;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue