diff options
| author | Carl Hetherington <cth@carlh.net> | 2016-02-21 19:19:34 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2016-02-21 19:19:34 +0000 |
| commit | 94fe4f4b6373ca40a4ca5be06a1c8caea5ed76f2 (patch) | |
| tree | 01f3f7204480ba9379716cbe3929ef4d64036eac /src | |
| parent | 2cef28a60af97a7f651c7fa7f9a1adebd6c96d6a (diff) | |
Don't write duplicate <LoadFont> nodes into subtitle files.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/writer.cc | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/lib/writer.cc b/src/lib/writer.cc index 47c6b8381..ea8a2e89f 100644 --- a/src/lib/writer.cc +++ b/src/lib/writer.cc @@ -543,8 +543,20 @@ Writer::write (PlayerSubtitles subs) void Writer::write (list<shared_ptr<Font> > fonts) { - /* Just keep a list of fonts and we'll deal with them in ::finish */ - copy (fonts.begin (), fonts.end (), back_inserter (_fonts)); + /* Just keep a list of unique fonts and we'll deal with them in ::finish */ + + BOOST_FOREACH (shared_ptr<Font> i, fonts) { + bool got = false; + BOOST_FOREACH (shared_ptr<Font> j, _fonts) { + if (*i == *j) { + got = true; + } + } + + if (!got) { + _fonts.push_back (i); + } + } } bool |
