+ std::set<string> names;
+ for (auto const& subtitle: file.subtitles()) {
+ for (auto const& line: subtitle.lines) {
+ for (auto const& block: line.blocks) {
+ names.insert(block.font.get_value_or(""));
+ }
+ }
+ }
+
+ for (auto name: names) {
+ optional<boost::filesystem::path> path;
+ if (!name.empty()) {
+ path = FontConfig::instance()->system_font_with_name(name);
+ }
+ if (path) {
+ only_text()->add_font(make_shared<Font>(name, *path));
+ } else {
+ only_text()->add_font(make_shared<Font>(name));
+ }
+ }
+