From 72c3a5f0f32f553a1f8abee2494f31d29b976383 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 27 Sep 2020 22:50:43 +0200 Subject: [PATCH] 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. --- src/lib/render_text.cc | 17 ++++++++++------- 1 file 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 subtitles, list > 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 subtitles, list > 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); -- 2.30.2