summaryrefslogtreecommitdiff
path: root/src/lib/render_text.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2025-07-04 10:32:22 +0200
committerCarl Hetherington <cth@carlh.net>2025-07-08 22:11:35 +0200
commitbb5319c7dc0c91815750eafe771303f5fffbe30b (patch)
tree814c9f70f9fe6a7226f0cd900794611b1bd3f7e9 /src/lib/render_text.cc
parent57a83f853fc45be5361ec002acc964c1ed8b89b4 (diff)
Make shadow offset proportional to the target size.
Otherwise it looks further away in the preview than in in the final DCP (if the preview is smaller).
Diffstat (limited to 'src/lib/render_text.cc')
-rw-r--r--src/lib/render_text.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lib/render_text.cc b/src/lib/render_text.cc
index 80c6614e9..4ce98949b 100644
--- a/src/lib/render_text.cc
+++ b/src/lib/render_text.cc
@@ -409,6 +409,7 @@ render_line(vector<StringText> subtitles, dcp::Size target, DCPTime time, int fr
auto const border_width = border_width_for_subtitle(first, target);
layout.size.width += 2 * ceil(border_width);
layout.size.height += 2 * ceil(border_width);
+ auto const shadow_offset = dcp_pixels_to_pixels(target, 4);
layout.size.width *= x_scale;
layout.size.height *= y_scale;
@@ -428,7 +429,7 @@ render_line(vector<StringText> subtitles, dcp::Size target, DCPTime time, int fr
if (first.effect() == dcp::Effect::SHADOW) {
/* Drop-shadow effect */
set_source_rgba(context, first.effect_colour(), fade_factor);
- context->move_to(x_offset + 4, y_offset + 4);
+ context->move_to(x_offset + shadow_offset, y_offset + shadow_offset);
layout.pango->add_to_cairo_context(context);
context->fill();
}