mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-06 01:53:25 -08:00
[Fonts] Restore DeckList Serif default and live-update all role readers (#7541)
* [Fonts] Restore DeckList Serif default and live-update all role readers * [Fonts] Keep the DeckList fallback on the application font DeckList is read by the deck editor headers, the filter tree and the deck view too, not only by the two surfaces that hardcoded Serif. Resolving the unset role to Serif in appFont() made every user without a fonts.toml see Serif outside the deck list. - appFont(DeckList) falls back to the application font again. - ThemeManager::deckListFont() resolves the role and keeps the Serif fallback for the two historical sites: the deck view zone headers and the printed deck list. - DeckView no longer repaints its viewport on fontsChanged; touching the scene items already schedules the repaint in every attached view. --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
13e7a3baaf
commit
a791389c6a
18 changed files with 140 additions and 18 deletions
|
|
@ -581,7 +581,7 @@ void DeckLoader::printDeckListNode(QTextCursor *cursor, const InnerDecklistNode
|
|||
QTextBlockFormat blockFormat;
|
||||
QTextCharFormat charFormat;
|
||||
// Family comes from the DeckList theme role; sizes/weights unchanged.
|
||||
charFormat.setFontFamilies({themeManager->appFont(AppFont::DeckList).family()});
|
||||
charFormat.setFontFamilies({themeManager->deckListFont().family()});
|
||||
charFormat.setFontPointSize(11);
|
||||
charFormat.setFontWeight(QFont::Bold);
|
||||
cursor->insertBlock(blockFormat, charFormat);
|
||||
|
|
@ -595,7 +595,7 @@ void DeckLoader::printDeckListNode(QTextCursor *cursor, const InnerDecklistNode
|
|||
const AbstractDecklistCardNode *card = cards[i];
|
||||
|
||||
QTextCharFormat cellCharFormat;
|
||||
cellCharFormat.setFontFamilies({themeManager->appFont(AppFont::DeckList).family()});
|
||||
cellCharFormat.setFontFamilies({themeManager->deckListFont().family()});
|
||||
cellCharFormat.setFontPointSize(9);
|
||||
|
||||
QTextTableCell cell = table->cellAt(i, 0);
|
||||
|
|
@ -617,7 +617,7 @@ void DeckLoader::printDeckListNode(QTextCursor *cursor, const InnerDecklistNode
|
|||
|
||||
QTextBlockFormat blockFormat;
|
||||
QTextCharFormat charFormat;
|
||||
charFormat.setFontFamilies({themeManager->appFont(AppFont::DeckList).family()});
|
||||
charFormat.setFontFamilies({themeManager->deckListFont().family()});
|
||||
charFormat.setFontPointSize(14);
|
||||
charFormat.setFontWeight(QFont::Bold);
|
||||
|
||||
|
|
@ -646,15 +646,17 @@ void DeckLoader::printDeckList(QPrinter *printer, const DeckList &deckList)
|
|||
QTextDocument doc;
|
||||
|
||||
// Family comes from the DeckList theme role; the print sizes/weights below stay unchanged.
|
||||
QFont font = themeManager->appFont(AppFont::DeckList);
|
||||
font.setStyleHint(QFont::Serif);
|
||||
// Print output is a one-shot snapshot and intentionally does not subscribe
|
||||
// to fontsChanged (there is no live view to repaint); reprinting picks up
|
||||
// the current role font.
|
||||
QFont font = themeManager->deckListFont();
|
||||
doc.setDefaultFont(font);
|
||||
|
||||
QTextCursor cursor(&doc);
|
||||
|
||||
QTextBlockFormat headerBlockFormat;
|
||||
QTextCharFormat headerCharFormat;
|
||||
headerCharFormat.setFontFamilies({themeManager->appFont(AppFont::DeckList).family()});
|
||||
headerCharFormat.setFontFamilies({themeManager->deckListFont().family()});
|
||||
headerCharFormat.setFontPointSize(16);
|
||||
headerCharFormat.setFontWeight(QFont::Bold);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue