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

(cherry picked from commit 208d146a03)
This commit is contained in:
Marek Roszko 2023-08-26 13:42:20 -04:00 committed by Mark Roszko
parent e1a2d60672
commit 7ca59e24c6
3 changed files with 25 additions and 0 deletions

View File

@ -434,6 +434,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

@ -479,6 +479,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 );
// Our unit test mocks break if we continue

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() {}