Improve accuracy of subtitle font sizing.
[dcpomatic.git] / src / lib / render_text.cc
index 6f7614d36f5050b4bde1f9c553c59d5827110f7f..e0eb3da7b9f22af7e0eb7fdfe8fd9100246000a5 100644 (file)
 #include "render_text.h"
 #include "types.h"
 #include "util.h"
-#include "warnings.h"
 #include <dcp/raw_convert.h>
+#include <dcp/warnings.h>
 #include <fontconfig/fontconfig.h>
 #include <cairomm/cairomm.h>
-DCPOMATIC_DISABLE_WARNINGS
+LIBDCP_DISABLE_WARNINGS
 #include <pangomm.h>
-DCPOMATIC_ENABLE_WARNINGS
+LIBDCP_ENABLE_WARNINGS
 #include <pango/pangocairo.h>
 #include <boost/algorithm/string.hpp>
 #include <iostream>
@@ -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() + "\"";