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/text_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/text_content.cc')
| -rw-r--r-- | src/lib/text_content.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/lib/text_content.cc b/src/lib/text_content.cc index 1e9c609c9..9c925cbcf 100644 --- a/src/lib/text_content.cc +++ b/src/lib/text_content.cc @@ -445,6 +445,7 @@ TextContent::identifier () const void TextContent::add_font (shared_ptr<Font> font) { + DCPOMATIC_ASSERT(!get_font(font->id())); _fonts.push_back (font); connect_to_fonts (); } @@ -647,3 +648,19 @@ TextContent::take_settings_from (shared_ptr<const TextContent> c) set_language (c->_language); set_language_is_additional (c->_language_is_additional); } + + +shared_ptr<dcpomatic::Font> +TextContent::get_font(string id) const +{ + auto iter = std::find_if(_fonts.begin(), _fonts.end(), [&id](shared_ptr<dcpomatic::Font> font) { + return font->id() == id; + }); + + if (iter == _fonts.end()) { + return {}; + } + + return *iter; +} + |
