From: Carl Hetherington Date: Tue, 15 May 2018 19:48:48 +0000 (+0100) Subject: Escape & before sending it to pango, otherwise it won't render it. X-Git-Tag: v2.13.21~2 X-Git-Url: https://main.carlh.net/gitweb/?a=commitdiff_plain;h=011d403;p=dcpomatic.git Escape & before sending it to pango, otherwise it won't render it. --- diff --git a/ChangeLog b/ChangeLog index e397d7952..dcb0ef1cb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2018-05-15 Carl Hetherington + + * Fix missing burnt-in / previewed subtitles containing ampersands. + 2018-05-08 Carl Hetherington * Look at subtitle colour and effect when deciding whether or not to diff --git a/src/lib/render_subtitles.cc b/src/lib/render_subtitles.cc index ad2c10a06..35fcd8b93 100644 --- a/src/lib/render_subtitles.cc +++ b/src/lib/render_subtitles.cc @@ -32,6 +32,7 @@ #include #endif #include +#include #include using std::list; @@ -44,6 +45,7 @@ using std::cerr; using std::make_pair; using boost::shared_ptr; using boost::optional; +using boost::algorithm::replace_all; static FcConfig* fc_config = 0; static list > fc_config_fonts; @@ -68,7 +70,11 @@ marked_up (list subtitles, int target_height, float fade_factor) /* Between 1-65535 inclusive, apparently... */ out += "alpha=\"" + dcp::raw_convert(int(floor(fade_factor * 65534)) + 1) + "\" "; out += "color=\"#" + i.colour().to_rgb_string() + "\">"; - out += i.text (); + + string t = i.text(); + replace_all(t, "&", "&"); + out += t; + out += ""; }