Render bold subtitles correctly in preview / burn-in.
authorCarl Hetherington <cth@carlh.net>
Sun, 19 Jun 2016 21:11:25 +0000 (22:11 +0100)
committerCarl Hetherington <cth@carlh.net>
Sun, 19 Jun 2016 21:11:25 +0000 (22:11 +0100)
ChangeLog
src/lib/render_subtitles.cc

index 4b98e2f401a303b6570793ff0ec5920acfcc55a5..ecc5e4cd9eccbf5ee0105f52ea31e5f5f2c81b7f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2016-06-19  Carl Hetherington  <cth@carlh.net>
 
+       * Fix preview of bold subtitles.
+
        * Updated pt_BR translation from Max M. Fuhlendorf.
 
        * Version 2.8.11 released.
index 74762a64ad85a2adf1dcd143447999fa81f95fae..76aa092297d9c880a6a5949f78354d953e249e93 100644 (file)
@@ -200,6 +200,7 @@ render_line (list<dcp::SubtitleString> subtitles, list<shared_ptr<Font> > fonts,
 
        string marked_up;
        bool italic = false;
+       bool bold = false;
        BOOST_FOREACH (dcp::SubtitleString const & i, subtitles) {
                if (i.italic() != italic) {
                        if (i.italic()) {
@@ -210,6 +211,15 @@ render_line (list<dcp::SubtitleString> subtitles, list<shared_ptr<Font> > fonts,
                        italic = i.italic ();
                }
 
+               if (i.bold() != bold) {
+                       if (i.bold()) {
+                               marked_up += "<b>";
+                       } else {
+                               marked_up += "</b>";
+                       }
+                       bold = i.bold ();
+               }
+
                marked_up += i.text ();
        }
 
@@ -217,6 +227,10 @@ render_line (list<dcp::SubtitleString> subtitles, list<shared_ptr<Font> > fonts,
                marked_up += "</i>";
        }
 
+       if (bold) {
+               marked_up += "</b>";
+       }
+
        layout->set_markup (marked_up);
 
        /* Compute fade factor */