From a46bbabdaf98d98539da78851e3e820d81a65b87 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 4 Dec 2019 19:01:44 +0100 Subject: Load and register ArdourSans font at application start --- gtk2_ardour/bundle_env_msvc.cc | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'gtk2_ardour/bundle_env_msvc.cc') diff --git a/gtk2_ardour/bundle_env_msvc.cc b/gtk2_ardour/bundle_env_msvc.cc index 97d09c9779..f556526169 100644 --- a/gtk2_ardour/bundle_env_msvc.cc +++ b/gtk2_ardour/bundle_env_msvc.cc @@ -484,22 +484,29 @@ fixup_bundle_environment (int argc, char* argv[], string & localedir) void load_custom_fonts() { - std::string ardour_mono_file; + FcConfig* config = FcInitLoadConfigAndFonts(); - if (!find_file (ardour_data_search_path(), "ArdourMono.ttf", ardour_mono_file)) { + std::string font_file; + + if (!find_file (ardour_data_search_path(), "ArdourMono.ttf", font_file)) { cerr << _("Cannot find ArdourMono TrueType font") << endl; + } else { + FcBool ret = FcConfigAppFontAddFile(config, reinterpret_cast(font_file.c_str())); + if (ret == FcFalse) { + cerr << _("Cannot load ArdourMono TrueType font.") << endl; + } } - FcConfig *config = FcInitLoadConfigAndFonts(); - FcBool ret = FcConfigAppFontAddFile(config, reinterpret_cast(ardour_mono_file.c_str())); - - if (ret == FcFalse) { - cerr << _("Cannot load ArdourMono TrueType font.") << endl; + if (!find_file (ardour_data_search_path(), "ArdourSans.ttf", font_file)) { + cerr << _("Cannot find ArdourSans TrueType font") << endl; + } else { + FcBool ret = FcConfigAppFontAddFile(config, reinterpret_cast(font_file.c_str())); + if (ret == FcFalse) { + cerr << _("Cannot load ArdourSans TrueType font.") << endl; + } } - ret = FcConfigSetCurrent(config); - - if (ret == FcFalse) { + if (FcFalse == FcConfigSetCurrent(config)) { cerr << _("Failed to set fontconfig configuration.") << endl; } } -- cgit v1.2.3