]> git.sesse.net Git - casparcg/commitdiff
[text_producer] Fixed bug where tracking contributed to overall text width after...
authorHelge Norberg <helge.norberg@svt.se>
Thu, 6 Apr 2017 14:14:19 +0000 (16:14 +0200)
committerHelge Norberg <helge.norberg@svt.se>
Thu, 6 Apr 2017 14:14:19 +0000 (16:14 +0200)
core/producer/text/utils/texture_font.cpp

index 615865efe3867aa40820df18f992ae138ab4e36e..aa0fd1306c36f4572096734ce6472dab7ac37d8e 100644 (file)
@@ -201,7 +201,7 @@ public:
 
                if(normalize_)
                {
-                       auto ratio_x = parent_width / (pos_x - x);
+                       auto ratio_x = parent_width / (pos_x - tracking_ - x);
                        auto ratio_y = parent_height / static_cast<double>(maxHeight);
 
                        for (auto& coord : result)
@@ -213,11 +213,12 @@ public:
 
                if (metrics != nullptr)
                {
-                       metrics->width = (int)(pos_x - x + 0.5);
-                       metrics->bearingY = maxBearingY;
-                       metrics->height = maxHeight;
-                       metrics->protrudeUnderY = maxProtrudeUnderY;
+                       metrics->width                  = static_cast<int>(pos_x - tracking_ - x + 0.5);
+                       metrics->bearingY               = maxBearingY;
+                       metrics->height                 = maxHeight;
+                       metrics->protrudeUnderY = maxProtrudeUnderY;
                }
+
                return result;
        }