changeset 2901:93c65e3a6bb1

fix
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 22 Oct 2018 16:12:59 +0200
parents 668d5ad73c74
children e80b38fb22c6
files Core/Images/Font.cpp
diffstat 1 files changed, 5 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/Core/Images/Font.cpp	Mon Oct 22 14:20:21 2018 +0200
+++ b/Core/Images/Font.cpp	Mon Oct 22 16:12:59 2018 +0200
@@ -354,7 +354,7 @@
 
     // Compute the text extent
     unsigned int x = 0;
-    unsigned int countLines = 0;
+    unsigned int y = 0;
     
     for (size_t i = 0; i < s.size(); i++)
     {
@@ -362,8 +362,7 @@
       {
         // Go to the next line
         x = 0;
-
-        countLines ++;
+        y += (maxHeight_ + 1);
       }
       else
       {
@@ -372,9 +371,10 @@
         {
           x += c->second->advance_;
 
-          if (countLines == 0)
+          unsigned int bottom = y + c->second->top_ + c->second->height_;
+          if (bottom > height)
           {
-            countLines = 1;
+            height = bottom;
           }
           
           if (x > width)
@@ -384,8 +384,6 @@
         }
       }
     }
-
-    height = countLines * (maxHeight_ + 1);
   }