fix linespacing calculation in TextLabel 59/272959/2
authorAbdulleh Ghujeh <abdullahhasan10@gmail.com>
Mon, 28 Mar 2022 12:29:35 +0000 (15:29 +0300)
committerabdulleh ghujeh <abdullahhasan10@gmail.com>
Mon, 28 Mar 2022 12:32:13 +0000 (12:32 +0000)
line spacing for current line should affect next line not the current one
Change-Id: I0a650dc34aad2aa8d41b85bee7d0912553e8faa5

dali-toolkit/internal/text/rendering/text-typesetter.cpp

index 9d58934..33df43d 100644 (file)
@@ -847,12 +847,6 @@ Devel::PixelBuffer Typesetter::CreateImageBuffer(const unsigned int bufferWidth,
     // Increases the vertical offset with the line's ascender.
     glyphData.verticalOffset += static_cast<int>(line.ascender);
 
-    // Include line spacing after first line
-    if(lineIndex > 0u)
-    {
-      glyphData.verticalOffset += static_cast<int>(line.lineSpacing);
-    }
-
     // Retrieves the glyph's outline width
     float outlineWidth = static_cast<float>(mModel->GetOutlineWidth());
 
@@ -1153,8 +1147,8 @@ Devel::PixelBuffer Typesetter::CreateImageBuffer(const unsigned int bufferWidth,
       DrawStrikethrough(bufferWidth, bufferHeight, glyphData, baseline, strikethroughStartingYPosition, maxStrikethroughHeight, lineExtentLeft, lineExtentRight, modelStrikethroughProperties, currentStrikethroughProperties, line);
     }
 
-    // Increases the vertical offset with the line's descender.
-    glyphData.verticalOffset += static_cast<int>(-line.descender);
+    // Increases the vertical offset with the line's descender & line spacing.
+    glyphData.verticalOffset += static_cast<int>(-line.descender+line.lineSpacing);
   }
 
   return glyphData.bitmapBuffer;