mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-11 04:23:29 -08:00
[Fonts] Retire max font size setting into theme CardText min/max range (#7544)
* [Fonts] Retire max font size setting into theme CardText min/max range The per-card text size lives in the theme now, so a theme can pick the size it was designed for instead of every user overriding it globally. - CardText stores family + max point size; CardTextMinSize stores the overlay shrink-to-fit floor (omitted from fonts.toml when 1). - ThemeManager::cardTextMaxSize()/cardTextMinSize() resolve the range with the retired defaults (12 max, 1 min), and cardTextMaxSize() falls back to the CardText role size that #7541 made live. - The overlay widget starts at the explicit size when one is set (deck preview), else the theme max, and shrinks down to the theme floor. - The appearance page's "Maximum font size" spin is gone; the range is edited in the theme's font grid, whose min/max spins now keep the saved range consistent with each other. - Migration: appearance/maxFontSize is seeded into every user theme folder and into the active theme's folder (created when the theme is a shipped one that only exists in the system directory). The retired game/maxfontsize -> appearance/maxFontSize mapping stays, so users still on global.ini keep their value through the chain. * [Fonts] Resolve CardText sizes against the shipped theme Seeding themes/<name>/fonts.toml made getAvailableThemes() resolve the user dir, which shadowed the shipped theme.cfg and stylesheet: styleName came back empty and QSS was cleared. Fall back to the shipped theme dir for theme.cfg and QSS when the user dir exists, and resolve CardText sizes through FontConfig's 6..72 range so a migrated 80..100 renders at the size the editor shows. Insert CardTextMaxSize inside [Fonts] when another section follows. --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
16455c9fd5
commit
3d24597134
21 changed files with 1058 additions and 74 deletions
|
|
@ -92,6 +92,8 @@ public:
|
|||
static bool isDirReallyWritable(const QString &dirPath);
|
||||
// Explicit color scheme of the theme: theme.cfg's ColorScheme setting
|
||||
// (Dark/Light), falling back to the OS color scheme when it is "System".
|
||||
// A resolved directory that does not exist yet is an uncustomised stock
|
||||
// theme, so it follows the OS rather than the shipped scheme.
|
||||
bool isDarkMode(const QString &themeDirPath) const;
|
||||
// The resolved scheme of the currently active theme.
|
||||
bool isDarkModeActive() const
|
||||
|
|
@ -107,6 +109,20 @@ public:
|
|||
// Load the global theme settings (style + color scheme preference)
|
||||
static ThemeConfig loadGlobalConfig(const QString &themeDirPath);
|
||||
static bool saveGlobalConfig(const QString &themeDirPath, const ThemeConfig &cfg);
|
||||
// Load a theme's theme.cfg, falling back to the shipped (system) theme
|
||||
// directory when the resolved user directory does not carry one. A user
|
||||
// directory seeded with only fonts.toml would otherwise shadow the shipped
|
||||
// theme and lose its style and colour scheme.
|
||||
static ThemeConfig loadDefaultThemeConfig(const QString &themeDirPath, const QString &systemThemeDirPath);
|
||||
// Load the theme.cfg that decides the active colour scheme. Unlike
|
||||
// loadDefaultThemeConfig(), a resolved directory that does not exist yet is
|
||||
// a stock theme with no user override: it returns an empty config so the
|
||||
// caller follows the OS scheme instead of inheriting the shipped one.
|
||||
static ThemeConfig loadColorSchemeConfig(const QString &themeDirPath, const QString &systemThemeDirPath);
|
||||
// Resolve the theme stylesheet: the scheme-qualified style-<dark|light>.css
|
||||
// when shipped, else style.css, preferring the resolved (user) directory
|
||||
// over the shipped one. Empty when neither directory carries a stylesheet.
|
||||
static QString themeStyleSheetPath(const QString &themeDirPath, const QString &systemThemeDirPath, bool dark);
|
||||
|
||||
// Load/save per-scheme palette colors
|
||||
static PaletteConfig loadPaletteConfig(const QString &themeDirPath, const QString &colorScheme);
|
||||
|
|
@ -170,6 +186,12 @@ public:
|
|||
* "what this role resolves to" must use this, because appFont()
|
||||
* reflects a live preview while the editor is open. */
|
||||
QFont defaultAppFont(AppFont::Role role) const;
|
||||
/** @brief CardText max size resolved the way the font editor shows it:
|
||||
* stored CardTextMaxSize, else the CardText point size, else 12,
|
||||
* clamped to the editor's representable range. */
|
||||
int cardTextMaxSize() const;
|
||||
/** @brief CardText shrink-to-fit floor resolved the same way. */
|
||||
int cardTextMinSize() const;
|
||||
|
||||
QBrush &getBgBrush(Role zone);
|
||||
QBrush getExtraBgBrush(Role zone, int zoneId = 0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue