diff --git a/cockatrice/src/game_graphics/game_view.cpp b/cockatrice/src/game_graphics/game_view.cpp index 2f8af3e1b..7a51fc97f 100644 --- a/cockatrice/src/game_graphics/game_view.cpp +++ b/cockatrice/src/game_graphics/game_view.cpp @@ -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)); diff --git a/cockatrice/src/game_graphics/game_view.h b/cockatrice/src/game_graphics/game_view.h index 0fca224b2..99a73a0a8 100644 --- a/cockatrice/src/game_graphics/game_view.h +++ b/cockatrice/src/game_graphics/game_view.h @@ -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); diff --git a/cockatrice/src/interface/palette_editor/font_grid_widget.cpp b/cockatrice/src/interface/palette_editor/font_grid_widget.cpp index 67efa3dca..20451afbc 100644 --- a/cockatrice/src/interface/palette_editor/font_grid_widget.cpp +++ b/cockatrice/src/interface/palette_editor/font_grid_widget.cpp @@ -79,11 +79,12 @@ void FontGridWidget::loadFonts(const FontConfig &cfg) auto role = static_cast(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(); diff --git a/cockatrice/src/interface/palette_editor/palette_editor_dialog.cpp b/cockatrice/src/interface/palette_editor/palette_editor_dialog.cpp index 5e1e877be..42895d654 100644 --- a/cockatrice/src/interface/palette_editor/palette_editor_dialog.cpp +++ b/cockatrice/src/interface/palette_editor/palette_editor_dialog.cpp @@ -285,9 +285,7 @@ void PaletteEditorDialog::loadSchemes() void PaletteEditorDialog::loadFonts() { savedFontConfig = ThemeManager::loadDefaultFontConfig(themeDirPath, themeName); - fontGrid->blockSignals(true); fontGrid->loadFonts(savedFontConfig); - fontGrid->blockSignals(false); fontsDirty = false; } @@ -394,7 +392,6 @@ void PaletteEditorDialog::onSave() void PaletteEditorDialog::onReset() { - const bool hadFontPreview = fontsDirty; workingConfig[loadedScheme] = savedConfig[loadedScheme]; paletteGrid->loadPalette(savedConfig[loadedScheme]); // Restore the live theme before re-reading the grid: loadFonts resolves @@ -403,9 +400,6 @@ void PaletteEditorDialog::onReset() themeManager->reloadCurrentTheme(); fontGrid->loadFonts(savedFontConfig); fontsDirty = false; - if (hadFontPreview) { - themeManager->previewFonts(savedFontConfig); - } seedAccentFromScheme(loadedScheme); } diff --git a/cockatrice/src/interface/palette_editor/palette_editor_dialog.h b/cockatrice/src/interface/palette_editor/palette_editor_dialog.h index cf2321f80..5e47536b5 100644 --- a/cockatrice/src/interface/palette_editor/palette_editor_dialog.h +++ b/cockatrice/src/interface/palette_editor/palette_editor_dialog.h @@ -19,7 +19,6 @@ class FontGridWidget; class QuickSetupPanel; class QFrame; class QWidget; -class QCloseEvent; class PaletteEditorDialog : public QDialog { diff --git a/cockatrice/src/interface/theme_manager.cpp b/cockatrice/src/interface/theme_manager.cpp index c090eab7a..913a038be 100644 --- a/cockatrice/src/interface/theme_manager.cpp +++ b/cockatrice/src/interface/theme_manager.cpp @@ -657,23 +657,12 @@ 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) and - // every other role resolves to the app font. The surfaces that hardcoded a - // different family ask for it explicitly: counter painters through - // cardTextFont(), the deck view headers and printed deck list through - // deckListFont(). Only the family basis is fixed there; sizes stay - // caller-side. - 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 - // painters that used to hardcode Serif ask for it through cardTextFont(), - // and the two deck-list sites that did through deckListFont(). + // present: an unset role resolves to the application font. Surfaces that + // hardcoded a different family ask for it explicitly: counter painters + // through cardTextFont(), the deck view headers and printed deck list + // through deckListFont(), the report dialogs through + // report_utils::reportLogFont(). Only the family basis is fixed there; + // sizes stay caller-side. return qApp->font(); }