Go back to add_to_cairo_context rather than show_in_cairo_context.
authorCarl Hetherington <cth@carlh.net>
Sun, 27 Sep 2020 20:50:43 +0000 (22:50 +0200)
committerCarl Hetherington <cth@carlh.net>
Sun, 27 Sep 2020 20:50:43 +0000 (22:50 +0200)
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

index 1e15c7aaca0446286ddff2bd870d40da4e7e4f7c..f0866267866f68dbe318d02e9d28dca27b9a376c 100644 (file)
@@ -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);