Fixed GetHeightForWidth for text label
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / text / layouts / layout-engine.cpp
index ae65e17..e6a3a63 100644 (file)
@@ -102,6 +102,8 @@ struct LayoutEngine::Impl
       }
 
       visualModel.SetGlyphPositions( &glyphPositions[0], glyphCount );
+
+      visualModel.SetActualSize( Vector2(penX, fontMetrics.height) );
     }
   }
 
@@ -166,11 +168,12 @@ struct LayoutEngine::Impl
           }
           else if( endPenX > boundingBox.width )
           {
-            actualSize.width = ( actualSize.width < endPenX - glyph.advance ) ? endPenX - glyph.advance : actualSize.width;
             break;
           }
         }
 
+        actualSize.width = ( actualSize.width < endPenX ) ? endPenX : actualSize.width;
+
         // If end of text or no whitespace found
         if( glyphCount == j ||
             endIndex == i )