Resolved incorrect size when call GetTextSize(TextLabel) for one glyph
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / text-view.cpp
index 1ec978d..9c067de 100644 (file)
@@ -114,17 +114,17 @@ Length View::GetGlyphs(GlyphInfo* glyphs,
   float                   calculatedAdvance           = 0.f;
   const Character*        textBuffer                  = mImpl->mLogicalModel->mText.Begin();
 
-  // Get the character-spacing runs.
-  const Vector<CharacterSpacingGlyphRun>& characterSpacingGlyphRuns = mImpl->mVisualModel->GetCharacterSpacingGlyphRuns();
-
   if(mImpl->mVisualModel)
   {
+    // Get the character-spacing runs.
+    const Vector<CharacterSpacingGlyphRun>& characterSpacingGlyphRuns = mImpl->mVisualModel->GetCharacterSpacingGlyphRuns();
+
     bool                              textElided       = false;
     DevelText::EllipsisPosition::Type ellipsisPosition = GetEllipsisPosition();
 
     //Reset indices of ElidedGlyphs
     mImpl->mVisualModel->SetStartIndexOfElidedGlyphs(0u);
-    mImpl->mVisualModel->SetEndIndexOfElidedGlyphs(numberOfGlyphs);
+    mImpl->mVisualModel->SetEndIndexOfElidedGlyphs(numberOfGlyphs - 1u); // Initialization is the last index of Glyphs
     mImpl->mVisualModel->SetFirstMiddleIndexOfElidedGlyphs(0u);
     mImpl->mVisualModel->SetSecondMiddleIndexOfElidedGlyphs(0u);