Improve accuracy of subtitle font sizing.
authorCarl Hetherington <cth@carlh.net>
Sun, 5 Jun 2022 21:51:55 +0000 (23:51 +0200)
committerCarl Hetherington <cth@carlh.net>
Sun, 5 Jun 2022 21:51:55 +0000 (23:51 +0200)
src/lib/render_text.cc

index 0c14b00c4e7c3881a7b45b72ffa4b39bc40c420c..e0eb3da7b9f22af7e0eb7fdfe8fd9100246000a5 100644 (file)
@@ -99,7 +99,7 @@ marked_up (list<StringText> subtitles, int target_height, float fade_factor, str
                if (subtitle.underline()) {
                        span += "underline=\"single\" ";
                }
-               span += "size=\"" + dcp::raw_convert<string>(subtitle.size_in_pixels(target_height) * pixels_to_1024ths_point) + "\" ";
+               span += "size=\"" + dcp::raw_convert<string>(lrintf(subtitle.size_in_pixels(target_height) * pixels_to_1024ths_point)) + "\" ";
                /* Between 1-65535 inclusive, apparently... */
                span += "alpha=\"" + dcp::raw_convert<string>(int(floor(fade_factor * 65534)) + 1) + "\" ";
                span += "color=\"#" + subtitle.colour().to_rgb_string() + "\"";