Skip to content

Commit

Permalink
Rebuild font setting
Browse files Browse the repository at this point in the history
  • Loading branch information
Ross Nicoll committed Oct 31, 2021
1 parent 7395f24 commit 5d2ab77
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 18 deletions.
39 changes: 24 additions & 15 deletions src/qt/bitcoingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,30 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformSty
move(QGuiApplication::primaryScreen()->availableGeometry().center() - frameGeometry().center());
}

QFontDatabase database;
QString family = "Comic Sans MS";
if (!database.families().contains(family)) {
// Dogecoin: load fallback font in case Comic Sans is not availble on the system
int id = QFontDatabase::addApplicationFont(":fonts/ComicNeue-Regular");
if (id < 0) {
LogPrintf("Qt failed to load ComicNeue-Regular font\n");
} else {
family = QFontDatabase::applicationFontFamilies(id).at(0);
}
QFontDatabase::addApplicationFont(":fonts/ComicNeue-Regular-Oblique");
QFontDatabase::addApplicationFont(":fonts/ComicNeue-Bold");
QFontDatabase::addApplicationFont(":fonts/ComicNeue-Bold-Oblique");
QFontDatabase::addApplicationFont(":fonts/ComicNeue-Light");
QFontDatabase::addApplicationFont(":fonts/ComicNeue-Light-Oblique");
QFont::insertSubstitution("Comic Sans MS", family);
}

// Dogecoin: Specify Comic Neue as new font.
QFont newFont(family, 10);

// Dogecoin: Set new application font
QApplication::setFont(newFont);

#ifdef ENABLE_WALLET
enableWallet = WalletModel::isWalletEnabled();
#endif // ENABLE_WALLET
Expand Down Expand Up @@ -115,21 +139,6 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformSty

modalOverlay = new ModalOverlay(enableWallet, this->centralWidget());

// Dogecoin: load fallback font in case Comic Sans is not availble on the system
QFontDatabase::addApplicationFont(":fonts/ComicNeue-Bold");
QFontDatabase::addApplicationFont(":fonts/ComicNeue-Bold-Oblique");
QFontDatabase::addApplicationFont(":fonts/ComicNeue-Light");
QFontDatabase::addApplicationFont(":fonts/ComicNeue-Light-Oblique");
QFontDatabase::addApplicationFont(":fonts/ComicNeue-Regular");
QFontDatabase::addApplicationFont(":fonts/ComicNeue-Regular-Oblique");
QFont::insertSubstitution("Comic Sans MS", "Comic Neue");

// Dogecoin: Specify Comic Sans as new font.
QFont newFont("Comic Sans MS", 10);

// Dogecoin: Set new application font
QApplication::setFont(newFont);

// Accept D&D of URIs
setAcceptDrops(true);

Expand Down
2 changes: 1 addition & 1 deletion src/qt/forms/intro.ui
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<item>
<widget class="QLabel" name="welcomeLabel">
<property name="styleSheet">
<string notr="true">QLabel { font-style:italic; }</string>
<string notr="true">QLabel { font-family: Comic Neue; font-style:italic; }</string>
</property>
<property name="text">
<string>Welcome to %1.</string>
Expand Down
2 changes: 1 addition & 1 deletion src/qt/splashscreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ SplashScreen::SplashScreen(Qt::WindowFlags f, const NetworkStyle *networkStyle)
QString copyrightText = QString::fromUtf8(CopyrightHolders(strprintf("\xc2\xA9 %u-%u ", 2009, COPYRIGHT_YEAR)).c_str());
QString titleAddText = networkStyle->getTitleAddText();

QString font = "Comic Sans MS";
QString font = QApplication::font().toString();

// create a bitmap according to device pixelratio
QSize splashSize(480*devicePixelRatio,320*devicePixelRatio);
Expand Down
2 changes: 1 addition & 1 deletion src/qt/transactiondesc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ QString TransactionDesc::toHTML(interfaces::Node& node, interfaces::Wallet& wall
QString strHTML;

strHTML.reserve(4000);
strHTML += "<html><font face='verdana, arial, helvetica, sans-serif'>";
strHTML += "<html><font face='comic sans ms, comic neue, verdana, arial, helvetica, sans-serif'>";

int64_t nTime = wtx.time;
CAmount nCredit = wtx.credit;
Expand Down

0 comments on commit 5d2ab77

Please sign in to comment.