+string
+marked_up (list<SubtitleString> subtitles, int target_height, float fade_factor)
+{
+ string out;
+
+ BOOST_FOREACH (SubtitleString const & i, subtitles) {
+ out += "<span ";
+ if (i.italic()) {
+ out += "style=\"italic\" ";
+ }
+ if (i.bold()) {
+ out += "weight=\"bold\" ";
+ }
+ if (i.underline()) {
+ out += "underline=\"single\" ";
+ }
+ out += "size=\"" + dcp::raw_convert<string>(i.size_in_pixels(target_height) * 72 * 1024 / 96) + "\" ";
+ /* 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 ();
+ out += "</span>";
+ }
+
+ return out;
+}
+
+static void
+set_source_rgba (Cairo::RefPtr<Cairo::Context> context, dcp::Colour colour, float fade_factor)
+{
+ context->set_source_rgba (float(colour.r) / 255, float(colour.g) / 255, float(colour.b) / 255, fade_factor);
+}
+
+/** @param subtitles A list of subtitles that are all on the same line,
+ * at the same time and with the same fade in/out.
+ */