diff --git a/aegisub/src/font_file_lister.cpp b/aegisub/src/font_file_lister.cpp index e7d16a0f3..e474b98f5 100644 --- a/aegisub/src/font_file_lister.cpp +++ b/aegisub/src/font_file_lister.cpp @@ -29,6 +29,8 @@ #include "ass_style.h" #include "utils.h" +#include + #ifndef AGI_PRE #include @@ -154,19 +156,18 @@ std::vector FontCollector::GetFontPaths(const AssFile *file) { status_callback(_("Parsing file\n"), 0); - int index = 0; - for (auto const& line : file->Line) { - if (const AssStyle *style = dynamic_cast(&line)) { - StyleInfo &info = styles[style->name]; - info.facename = style->font; - info.bold = style->bold; - info.italic = style->italic; - used_styles[info].styles.insert(style->name); - } - else if (const AssDialogue *diag = dynamic_cast(&line)) - ProcessDialogueLine(diag, ++index); + for (auto style : file->Line | agi::of_type()) { + StyleInfo &info = styles[style->name]; + info.facename = style->font; + info.bold = style->bold; + info.italic = style->italic; + used_styles[info].styles.insert(style->name); } + int index = 0; + for (auto diag : file->Line | agi::of_type()) + ProcessDialogueLine(diag, ++index); + status_callback(_("Searching for font files\n"), 0); for_each(used_styles.begin(), used_styles.end(), bind(&FontCollector::ProcessChunk, this, _1)); status_callback(_("Done\n\n"), 0);