diff options
author | Tobias Markmann <tm@ayena.de> | 2016-06-15 10:57:58 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2016-06-15 10:57:58 (GMT) |
commit | baf480995fc479573f549042b2a5f065ee0701ea (patch) | |
tree | 6ded44a020a20ac57ff05b55d274f542a5ce24c3 /Swift/QtUI | |
parent | 9b1c1ec6922047fa30c19c0744619dc458a12b78 (diff) | |
download | swift-baf480995fc479573f549042b2a5f065ee0701ea.zip swift-baf480995fc479573f549042b2a5f065ee0701ea.tar.bz2 |
Load and set Lato font as UI font for Qt
Test-Information:
Tested on OS X 10.11.5 with Qt 5.4.2 and Debian 8.5 with
Qt 5.3.2.
Change-Id: I9a60fc4b5556379576fdddc12a697cb71597e241
Diffstat (limited to 'Swift/QtUI')
-rw-r--r-- | Swift/QtUI/QtSwift.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Swift/QtUI/QtSwift.cpp b/Swift/QtUI/QtSwift.cpp index 56f2907..6e36fa4 100644 --- a/Swift/QtUI/QtSwift.cpp +++ b/Swift/QtUI/QtSwift.cpp @@ -13,6 +13,7 @@ #include <QApplication> #include <QFile> +#include <QFontDatabase> #include <QMap> #include <QMessageBox> #include <qdebug.h> @@ -171,6 +172,36 @@ QtSwift::QtSwift(const po::variables_map& options) : networkFactories_(&clientMa Log::setLogLevel(Swift::Log::debug); } + // Load fonts + std::vector<std::string> fontNames = { + "themes/Default/Lato2OFL/Lato-Black.ttf", + "themes/Default/Lato2OFL/Lato-BlackItalic.ttf", + "themes/Default/Lato2OFL/Lato-Bold.ttf", + "themes/Default/Lato2OFL/Lato-BoldItalic.ttf", + "themes/Default/Lato2OFL/Lato-Hairline.ttf", + "themes/Default/Lato2OFL/Lato-HairlineItalic.ttf", + "themes/Default/Lato2OFL/Lato-Heavy.ttf", + "themes/Default/Lato2OFL/Lato-HeavyItalic.ttf", + "themes/Default/Lato2OFL/Lato-Italic.ttf", + "themes/Default/Lato2OFL/Lato-Light.ttf", + "themes/Default/Lato2OFL/Lato-LightItalic.ttf", + "themes/Default/Lato2OFL/Lato-Medium.ttf", + "themes/Default/Lato2OFL/Lato-MediumItalic.ttf", + "themes/Default/Lato2OFL/Lato-Regular.ttf", + "themes/Default/Lato2OFL/Lato-Semibold.ttf", + "themes/Default/Lato2OFL/Lato-SemiboldItalic.ttf", + "themes/Default/Lato2OFL/Lato-Thin.ttf", + "themes/Default/Lato2OFL/Lato-ThinItalic.ttf" + }; + + for (auto&& fontName : fontNames) { + std::string fontPath = std::string(":/") + fontName; + int error = QFontDatabase::addApplicationFont(P2QSTRING(fontPath)); + assert((error != -1) && "Failed to load font."); + } + + QApplication::setFont(QFont("Lato")); + bool enableAdHocCommandOnJID = options.count("enable-jid-adhocs") > 0; tabs_ = nullptr; if (options.count("no-tabs") && !splitter_) { |