summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-05-15 20:48:48 +0100
committerCarl Hetherington <cth@carlh.net>2018-05-15 20:48:48 +0100
commit011d403dc6ffbb3c0ddf0b23f6267735bdc1e751 (patch)
treea86f57c3b37e8cbdb0948c32428836b6b1456321 /src/lib
parentdebf1b47de684d33789dc1cbd5b4df5def550815 (diff)
Escape & before sending it to pango, otherwise it won't render it.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/render_subtitles.cc8
1 files changed, 7 insertions, 1 deletions
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 <pango/pangocairo.h>
#endif
#include <boost/foreach.hpp>
+#include <boost/algorithm/string.hpp>
#include <iostream>
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<pair<FontFiles, string> > fc_config_fonts;
@@ -68,7 +70,11 @@ marked_up (list<SubtitleString> subtitles, int target_height, float fade_factor)
/* Between 1-65535 inclusive, apparently... */
out += "alpha=\"" + dcp::raw_convert<string>(int(floor(fade_factor * 65534)) + 1) + "\" ";
out += "color=\"#" + i.colour().to_rgb_string() + "\">";
- out += i.text ();
+
+ string t = i.text();
+ replace_all(t, "&", "&amp;");
+ out += t;
+
out += "</span>";
}