diff options
| author | Carl Hetherington <cth@carlh.net> | 2023-11-15 20:14:55 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2023-11-15 20:14:55 +0100 |
| commit | e3fa86ef35f212b14b593dd36dbff66e845d37e4 (patch) | |
| tree | c5d6ed58fc19b0fcd08c02a67df66d7023337728 /src/subtitle_string.cc | |
| parent | 24ba38ed1d695a67aebc8a6084444345787112f9 (diff) | |
Simple pass-through of <Ruby> tags in subtitles.
Diffstat (limited to 'src/subtitle_string.cc')
| -rw-r--r-- | src/subtitle_string.cc | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/subtitle_string.cc b/src/subtitle_string.cc index b627240b..af61d928 100644 --- a/src/subtitle_string.cc +++ b/src/subtitle_string.cc @@ -49,6 +49,7 @@ using std::min; using std::ostream; using std::shared_ptr; using std::string; +using std::vector; using boost::optional; using namespace dcp; @@ -74,7 +75,8 @@ SubtitleString::SubtitleString ( Colour effect_colour, Time fade_up_time, Time fade_down_time, - float space_before + float space_before, + vector<Ruby> rubies ) : Subtitle(in, out, h_position, h_align, v_position, v_align, z_position, fade_up_time, fade_down_time) , _font (font) @@ -89,6 +91,7 @@ SubtitleString::SubtitleString ( , _effect (effect) , _effect_colour (effect_colour) , _space_before (space_before) + , _rubies(rubies) { _aspect_adjust = max(min(_aspect_adjust, 4.0f), 0.25f); } @@ -130,7 +133,8 @@ dcp::operator== (SubtitleString const & a, SubtitleString const & b) a.effect_colour() == b.effect_colour() && a.fade_up_time() == b.fade_up_time() && a.fade_down_time() == b.fade_down_time() && - fabs (a.space_before() - b.space_before()) < SPACE_BEFORE_EPSILON + fabs (a.space_before() - b.space_before()) < SPACE_BEFORE_EPSILON && + a.rubies() == b.rubies() ); } @@ -175,6 +179,10 @@ dcp::operator<< (ostream& s, SubtitleString const & sub) << ", effect colour (" << sub.effect_colour().r << ", " << sub.effect_colour().g << ", " << sub.effect_colour().b << ")" << ", space before " << sub.space_before(); + for (auto ruby: sub.rubies()) { + s << ", ruby " << ruby.base << " " << ruby.annotation; + } + return s; } @@ -254,6 +262,11 @@ SubtitleString::equals(shared_ptr<const Subtitle> other_sub, EqualityOptions con same = false; } + if (_rubies != other->_rubies) { + note(NoteType::ERROR, "rubies differ"); + same = false; + } + return same; } |
