-
- /* Add a default font for any LoadFont nodes in our file which we haven't yet found fonts for */
- BOOST_FOREACH (shared_ptr<dcp::LoadFontNode> i, c->load_font_nodes()) {
- if (fm.find(i->id) == fm.end()) {
+ fonts_in_content.sort();
+ fonts_in_content.unique();
+
+ /* Find a font for each <LoadFont> Node */
+ for (auto i: c->load_font_nodes()) {
+ bool done = false;
+ for (auto j: fonts_in_content) {
+ if (j->id() == i->id && j->file()) {
+ // One was specified in the content
+ _fonts.push_back (FontData(i->id, dcp::ArrayData(*j->file())));
+ done = true;
+ }
+ }
+ if (!done) {
+ if (fonts_in_asset.find(i->id) != fonts_in_asset.end()) {
+ // One was included in the subtitle file
+ _fonts.push_back (FontData(i->id, fonts_in_asset[i->id]));
+ done = true;
+ }
+ }
+ if (!done) {
+ // Give up and add a default