X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Frendering%2Fview-model.cpp;h=3799fc9fe521d65e63c4d8c71081103153c7e04f;hb=HEAD;hp=5e014df78dc67710c94fa5c2527194c68d9a870c;hpb=e2d9cf42df969e809a572a5224d1ce5d19aaa1ca;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..7e3a4e3 100644 --- a/dali-toolkit/internal/text/rendering/view-model.cpp +++ b/dali-toolkit/internal/text/rendering/view-model.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Samsung Electronics Co., Ltd. + * Copyright (c) 2023 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,8 +23,8 @@ #include // INTERNAL INCLUDES -#include #include +#include namespace Dali { @@ -93,7 +93,7 @@ Length ViewModel::GetNumberOfLines() const return mModel->GetNumberOfLines(); } -const LineRun* const ViewModel::GetLines() const +const LineRun* ViewModel::GetLines() const { return mModel->GetLines(); } @@ -103,11 +103,16 @@ Length ViewModel::GetNumberOfScripts() const return mModel->GetNumberOfScripts(); } -const ScriptRun* const ViewModel::GetScriptRuns() const +const ScriptRun* ViewModel::GetScriptRuns() const { return mModel->GetScriptRuns(); } +Length ViewModel::GetNumberOfCharacters() const +{ + return mModel->GetNumberOfCharacters(); +} + Length ViewModel::GetNumberOfGlyphs() const { if(mIsTextElided && mModel->IsTextElideEnabled()) @@ -162,7 +167,7 @@ GlyphIndex ViewModel::GetSecondMiddleIndexOfElidedGlyphs() const return mModel->GetSecondMiddleIndexOfElidedGlyphs(); } -const GlyphInfo* const ViewModel::GetGlyphs() const +const GlyphInfo* ViewModel::GetGlyphs() const { if(mIsTextElided && mModel->IsTextElideEnabled()) { @@ -176,7 +181,7 @@ const GlyphInfo* const ViewModel::GetGlyphs() const return NULL; } -const Vector2* const ViewModel::GetLayout() const +const Vector2* ViewModel::GetLayout() const { if(mIsTextElided && mModel->IsTextElideEnabled()) { @@ -190,27 +195,27 @@ const Vector2* const ViewModel::GetLayout() const return NULL; } -const Vector4* const ViewModel::GetColors() const +const Vector4* ViewModel::GetColors() const { return mModel->GetColors(); } -const ColorIndex* const ViewModel::GetColorIndices() const +const ColorIndex* ViewModel::GetColorIndices() const { return mModel->GetColorIndices(); } -const Vector4* const ViewModel::GetBackgroundColors() const +const Vector4* ViewModel::GetBackgroundColors() const { return mModel->GetBackgroundColors(); } -const ColorIndex* const ViewModel::GetBackgroundColorIndices() const +const ColorIndex* ViewModel::GetBackgroundColorIndices() const { return mModel->GetBackgroundColorIndices(); } -bool const ViewModel::IsMarkupBackgroundColorSet() const +bool ViewModel::IsMarkupBackgroundColorSet() const { return mModel->IsMarkupBackgroundColorSet(); } @@ -245,6 +250,11 @@ bool ViewModel::IsUnderlineEnabled() const return mModel->IsUnderlineEnabled(); } +bool ViewModel::IsMarkupUnderlineSet() const +{ + return mModel->IsMarkupUnderlineSet(); +} + float ViewModel::GetUnderlineHeight() const { return mModel->GetUnderlineHeight(); @@ -270,11 +280,16 @@ 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); } +const Vector2& ViewModel::GetOutlineOffset() const +{ + return mModel->GetOutlineOffset(); +} + const Vector4& ViewModel::GetOutlineColor() const { return mModel->GetOutlineColor(); @@ -285,6 +300,11 @@ uint16_t ViewModel::GetOutlineWidth() const return mModel->GetOutlineWidth(); } +const float& ViewModel::GetOutlineBlurRadius() const +{ + return mModel->GetOutlineBlurRadius(); +} + const Vector4& ViewModel::GetBackgroundColor() const { return mModel->GetBackgroundColor(); @@ -300,6 +320,11 @@ bool ViewModel::IsMarkupProcessorEnabled() const return mModel->IsMarkupProcessorEnabled(); } +bool ViewModel::IsSpannedTextPlaced() const +{ + return mModel->IsSpannedTextPlaced(); +} + const GlyphInfo* ViewModel::GetHyphens() const { return mModel->GetHyphens(); @@ -315,7 +340,7 @@ Length ViewModel::GetHyphensCount() const return mModel->GetHyphensCount(); } -const float ViewModel::GetCharacterSpacing() const +float ViewModel::GetCharacterSpacing() const { return mModel->GetCharacterSpacing(); } @@ -524,7 +549,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 +724,11 @@ bool ViewModel::IsStrikethroughEnabled() const return mModel->IsStrikethroughEnabled(); } +bool ViewModel::IsMarkupStrikethroughSet() const +{ + return mModel->IsMarkupStrikethroughSet(); +} + Length ViewModel::GetNumberOfStrikethroughRuns() const { return mModel->GetNumberOfStrikethroughRuns(); @@ -645,6 +739,61 @@ 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(); +} + +bool ViewModel::IsRemoveFrontInset() const +{ + return mModel->IsRemoveFrontInset(); +} + +bool ViewModel::IsRemoveBackInset() const +{ + return mModel->IsRemoveBackInset(); +} + +bool ViewModel::IsCutoutEnabled() const +{ + return mModel->IsCutoutEnabled(); +} + +const bool ViewModel::IsBackgroundWithCutoutEnabled() const +{ + return mModel->IsBackgroundWithCutoutEnabled(); +} + +const Vector4& ViewModel::GetBackgroundColorWithCutout() const +{ + return mModel->GetBackgroundColorWithCutout(); +} + } // namespace Text } // namespace Toolkit