Skip to content

Commit 0e0cf44

Browse files
authored
Merge pull request #476 from RavenProject/font_test
OS X Font workaround
2 parents e358172 + aa3c3f0 commit 0e0cf44

File tree

3 files changed

+30
-2
lines changed

3 files changed

+30
-2
lines changed

src/qt/guiutil.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,9 @@ namespace GUIUtil {
8686
QFont getSubLabelFont()
8787
{
8888
QFont labelSubFont;
89+
#if !defined(Q_OS_MAC)
8990
labelSubFont.setFamily("Open Sans");
91+
#endif
9092
labelSubFont.setWeight(QFont::Weight::ExtraLight);
9193
labelSubFont.setLetterSpacing(QFont::SpacingType::AbsoluteSpacing, -0.6);
9294
labelSubFont.setPixelSize(14);
@@ -96,7 +98,9 @@ QFont getSubLabelFont()
9698
QFont getSubLabelFontBolded()
9799
{
98100
QFont labelSubFont;
101+
#if !defined(Q_OS_MAC)
99102
labelSubFont.setFamily("Open Sans");
103+
#endif
100104
labelSubFont.setWeight(QFont::Weight::Bold);
101105
labelSubFont.setLetterSpacing(QFont::SpacingType::AbsoluteSpacing, -0.6);
102106
labelSubFont.setPixelSize(14);
@@ -106,7 +110,9 @@ QFont getSubLabelFontBolded()
106110
QFont getTopLabelFontBolded()
107111
{
108112
QFont labelTopFont;
113+
#if !defined(Q_OS_MAC)
109114
labelTopFont.setFamily("Open Sans");
115+
#endif
110116
labelTopFont.setWeight(QFont::Weight::Bold);
111117
labelTopFont.setLetterSpacing(QFont::SpacingType::AbsoluteSpacing, -0.6);
112118
labelTopFont.setPixelSize(18);
@@ -116,7 +122,9 @@ QFont getTopLabelFontBolded()
116122
QFont getTopLabelFont(int weight, int pxsize)
117123
{
118124
QFont labelTopFont;
125+
#if !defined(Q_OS_MAC)
119126
labelTopFont.setFamily("Open Sans");
127+
#endif
120128
labelTopFont.setWeight(weight);
121129
labelTopFont.setLetterSpacing(QFont::SpacingType::AbsoluteSpacing, -0.6);
122130
labelTopFont.setPixelSize(pxsize);
@@ -126,7 +134,9 @@ QFont getTopLabelFont(int weight, int pxsize)
126134
QFont getTopLabelFont()
127135
{
128136
QFont labelTopFont;
137+
#if !defined(Q_OS_MAC)
129138
labelTopFont.setFamily("Open Sans");
139+
#endif
130140
labelTopFont.setWeight(QFont::Weight::Light);
131141
labelTopFont.setLetterSpacing(QFont::SpacingType::AbsoluteSpacing, -0.6);
132142
labelTopFont.setPixelSize(18);

src/qt/overviewpage.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,14 +216,18 @@ Q_OBJECT
216216

217217
/** Create the font that is used for painting the asset name */
218218
QFont nameFont;
219+
#if !defined(Q_OS_MAC)
219220
nameFont.setFamily("Open Sans");
221+
#endif
220222
nameFont.setPixelSize(18);
221223
nameFont.setWeight(QFont::Weight::Normal);
222224
nameFont.setLetterSpacing(QFont::SpacingType::AbsoluteSpacing, -0.4);
223225

224226
/** Create the font that is used for painting the asset amount */
225227
QFont amountFont;
228+
#if !defined(Q_OS_MAC)
226229
amountFont.setFamily("Open Sans");
230+
#endif
227231
amountFont.setPixelSize(14);
228232
amountFont.setWeight(QFont::Weight::Normal);
229233
amountFont.setLetterSpacing(QFont::SpacingType::AbsoluteSpacing, -0.3);

src/qt/ravengui.cpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,9 @@ RavenGUI::RavenGUI(const PlatformStyle *_platformStyle, const NetworkStyle *netw
212212

213213
loadFonts();
214214

215+
#if !defined(Q_OS_MAC)
215216
this->setFont(QFont("Open Sans"));
217+
#endif
216218

217219
// Create actions for the toolbar, menu bar and tray/dock icon
218220
// Needs walletFrame to be initialized
@@ -341,7 +343,9 @@ void RavenGUI::createActions()
341343
QFont font = QFont();
342344
font.setPixelSize(22);
343345
font.setLetterSpacing(QFont::SpacingType::AbsoluteSpacing, -0.43);
346+
#if !defined(Q_OS_MAC)
344347
font.setFamily("Open Sans");
348+
#endif
345349
font.setWeight(QFont::Weight::ExtraLight);
346350

347351
QActionGroup *tabGroup = new QActionGroup(this);
@@ -608,16 +612,26 @@ void RavenGUI::createToolBars()
608612
// toolbar->addAction(messagingAction);
609613
// toolbar->addAction(votingAction);
610614

615+
QString openSansFontString = "font: normal 22pt \"Open Sans\";";
616+
QString normalString = "font: normal 22pt \"Arial\";";
617+
QString stringToUse = "";
618+
619+
#if !defined(Q_OS_MAC)
620+
stringToUse = openSansFontString;
621+
#else
622+
stringToUse = normalString;
623+
#endif
624+
611625
/** RVN START */
612626
QString tbStyleSheet = ".QToolBar {background-color : transparent; border-color: transparent; } "
613627
".QToolButton {background-color: transparent; border-color: transparent; width: 249px; color: %1; border: none;} "
614-
".QToolButton:checked {background: none; background-color: none; selection-background-color: none; color: %2; border: none; font: normal 22pt \"Open Sans\";} "
628+
".QToolButton:checked {background: none; background-color: none; selection-background-color: none; color: %2; border: none; font: %4} "
615629
".QToolButton:hover {background: none; background-color: none; border: none; color: %3;} "
616630
".QToolButton:disabled {color: gray;}";
617631

618632
toolbar->setStyleSheet(tbStyleSheet.arg(platformStyle->ToolBarNotSelectedTextColor().name(),
619633
platformStyle->ToolBarSelectedTextColor().name(),
620-
platformStyle->DarkOrangeColor().name()));
634+
platformStyle->DarkOrangeColor().name(), stringToUse));
621635

622636
toolbar->setOrientation(Qt::Vertical);
623637
toolbar->setIconSize(QSize(40, 40));

0 commit comments

Comments
 (0)