From 45204e57f309bc595841975f7769037e43a0831f Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sat, 21 Jan 2023 23:17:51 +0100 Subject: Add override_standard to bounding_box(). --- src/lib/render_text.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/lib/render_text.cc') 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 subtitles, dcp::Size target, DCPTime time, int fra list> -bounding_box(list subtitles, dcp::Size target) +bounding_box(list subtitles, dcp::Size target, optional override_standard) { list pending; list> 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(x, y), layout.size.width, layout.size.height}); }; -- cgit v1.2.3