X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Futil.cc;h=8ac395b37f07a7b8df30937e1396238615337eea;hb=e3c78ffdb5e562841e86e6f59a20494159c44de7;hp=b6ca34d22d2a136f74a83385d7c608ad1b164ffb;hpb=6eba051dcbb8c56e3e2efea946ce0380d17a7b33;p=dcpomatic.git diff --git a/src/lib/util.cc b/src/lib/util.cc index b6ca34d22..8ac395b37 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -233,6 +233,7 @@ addr2line (void const * const addr) return system(addr2line_cmd); } +DCPOMATIC_DISABLE_WARNINGS /** This is called when C signals occur on Windows (e.g. SIGSEGV) * (NOT C++ exceptions!). We write a backtrace to backtrace_file by dark means. * Adapted from code here: http://spin.atomicobject.com/2013/01/13/exceptions-stack-traces-c/ @@ -289,6 +290,7 @@ exception_handler(struct _EXCEPTION_POINTERS * info) return EXCEPTION_CONTINUE_SEARCH; } +DCPOMATIC_ENABLE_WARNINGS #endif void @@ -377,12 +379,12 @@ DCPOMATIC_ENABLE_WARNINGS #ifdef DCPOMATIC_WINDOWS putenv ("PANGOCAIRO_BACKEND=fontconfig"); - putenv (String::compose("FONTCONFIG_PATH=%1", shared_path().string()).c_str()); + putenv (String::compose("FONTCONFIG_PATH=%1", resources_path().string()).c_str()); #endif #ifdef DCPOMATIC_OSX setenv ("PANGOCAIRO_BACKEND", "fontconfig", 1); - setenv ("FONTCONFIG_PATH", shared_path().string().c_str(), 1); + setenv ("FONTCONFIG_PATH", resources_path().string().c_str(), 1); #endif Pango::init (); @@ -1251,3 +1253,24 @@ decrypt_kdm_with_helpful_error (dcp::EncryptedKDM kdm) } } + +boost::filesystem::path +default_font_file () +{ + boost::filesystem::path liberation_normal; + try { + liberation_normal = resources_path() / "LiberationSans-Regular.ttf"; + if (!boost::filesystem::exists (liberation_normal)) { + /* Hack for unit tests */ + liberation_normal = resources_path() / "fonts" / "LiberationSans-Regular.ttf"; + } + } catch (boost::filesystem::filesystem_error& e) { + + } + + if (!boost::filesystem::exists(liberation_normal)) { + liberation_normal = "/usr/share/fonts/truetype/liberation/LiberationSans-Regular.ttf"; + } + + return liberation_normal; +}