Fix rendering of italic fonts during tests on Windows.
[dcpomatic.git] / src / lib / util.cc
index 8c570059821d35ca3290dd250524d3f682b2c6f9..13a062bc63e5d8c35bf16efbede63abacb7ea648 100644 (file)
@@ -54,6 +54,7 @@
 #include "video_content.h"
 #include <dcp/atmos_asset.h>
 #include <dcp/decrypted_kdm.h>
+#include <dcp/file.h>
 #include <dcp/locale_convert.h>
 #include <dcp/picture_asset.h>
 #include <dcp/raw_convert.h>
@@ -407,7 +408,6 @@ ffmpeg_log_callback(void* ptr, int level, const char* fmt, va_list vl)
 }
 
 
-static
 void
 capture_ffmpeg_logs()
 {
@@ -448,7 +448,13 @@ LIBDCP_ENABLE_WARNINGS
 
 #ifdef DCPOMATIC_WINDOWS
        putenv ("PANGOCAIRO_BACKEND=fontconfig");
-       putenv (String::compose("FONTCONFIG_PATH=%1", resources_path().string()).c_str());
+       if (boost::filesystem::exists(resources_path() / "fonts.conf")) {
+               /* The actual application after installation */
+               putenv(String::compose("FONTCONFIG_PATH=%1", resources_path().string()).c_str());
+       } else {
+               /* The place where fonts.conf is during tests */
+               putenv("FONTCONFIG_PATH=build\\fonts");
+       }
 #endif
 
 #ifdef DCPOMATIC_OSX
@@ -461,7 +467,7 @@ LIBDCP_ENABLE_WARNINGS
 
 #if defined(DCPOMATIC_WINDOWS) || defined(DCPOMATIC_OSX)
        /* Render something to fontconfig to create its cache */
-       list<StringText> subs;
+       vector<StringText> subs;
        dcp::SubtitleString ss(
                optional<string>(), false, false, false, dcp::Colour(), 42, 1, dcp::Time(), dcp::Time(), 0, dcp::HAlign::CENTER, 0, dcp::VAlign::CENTER, 0, dcp::Direction::LTR,
                "Hello dolly", dcp::Effect::NONE, dcp::Colour(), dcp::Time(), dcp::Time(), 0