Supporters update.
[dcpomatic.git] / src / lib / font_config.cc
index d4a442fc1f84434978b0ec02eaabce5fd6f89bd6..653c9ba84683fec52e4fb39f29e6ca04e104a284 100644 (file)
@@ -24,6 +24,7 @@
 #include "font.h"
 #include "font_config.h"
 #include "util.h"
+#include <dcp/filesystem.h>
 #include <fontconfig/fontconfig.h>
 #include <boost/filesystem.hpp>
 #include <boost/optional.hpp>
@@ -48,7 +49,7 @@ FontConfig::~FontConfig()
 {
        for (auto file: _temp_files) {
                boost::system::error_code ec;
-               boost::filesystem::remove(file, ec);
+               dcp::filesystem::remove(file, ec);
        }
 }
 
@@ -56,7 +57,9 @@ FontConfig::~FontConfig()
 string
 FontConfig::make_font_available(shared_ptr<dcpomatic::Font> font)
 {
-       auto existing = _available_fonts.find(font->id());
+       DCPOMATIC_ASSERT(font);
+
+       auto existing = _available_fonts.find(font->content());
        if (existing != _available_fonts.end()) {
                return existing->second;
        }
@@ -107,7 +110,10 @@ FontConfig::make_font_available(shared_ptr<dcpomatic::Font> font)
 
        DCPOMATIC_ASSERT(font_name);
 
-       _available_fonts[font->id()] = *font_name;
+       /* We need to use the font object as the key, as we may be passed the same shared_ptr to a modified
+        * Font object in the future and in that case we need to load the new font.
+        */
+       _available_fonts[font->content()] = *font_name;
 
        FcConfigBuildFonts(_config);
        return *font_name;