diff options
| author | Carl Hetherington <cth@carlh.net> | 2023-01-21 23:17:51 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2023-02-27 14:47:25 +0100 |
| commit | 45204e57f309bc595841975f7769037e43a0831f (patch) | |
| tree | 4242dccda5380f38122c3eeef908a9d6969fb52a /src/lib/render_text.cc | |
| parent | 9f90d2db337787ebb4da73b909776d5b13a1d520 (diff) | |
Add override_standard to bounding_box().
Diffstat (limited to 'src/lib/render_text.cc')
| -rw-r--r-- | src/lib/render_text.cc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/lib/render_text.cc b/src/lib/render_text.cc index b32bed557..33e0c6a89 100644 --- a/src/lib/render_text.cc +++ b/src/lib/render_text.cc @@ -47,6 +47,7 @@ using std::min; using std::pair; using std::shared_ptr; using std::string; +using boost::optional; using namespace dcpomatic; @@ -436,17 +437,18 @@ render_text (list<StringText> subtitles, dcp::Size target, DCPTime time, int fra list<dcpomatic::Rect<int>> -bounding_box(list<StringText> subtitles, dcp::Size target) +bounding_box(list<StringText> subtitles, dcp::Size target, optional<dcp::SubtitleStandard> override_standard) { list<StringText> pending; list<dcpomatic::Rect<int>> rects; - auto use_pending = [&pending, &rects, target]() { + auto use_pending = [&pending, &rects, target, override_standard]() { auto const& subtitle = pending.front(); + auto standard = override_standard.get_value_or(subtitle.valign_standard); /* We can provide dummy values for time and frame rate here as they are only used to calculate fades */ auto layout = setup_layout(pending, target, DCPTime(), 24); int const x = x_position(subtitle.h_align(), subtitle.h_position(), target.width, layout.size.width); - int const y = y_position(subtitle.valign_standard, subtitle.v_align(), subtitle.v_position(), target.height, layout.position.y, layout.size.height); + int const y = y_position(standard, subtitle.v_align(), subtitle.v_position(), target.height, layout.position.y, layout.size.height); rects.push_back({Position<int>(x, y), layout.size.width, layout.size.height}); }; |
