From 13481405acc8fce34ca5d948607964df159d3149 Mon Sep 17 00:00:00 2001 From: Garux Date: Fri, 21 Dec 2018 11:48:34 +0300 Subject: [PATCH] improve workaround of slow fontconfig start --- radiant/main.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/radiant/main.cpp b/radiant/main.cpp index eddfd303..21350379 100644 --- a/radiant/main.cpp +++ b/radiant/main.cpp @@ -559,6 +559,30 @@ void add_local_rc_files(){ #endif } +#ifdef WIN32 +/* as in windows packages we are using local font file for entity names to avoid long parsing of all system fonts by fontconfig, + let's also write local.conf with absolute path to local fonts/ dir, as fonts.conf has no opportunity to get it, when pwd != radiant/ + ( when starting radiant by opening .map, associated to one, for example ) */ +void fontconfig_workaround(){ + StringOutputStream path( 1024 ); + path << AppPath_get() << "etc/fonts/local.conf"; + + TextFileOutputStream file( path.c_str() ); + if ( !file.failed() ) { + file << "\n\ +\n\ +\n\ + \n\ + \n\ + \n\ +\n\ + Load font from local dir\n\ + " << AppPath_get() << "etc/fonts\n\ +\n"; + } +} +#endif + int main( int argc, char* argv[] ){ crt_init(); @@ -613,6 +637,10 @@ int main( int argc, char* argv[] ){ add_local_rc_files(); +#ifdef WIN32 + fontconfig_workaround(); +#endif + if ( !check_version() ) { return EXIT_FAILURE; }