diff options
| author | Carl Hetherington <cth@carlh.net> | 2023-10-14 21:48:25 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2023-10-15 09:10:18 +0200 |
| commit | 3c802dd6d1451c2c8a7e188f8379738d72e907eb (patch) | |
| tree | 454396cf5451535b8708a0c4961c7d5c2b30ea1f /src/lib/dcp_decoder.cc | |
| parent | 1bfe44b1503fb0f5cffda135076709014337de52 (diff) | |
Fix DCP content font ID allocation to cope with DCPs that have multiple fonts
with the same name in the same reel (#2600).
Previously we had this id_for_font_in_reel() which would give an ID
of N_font-ID. This means we got duplicate font IDs.
Here we replace that method with FontAllocator, which gives an ID of
N_font-ID for the first font and M_font-ID, where M is a number higher than
the highest reel index. The idea is to support the required new IDs
without breaking exisiting projects.
There is some documentation of how it works in doc/design/fonts
Diffstat (limited to 'src/lib/dcp_decoder.cc')
| -rw-r--r-- | src/lib/dcp_decoder.cc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/lib/dcp_decoder.cc b/src/lib/dcp_decoder.cc index e72573ebc..0a57ce7f5 100644 --- a/src/lib/dcp_decoder.cc +++ b/src/lib/dcp_decoder.cc @@ -23,6 +23,7 @@ #include "audio_content.h" #include "audio_decoder.h" #include "config.h" +#include "constants.h" #include "dcp_content.h" #include "dcp_decoder.h" #include "digester.h" @@ -136,6 +137,9 @@ DCPDecoder::DCPDecoder (shared_ptr<const Film> film, shared_ptr<const DCPContent _reel = _reels.begin (); get_readers (); + + _font_id_allocator.add_fonts_from_reels(_reels); + _font_id_allocator.allocate(); } @@ -310,7 +314,7 @@ DCPDecoder::pass_texts ( } dcp::SubtitleString is_copy = *is; - is_copy.set_font(id_for_font_in_reel(is_copy.font().get_value_or(""), _reel - _reels.begin())); + is_copy.set_font(_font_id_allocator.font_id(_reel - _reels.begin(), asset->id(), is_copy.font().get_value_or(""))); strings.push_back(is_copy); } |
