Pass all font attachments to font renderer

See #1805.
This commit is contained in:
9adefaf01e5bf6426d838cd20eae582d2b6ba647 2015-02-27 01:16:35 +03:00
parent 3554bdc29a
commit af9fe934c7

View file

@ -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)))