diff options
| author | Carl Hetherington <cth@carlh.net> | 2022-06-01 13:03:38 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2022-06-07 17:01:06 +0200 |
| commit | 5a820bb8fae34591be5ac6d19a73461b9dab532a (patch) | |
| tree | 098e2dc959b6df0fefa62b2976976afc9f81b96b /src/lib/string_text_file_content.cc | |
| parent | 9a7b67aee32a40539f29bc2d7017edd4a4f65f11 (diff) | |
Rearrange subtitle font management.
With this change each subtitle coming out of the player has a reference
to a dcpomatic::Font that belongs to the TextContent. This hopefully
solves a few problems which all basically stemmed from the fact that
previously the decoders/player were deciding what the font ID in the
output DCP would be - they can't do that properly.
Diffstat (limited to 'src/lib/string_text_file_content.cc')
| -rw-r--r-- | src/lib/string_text_file_content.cc | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/lib/string_text_file_content.cc b/src/lib/string_text_file_content.cc index 2ce343f2e..3750b0a50 100644 --- a/src/lib/string_text_file_content.cc +++ b/src/lib/string_text_file_content.cc @@ -61,14 +61,29 @@ void StringTextFileContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job) { Content::examine (film, job); - StringTextFile s (shared_from_this()); + StringTextFile file (shared_from_this()); /* Default to turning these subtitles on */ only_text()->set_use (true); + std::set<string> names; + for (auto const& subtitle: file.subtitles()) { + for (auto const& line: subtitle.lines) { + for (auto const& block: line.blocks) { + names.insert(block.font.get_value_or("")); + } + } + } + + for (auto name: names) { + /* Make a font for each family name that somebody might later + * ask about. + */ + only_text()->add_font(make_shared<Font>(name)); + } + boost::mutex::scoped_lock lm (_mutex); - _length = s.length (); - only_text()->add_font (make_shared<Font>(TEXT_FONT_ID)); + _length = file.length(); } |
