Commit 05b5b616 authored by Thomas Hartmann's avatar Thomas Hartmann Committed by Alessandro Portale

Loading .ttf fonts from share/qtcreator/fonts

We add all .ttf fonts found in share/qtcreator/fonts to
QFontDatabase.

Change-Id: I133a5298bd4696b99fa2350758baf8abd8b16fd8
Reviewed-by: Alessandro Portale's avatarAlessandro Portale <alessandro.portale@qt.io>
parent 26246af9
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include <QDebug> #include <QDebug>
#include <QDir> #include <QDir>
#include <QFontDatabase>
#include <QFileInfo> #include <QFileInfo>
#include <QLibraryInfo> #include <QLibraryInfo>
#include <QLoggingCategory> #include <QLoggingCategory>
...@@ -295,6 +296,14 @@ static inline QSettings *userSettings() ...@@ -295,6 +296,14 @@ static inline QSettings *userSettings()
static const char *SHARE_PATH = static const char *SHARE_PATH =
Utils::HostOsInfo::isMacHost() ? "/../Resources" : "/../share/qtcreator"; Utils::HostOsInfo::isMacHost() ? "/../Resources" : "/../share/qtcreator";
void loadFonts()
{
const QDir dir(QCoreApplication::applicationDirPath() + SHARE_PATH + "/fonts/");
foreach (const QFileInfo &fileInfo, dir.entryList(QStringList("*.ttf"), QDir::Files))
QFontDatabase::addApplicationFont(fileInfo.absoluteFilePath());
}
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
const char *highDpiEnvironmentVariable = setHighDpiEnvironmentVariable(); const char *highDpiEnvironmentVariable = setHighDpiEnvironmentVariable();
...@@ -311,6 +320,8 @@ int main(int argc, char **argv) ...@@ -311,6 +320,8 @@ int main(int argc, char **argv)
SharedTools::QtSingleApplication app((QLatin1String(appNameC)), argc, argv); SharedTools::QtSingleApplication app((QLatin1String(appNameC)), argc, argv);
loadFonts();
if (highDpiEnvironmentVariable) if (highDpiEnvironmentVariable)
qunsetenv(highDpiEnvironmentVariable); qunsetenv(highDpiEnvironmentVariable);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment