Skip to content

Commit

Permalink
Merge pull request #476 from RavenProject/font_test
Browse files Browse the repository at this point in the history
OS X Font workaround
  • Loading branch information
cfrogjump authored Dec 11, 2018
2 parents e358172 + aa3c3f0 commit 0e0cf44
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
10 changes: 10 additions & 0 deletions src/qt/guiutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ namespace GUIUtil {
QFont getSubLabelFont()
{
QFont labelSubFont;
#if !defined(Q_OS_MAC)
labelSubFont.setFamily("Open Sans");
#endif
labelSubFont.setWeight(QFont::Weight::ExtraLight);
labelSubFont.setLetterSpacing(QFont::SpacingType::AbsoluteSpacing, -0.6);
labelSubFont.setPixelSize(14);
Expand All @@ -96,7 +98,9 @@ QFont getSubLabelFont()
QFont getSubLabelFontBolded()
{
QFont labelSubFont;
#if !defined(Q_OS_MAC)
labelSubFont.setFamily("Open Sans");
#endif
labelSubFont.setWeight(QFont::Weight::Bold);
labelSubFont.setLetterSpacing(QFont::SpacingType::AbsoluteSpacing, -0.6);
labelSubFont.setPixelSize(14);
Expand All @@ -106,7 +110,9 @@ QFont getSubLabelFontBolded()
QFont getTopLabelFontBolded()
{
QFont labelTopFont;
#if !defined(Q_OS_MAC)
labelTopFont.setFamily("Open Sans");
#endif
labelTopFont.setWeight(QFont::Weight::Bold);
labelTopFont.setLetterSpacing(QFont::SpacingType::AbsoluteSpacing, -0.6);
labelTopFont.setPixelSize(18);
Expand All @@ -116,7 +122,9 @@ QFont getTopLabelFontBolded()
QFont getTopLabelFont(int weight, int pxsize)
{
QFont labelTopFont;
#if !defined(Q_OS_MAC)
labelTopFont.setFamily("Open Sans");
#endif
labelTopFont.setWeight(weight);
labelTopFont.setLetterSpacing(QFont::SpacingType::AbsoluteSpacing, -0.6);
labelTopFont.setPixelSize(pxsize);
Expand All @@ -126,7 +134,9 @@ QFont getTopLabelFont(int weight, int pxsize)
QFont getTopLabelFont()
{
QFont labelTopFont;
#if !defined(Q_OS_MAC)
labelTopFont.setFamily("Open Sans");
#endif
labelTopFont.setWeight(QFont::Weight::Light);
labelTopFont.setLetterSpacing(QFont::SpacingType::AbsoluteSpacing, -0.6);
labelTopFont.setPixelSize(18);
Expand Down
4 changes: 4 additions & 0 deletions src/qt/overviewpage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,14 +216,18 @@ Q_OBJECT

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

/** Create the font that is used for painting the asset amount */
QFont amountFont;
#if !defined(Q_OS_MAC)
amountFont.setFamily("Open Sans");
#endif
amountFont.setPixelSize(14);
amountFont.setWeight(QFont::Weight::Normal);
amountFont.setLetterSpacing(QFont::SpacingType::AbsoluteSpacing, -0.3);
Expand Down
18 changes: 16 additions & 2 deletions src/qt/ravengui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,9 @@ RavenGUI::RavenGUI(const PlatformStyle *_platformStyle, const NetworkStyle *netw

loadFonts();

#if !defined(Q_OS_MAC)
this->setFont(QFont("Open Sans"));
#endif

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

QActionGroup *tabGroup = new QActionGroup(this);
Expand Down Expand Up @@ -608,16 +612,26 @@ void RavenGUI::createToolBars()
// toolbar->addAction(messagingAction);
// toolbar->addAction(votingAction);

QString openSansFontString = "font: normal 22pt \"Open Sans\";";
QString normalString = "font: normal 22pt \"Arial\";";
QString stringToUse = "";

#if !defined(Q_OS_MAC)
stringToUse = openSansFontString;
#else
stringToUse = normalString;
#endif

/** RVN START */
QString tbStyleSheet = ".QToolBar {background-color : transparent; border-color: transparent; } "
".QToolButton {background-color: transparent; border-color: transparent; width: 249px; color: %1; border: none;} "
".QToolButton:checked {background: none; background-color: none; selection-background-color: none; color: %2; border: none; font: normal 22pt \"Open Sans\";} "
".QToolButton:checked {background: none; background-color: none; selection-background-color: none; color: %2; border: none; font: %4} "
".QToolButton:hover {background: none; background-color: none; border: none; color: %3;} "
".QToolButton:disabled {color: gray;}";

toolbar->setStyleSheet(tbStyleSheet.arg(platformStyle->ToolBarNotSelectedTextColor().name(),
platformStyle->ToolBarSelectedTextColor().name(),
platformStyle->DarkOrangeColor().name()));
platformStyle->DarkOrangeColor().name(), stringToUse));

toolbar->setOrientation(Qt::Vertical);
toolbar->setIconSize(QSize(40, 40));
Expand Down

0 comments on commit 0e0cf44

Please sign in to comment.