X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Frendering%2Fview-model.cpp;h=725f945f36e6d720e3793ac5cc7a664e461e9880;hb=31d704fbcf71a27571c66b30452a0c6ab4fe9b6e;hp=5e014df78dc67710c94fa5c2527194c68d9a870c;hpb=d7bf9a0c46a7900e7c066711463babd639154f73;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/text/rendering/view-model.cpp b/dali-toolkit/internal/text/rendering/view-model.cpp index 5e014df..725f945 100644 --- a/dali-toolkit/internal/text/rendering/view-model.cpp +++ b/dali-toolkit/internal/text/rendering/view-model.cpp @@ -23,8 +23,8 @@ #include // INTERNAL INCLUDES -#include #include +#include namespace Dali { @@ -245,6 +245,11 @@ bool ViewModel::IsUnderlineEnabled() const return mModel->IsUnderlineEnabled(); } +bool const ViewModel::IsMarkupUnderlineSet() const +{ + return mModel->IsMarkupUnderlineSet(); +} + float ViewModel::GetUnderlineHeight() const { return mModel->GetUnderlineHeight(); @@ -270,7 +275,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); } @@ -300,6 +305,11 @@ bool ViewModel::IsMarkupProcessorEnabled() const return mModel->IsMarkupProcessorEnabled(); } +bool ViewModel::IsSpannedTextPlaced() const +{ + return mModel->IsSpannedTextPlaced(); +} + const GlyphInfo* ViewModel::GetHyphens() const { return mModel->GetHyphens(); @@ -524,7 +534,71 @@ void ViewModel::ElideGlyphs() // Change the 'x' and 'y' position of the ellipsis glyph. if(position.x > firstPenX) { - position.x = firstPenX + removedGlypsWidth - ellipsisGlyphWidth; + if(isTailMode) + { + // To handle case of the mixed languages (LTR then RTL) with + // EllipsisPosition::END and the LayoutDirection::RIGHT_TO_LEFT + float nextXPositions = ellipsisLine->width; + if(indexOfEllipsis + 1u < numberOfGlyphs) + { + Vector2& positionOfNextGlyph = *(elidedPositionsBuffer + indexOfEllipsis + 1u); + nextXPositions = positionOfNextGlyph.x; + } + + if(position.x > nextXPositions) // RTL language + { + if((indexOfEllipsis > 0u) && ((position.x - nextXPositions) > removedGlypsWidth)) + { + // To handle mixed directions + // Re-calculates the first penX which will be used if rtl text is elided. + firstPenX = position.x - glyphToRemove.xBearing; + if(firstPenX < -ellipsisGlyph.xBearing) + { + // Avoids to exceed the bounding box when rtl text is elided. + firstPenX = -ellipsisGlyph.xBearing; + } + //Reset the width of removed glyphs + removedGlypsWidth = std::min(calculatedAdvance, (glyphToRemove.xBearing + glyphToRemove.width)) - ellipsisGlyph.xBearing; + + --indexOfEllipsis; + continue; + } + else + { + // To handle the case of RTL language with EllipsisPosition::END + position.x = firstPenX + removedGlypsWidth - ellipsisGlyphWidth; + } + } + } + else + { + // To handle the case of LTR language with EllipsisPosition::START + position.x = firstPenX + removedGlypsWidth - ellipsisGlyphWidth; + } + } + else + { + if(!isTailMode) + { + // To handle case of the mixed languages (RTL then LTR) with + // EllipsisPosition::START and the LayoutDirection::RIGHT_TO_LEFT + float nextXPositions = ellipsisLine->width; + if(indexOfEllipsis + 1u < numberOfGlyphs) + { + Vector2& positionOfNextGlyph = *(elidedPositionsBuffer + indexOfEllipsis + 1u); + nextXPositions = positionOfNextGlyph.x; + } + + if(position.x < nextXPositions) // LTR language + { + position.x = firstPenX + removedGlypsWidth - ellipsisGlyphWidth; + + if((position.x + ellipsisGlyphWidth + ellipsisGlyph.xBearing) > nextXPositions) + { + position.x -= (position.x + ellipsisGlyphWidth + ellipsisGlyph.xBearing) - nextXPositions; + } + } + } } position.x += ellipsisGlyph.xBearing; @@ -635,6 +709,11 @@ bool ViewModel::IsStrikethroughEnabled() const return mModel->IsStrikethroughEnabled(); } +bool const ViewModel::IsMarkupStrikethroughSet() const +{ + return mModel->IsMarkupStrikethroughSet(); +} + Length ViewModel::GetNumberOfStrikethroughRuns() const { return mModel->GetNumberOfStrikethroughRuns(); @@ -645,6 +724,36 @@ 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(); +} + +Length ViewModel::GetNumberOfCharacterSpacingGlyphRuns() const +{ + return mModel->GetNumberOfCharacterSpacingGlyphRuns(); +} + +const Vector& ViewModel::GetCharacterSpacingGlyphRuns() const +{ + return mModel->GetCharacterSpacingGlyphRuns(); +} + +const Vector& ViewModel::GetFontRuns() const +{ + return mModel->GetFontRuns(); +} + +const Vector& ViewModel::GetFontDescriptionRuns() const +{ + return mModel->GetFontDescriptionRuns(); +} + } // namespace Text } // namespace Toolkit