diff options
| author | Carl Hetherington <cth@carlh.net> | 2020-09-27 22:50:43 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2020-09-27 22:50:43 +0200 |
| commit | 72c3a5f0f32f553a1f8abee2494f31d29b976383 (patch) | |
| tree | 251ba0bda2df84d8f65cbbfecf782697c0ca9ad8 /src/lib/render_text.cc | |
| parent | 06fd921dd4cac01673183a996feb70a00a1df083 (diff) | |
Go back to add_to_cairo_context rather than show_in_cairo_context.
On Linux, at least, doing
add_to_cairo_context()
fill()
add_to_cairo_context()
stroke()
gives a nicer output than
show_in_cairo_context()
It's not clear exactly what the difference is, but the anti aliasing
looks better and the font outlines basically look smoother.
May help with #1815.
Diffstat (limited to 'src/lib/render_text.cc')
| -rw-r--r-- | src/lib/render_text.cc | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/lib/render_text.cc b/src/lib/render_text.cc index 1e15c7aac..f08662678 100644 --- a/src/lib/render_text.cc +++ b/src/lib/render_text.cc @@ -375,7 +375,7 @@ render_line (list<StringText> subtitles, list<shared_ptr<Font> > fonts, dcp::Siz } if (first.effect() == dcp::BORDER) { - /* Border effect; stroke the subtitle with a large (arbitrarily chosen) line width */ + /* Border effect */ set_source_rgba (context, first.effect_colour(), fade_factor); context->set_line_width (border_width); context->set_line_join (Cairo::LINE_JOIN_ROUND); @@ -386,13 +386,16 @@ render_line (list<StringText> subtitles, list<shared_ptr<Font> > fonts, dcp::Siz /* The actual subtitle */ - context->set_line_width (0); + set_source_rgba (context, first.colour(), fade_factor); + context->move_to (x_offset, y_offset); -#ifdef DCPOMATIC_HAVE_SHOW_IN_CAIRO_CONTEXT - layout->show_in_cairo_context (context); -#else - pango_cairo_show_layout (context->cobj(), layout->gobj()); -#endif + layout->add_to_cairo_context (context); + context->fill (); + + context->set_line_width (0.5); + context->move_to (x_offset, y_offset); + layout->add_to_cairo_context (context); + context->stroke (); int const x = x_position (first, target.width, size.width); int const y = y_position (first, target.height, size.height); |
