mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 19:10:06 +00:00
Set fontconfig environment in Linux
This commit is contained in:
parent
4916dfe85a
commit
3a754c01c5
1 changed files with 18 additions and 0 deletions
|
|
@ -1,6 +1,7 @@
|
|||
#include <scwx/qt/manager/font_manager.hpp>
|
||||
#include <scwx/qt/manager/settings_manager.hpp>
|
||||
#include <scwx/qt/settings/text_settings.hpp>
|
||||
#include <scwx/util/environment.hpp>
|
||||
#include <scwx/util/logger.hpp>
|
||||
|
||||
#include <filesystem>
|
||||
|
|
@ -50,6 +51,7 @@ class FontManager::Impl
|
|||
public:
|
||||
explicit Impl(FontManager* self) : self_ {self}
|
||||
{
|
||||
InitializeEnvironment();
|
||||
InitializeFontCache();
|
||||
InitializeFontconfig();
|
||||
ConnectSignals();
|
||||
|
|
@ -58,6 +60,7 @@ public:
|
|||
|
||||
void ConnectSignals();
|
||||
void FinalizeFontconfig();
|
||||
void InitializeEnvironment();
|
||||
void InitializeFontCache();
|
||||
void InitializeFontconfig();
|
||||
void UpdateImGuiFont(types::FontCategory fontCategory);
|
||||
|
|
@ -385,6 +388,21 @@ void FontManager::LoadApplicationFont(types::Font font,
|
|||
}
|
||||
}
|
||||
|
||||
void FontManager::Impl::InitializeEnvironment()
|
||||
{
|
||||
#if defined(__linux__)
|
||||
// Because of the way Fontconfig is built with Conan, FONTCONFIG_PATH must be
|
||||
// defined on Linux to ensure fonts can be found
|
||||
static const std::string kFontconfigPathKey {"FONTCONFIG_PATH"};
|
||||
|
||||
std::string fontconfigPath = scwx::util::GetEnvironment(kFontconfigPathKey);
|
||||
if (fontconfigPath.empty())
|
||||
{
|
||||
scwx::util::SetEnvironment(kFontconfigPathKey, "/etc/fonts");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void FontManager::Impl::InitializeFontCache()
|
||||
{
|
||||
std::string cachePath {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue