Merge pull request #27 from tophf/attached-font-render-fix

Pass all font attachments to font renderer
This commit is contained in:
Thomas Goyne 2015-02-28 14:28:17 -08:00
commit 2ef500d22c
1 changed files with 12 additions and 0 deletions

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