Force fontconfig to look at the correct path for fonts.conf on windows

This commit is contained in:
Marek Roszko 2023-08-26 13:42:20 -04:00
parent 53bf7b71c6
commit 208d146a03
3 changed files with 25 additions and 0 deletions

View File

@ -443,6 +443,17 @@ wxString PATHS::GetOSXKicadDataDir()
#ifdef __WXWINDOWS__
wxString PATHS::GetWindowsFontConfigDir()
{
wxFileName fn;
fn.AssignDir( getWindowsKiCadRoot() );
fn.AppendDir( wxS( "etc" ) );
fn.AppendDir( wxS( "fonts" ) );
return fn.GetPathWithSep();
}
wxString PATHS::getWindowsKiCadRoot()
{
wxFileName root( Pgm().GetExecutablePath() + wxT( "/../" ) );

View File

@ -512,6 +512,13 @@ bool PGM_BASE::InitPgm( bool aHeadless, bool aSkipPyInit, bool aIsUnitTest )
SetLanguagePath();
SetDefaultLanguage( tmp );
#ifdef _MSC_VER
// We need to set this because the internal fontconfig logic
// seems to search relative to the dll rather the other logic it
// has to look for the /etc folder above the dll
wxSetEnv( "FONTCONFIG_PATH", PATHS::GetWindowsFontConfigDir() );
#endif
m_settings_manager = std::make_unique<SETTINGS_MANAGER>( aHeadless );
m_background_jobs_monitor = std::make_unique<BACKGROUND_JOBS_MONITOR>();
m_notifications_manager = std::make_unique<NOTIFICATIONS_MANAGER>();

View File

@ -170,6 +170,13 @@ public:
static wxString GetOSXKicadDataDir();
#endif
#ifdef __WXWINDOWS__
/**
* @return The macOS specific bundle data directory for KiCad
*/
static wxString GetWindowsFontConfigDir();
#endif
private:
// we are a static helper
PATHS() {}