From af9fe934c7d6c20c83b4da8f552ce4e6cdf8a8c7 Mon Sep 17 00:00:00 2001 From: 9adefaf01e5bf6426d838cd20eae582d2b6ba647 Date: Fri, 27 Feb 2015 01:16:35 +0300 Subject: [PATCH] Pass all font attachments to font renderer See #1805. --- src/subtitles_provider.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/subtitles_provider.cpp b/src/subtitles_provider.cpp index 0453ec0f5..057bbbdbd 100644 --- a/src/subtitles_provider.cpp +++ b/src/subtitles_provider.cpp @@ -17,6 +17,7 @@ #include "include/aegisub/subtitles_provider.h" #include "ass_dialogue.h" +#include "ass_attachment.h" #include "ass_file.h" #include "ass_info.h" #include "ass_style.h" @@ -86,6 +87,17 @@ void SubtitlesProvider::LoadSubtitles(AssFile *subs, int time) { for (auto const& line : subs->Styles) push_line(line.GetEntryData()); + if (!subs->Attachments.empty()) { + // TODO: some scripts may have a lot of attachments, + // so ideally we'd want to write only those actually used on the requested video frame, + // but this would require some pre-parsing of the attached font files with FreeType, + // which isn't probably trivial. + push_header("[Fonts]\n"); + for (auto const& attachment : subs->Attachments) + if (attachment.Group() == AssEntryGroup::FONT) + push_line(attachment.GetEntryData()); + } + push_header("[Events]\n"); for (auto const& line : subs->Events) { if (!line.Comment && (time < 0 || !(line.Start > time || line.End <= time)))