[Tizen] Hebrew language text is cutted in TextLabel. 24/215324/1
authorJoogab Yun <joogab.yun@samsung.com>
Fri, 4 Oct 2019 06:52:59 +0000 (15:52 +0900)
committerJoogab Yun <joogab.yun@samsung.com>
Mon, 7 Oct 2019 05:21:09 +0000 (14:21 +0900)
The Hebrew on the second line is cut off.

example)
TextLabel labelD = TextLabel::New();
labelD.SetSize( 500, 200 );
labelD.SetParentOrigin(ParentOrigin::TOP_LEFT);
labelD.SetAnchorPoint(AnchorPoint::TOP_LEFT);
labelD.SetPosition( 100.f, 700.f);
labelD.SetProperty(TextLabel::Property::POINT_SIZE, 23.f);
labelD.SetProperty(Dali::Toolkit::TextLabel::Property::TEXT, "זיהוי קול אינו זמין בשפת התצוגה הנוכחית. זיהוי קול יסופק בשפה האנגלית.");
labelD.SetProperty(TextLabel::Property::MULTI_LINE, true);
stage.Add( labelD );

Change-Id: I915702bb2184a40f11b3fcb80c6fc4d00744c892

dali-toolkit/internal/text/layouts/layout-engine.cpp

index 9d1b93d..6a93d6b 100755 (executable)
@@ -224,7 +224,7 @@ struct Engine::Impl
     // The initial start point is zero. However it needs a correction according the 'x' bearing of the first glyph.
     // i.e. if the bearing of the first glyph is negative it may exceed the boundaries of the text area.
     // It needs to add as well space for the cursor if the text is in edit mode and extra space in case the text is outlined.
-    tmpLineLayout.penX = -glyphMetrics.xBearing + mCursorWidth + parameters.outlineWidth;
+    tmpLineLayout.penX = ( 0.f > glyphMetrics.xBearing ) ? -glyphMetrics.xBearing  : 0.f + mCursorWidth + parameters.outlineWidth;
 
     // Initialize the advance of the previous glyph.
     tmpLineLayout.previousAdvance = 0.f;
@@ -298,9 +298,9 @@ struct Engine::Impl
       }
       else
       {
-        tmpLineLayout.penX += tmpLineLayout.previousAdvance + tmpLineLayout.wsLengthEndOfLine;
         tmpLineLayout.previousAdvance = ( glyphMetrics.advance + parameters.interGlyphExtraAdvance );
-        tmpLineLayout.length = tmpLineLayout.penX + glyphMetrics.xBearing + glyphMetrics.width;
+        tmpLineLayout.penX += tmpLineLayout.previousAdvance + tmpLineLayout.wsLengthEndOfLine;
+        tmpLineLayout.length = tmpLineLayout.penX;
 
         // Clear the white space length at the end of the line.
         tmpLineLayout.wsLengthEndOfLine = 0.f;
@@ -391,7 +391,7 @@ struct Engine::Impl
     // so the penX position needs to be moved to the right.
 
     const GlyphInfo& glyph = *glyphsBuffer;
-    float penX = -glyph.xBearing + mCursorWidth + outlineWidth;
+    float penX = ( 0.f > glyph.xBearing ) ? -glyph.xBearing : 0.f + mCursorWidth + outlineWidth;
 
     for( GlyphIndex i = 0u; i < numberOfGlyphs; ++i )
     {
@@ -985,7 +985,7 @@ struct Engine::Impl
       const CharacterIndex characterVisualIndex = bidiLine.characterRun.characterIndex + *bidiLine.visualToLogicalMap;
       const GlyphInfo& glyph = *( layoutParameters.glyphsBuffer + *( layoutParameters.charactersToGlyphsBuffer + characterVisualIndex ) );
 
-      float penX = -glyph.xBearing + layoutParameters.outlineWidth + mCursorWidth;
+      float penX = ( 0.f > glyph.xBearing ) ? -glyph.xBearing  : 0.f  + layoutParameters.outlineWidth + mCursorWidth;
 
       Vector2* glyphPositionsBuffer = glyphPositions.Begin();