X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Frendering%2Fview-model.cpp;h=0b26e4e73825baed98099a8cfbb2b5ecc4e54c62;hp=e446294545ae462882c66b34bca2dea9ad3aa794;hb=29bbe2381a1cfdd96757dfd441e7f9747560b2c8;hpb=120b951f49a8f1bb98adc557b9415dd044632e5d diff --git a/dali-toolkit/internal/text/rendering/view-model.cpp b/dali-toolkit/internal/text/rendering/view-model.cpp index e446294..0b26e4e 100644 --- a/dali-toolkit/internal/text/rendering/view-model.cpp +++ b/dali-toolkit/internal/text/rendering/view-model.cpp @@ -23,6 +23,7 @@ #include // INTERNAL INCLUDES +#include #include namespace Dali @@ -269,7 +270,7 @@ Length ViewModel::GetNumberOfUnderlineRuns() const return mModel->GetNumberOfUnderlineRuns(); } -void ViewModel::GetUnderlineRuns(GlyphRun* underlineRuns, UnderlineRunIndex index, Length numberOfRuns) const +void ViewModel::GetUnderlineRuns(UnderlinedGlyphRun* underlineRuns, UnderlineRunIndex index, Length numberOfRuns) const { mModel->GetUnderlineRuns(underlineRuns, index, numberOfRuns); } @@ -314,13 +315,33 @@ Length ViewModel::GetHyphensCount() const return mModel->GetHyphensCount(); } +const float ViewModel::GetCharacterSpacing() const +{ + return mModel->GetCharacterSpacing(); +} + +const Character* ViewModel::GetTextBuffer() const +{ + return mModel->GetTextBuffer(); +} + +const Vector& ViewModel::GetGlyphsToCharacters() const +{ + return mModel->GetGlyphsToCharacters(); +} + void ViewModel::ElideGlyphs() { mIsTextElided = false; mStartIndexOfElidedGlyphs = mFirstMiddleIndexOfElidedGlyphs = mSecondMiddleIndexOfElidedGlyphs = 0; mEndIndexOfElidedGlyphs = mModel->GetNumberOfGlyphs() - 1u; - auto ellipsisPosition = GetEllipsisPosition(); + auto ellipsisPosition = GetEllipsisPosition(); + auto characterSpacing = GetCharacterSpacing(); + const Character* textBuffer = GetTextBuffer(); + const Vector& glyphToCharacterMap = GetGlyphsToCharacters(); + const CharacterIndex* glyphToCharacterMapBuffer = glyphToCharacterMap.Begin(); + float calculatedAdvance = 0.f; if(IsTextElideEnabled()) { @@ -484,7 +505,8 @@ void ViewModel::ElideGlyphs() firstPenSet = true; } - removedGlypsWidth += std::min(glyphToRemove.advance, (glyphToRemove.xBearing + glyphToRemove.width)); + calculatedAdvance = GetCalculatedAdvance(*(textBuffer + (*(glyphToCharacterMapBuffer + indexOfEllipsis))), characterSpacing, glyphToRemove.advance); + removedGlypsWidth += std::min(calculatedAdvance, (glyphToRemove.xBearing + glyphToRemove.width)); // Calculate the width of the ellipsis glyph and check if it fits. const float ellipsisGlyphWidth = ellipsisGlyph.width + ellipsisGlyph.xBearing; @@ -623,6 +645,16 @@ void ViewModel::GetStrikethroughRuns(StrikethroughGlyphRun* strikethroughRuns, S mModel->GetStrikethroughRuns(strikethroughRuns, index, numberOfRuns); } +Length ViewModel::GetNumberOfBoundedParagraphRuns() const +{ + return mModel->GetNumberOfBoundedParagraphRuns(); +} + +const Vector& ViewModel::GetBoundedParagraphRuns() const +{ + return mModel->GetBoundedParagraphRuns(); +} + } // namespace Text } // namespace Toolkit