X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Frendering%2Fview-model.cpp;h=0c4aeb3e00c4fcf38e7b6cf9e9e7b7de263c25ca;hb=4d8dff121a1c79d5a545bc80b1a18b7f0f12beb5;hp=f02bb95004818ca9c1afe1c90cfefd96c6b47482;hpb=a5167c61104580ae0ab724f904537a3a01ea3061;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 f02bb95..0c4aeb3 100644 --- a/dali-toolkit/internal/text/rendering/view-model.cpp +++ b/dali-toolkit/internal/text/rendering/view-model.cpp @@ -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(); @@ -524,7 +529,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 +704,11 @@ bool ViewModel::IsStrikethroughEnabled() const return mModel->IsStrikethroughEnabled(); } +bool const ViewModel::IsMarkupStrikethroughSet() const +{ + return mModel->IsMarkupStrikethroughSet(); +} + Length ViewModel::GetNumberOfStrikethroughRuns() const { return mModel->GetNumberOfStrikethroughRuns();