X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Ftext-controller-background-actor.cpp;h=bc7c79bfa8009a6c9876d11f0f6afe84c9c3d84b;hb=144dda05c357f536307dc5802dbf5c26cee53c33;hp=a129c5e329a131e6a7039910e4da217198c5b308;hpb=73d652743f20733dfa9c8b44f074fe390ce48825;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/text/text-controller-background-actor.cpp b/dali-toolkit/internal/text/text-controller-background-actor.cpp index a129c5e..bc7c79b 100644 --- a/dali-toolkit/internal/text/text-controller-background-actor.cpp +++ b/dali-toolkit/internal/text/text-controller-background-actor.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include namespace Dali::Toolkit::Text @@ -98,17 +99,19 @@ Actor CreateControllerBackgroundActor(const View& textView, const VisualModelPtr const Vector4* const backgroundColorsBuffer = textView.GetBackgroundColors(); const ColorIndex* const backgroundColorIndicesBuffer = textView.GetBackgroundColorIndices(); const Vector4& defaultBackgroundColor = textVisualModel->IsBackgroundEnabled() ? textVisualModel->GetBackgroundColor() : Color::TRANSPARENT; - const float characterSpacing = textVisualModel->GetCharacterSpacing(); + const float modelCharacterSpacing = textVisualModel->GetCharacterSpacing(); Vector& glyphToCharacterMap = textVisualModel->mGlyphsToCharacters; const CharacterIndex* glyphToCharacterMapBuffer = glyphToCharacterMap.Begin(); float calculatedAdvance = 0.f; + // Get the character-spacing runs. + const Vector& characterSpacingGlyphRuns = textVisualModel->GetCharacterSpacingGlyphRuns(); + Vector4 quad; uint32_t numberOfQuads = 0u; Length yLineOffset = 0; Length prevLineIndex = 0; LineIndex lineIndex; - Length numberOfLines; for(uint32_t i = 0, glyphSize = glyphs.Size(); i < glyphSize; ++i) { @@ -121,7 +124,7 @@ Actor CreateControllerBackgroundActor(const View& textView, const VisualModelPtr const bool isDefaultBackgroundColor = (0u == backgroundColorIndex); const Vector4& backgroundColor = isDefaultBackgroundColor ? defaultBackgroundColor : *(backgroundColorsBuffer + backgroundColorIndex - 1u); - textVisualModel->GetNumberOfLines(i, 1, lineIndex, numberOfLines); + lineIndex = textVisualModel->GetLineOfGlyph(i); Length lineHeight = CalculateBackgroundLineHeight(lineRun[lineIndex]); if(lineIndex != prevLineIndex) @@ -137,6 +140,8 @@ Actor CreateControllerBackgroundActor(const View& textView, const VisualModelPtr // Only create quads for glyphs with a background color if(backgroundColor != Color::TRANSPARENT) { + const float characterSpacing = GetGlyphCharacterSpacing(i, characterSpacingGlyphRuns, modelCharacterSpacing); + const Vector2 position = *(positionsBuffer + i); calculatedAdvance = GetCalculatedAdvance(*(textLogicalModel->mText.Begin() + (*(glyphToCharacterMapBuffer + i))), characterSpacing, glyph.advance);