X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Fmarkup-processor-underline.cpp;h=8f19b5a871d6335107d9922b870cb713940cbac5;hp=063f3fe3d58a39b78e2cf5fd9f291bb824216f07;hb=cee2831414bee408f07923a17cad74671c14d180;hpb=ee33f54bcefdc59971ffa428e6f8e4bdd31b94ed diff --git a/dali-toolkit/internal/text/markup-processor-underline.cpp b/dali-toolkit/internal/text/markup-processor-underline.cpp index 063f3fe..8f19b5a 100644 --- a/dali-toolkit/internal/text/markup-processor-underline.cpp +++ b/dali-toolkit/internal/text/markup-processor-underline.cpp @@ -108,6 +108,44 @@ void ProcessUnderlineTag(const Tag& tag, UnderlinedCharacterRun& underlinedChara } } +void OverrideNestedUnderlinedCharacterRuns(Vector& underlinedCharacterRuns) +{ + // Handle nested tags + // The inner tag inherit the attributes of the outer tag and override them when defined in the inner tag. + // Example: + // outer tag before inner tag outer tag after + // "outer tag before" and "outer tag after" have height = 5.0f and color = 'blue' + // "inner tag" has height = 5.0f and color = 'green' + + if(underlinedCharacterRuns.Count() > 0u) + { + Vector::ConstIterator preIt = underlinedCharacterRuns.Begin(); + + Vector::Iterator it = underlinedCharacterRuns.Begin() + 1; + Vector::ConstIterator endIt = underlinedCharacterRuns.End(); + + while(it != endIt) + { + const UnderlinedCharacterRun& run = *it; + const CharacterIndex& characterIndex = run.characterRun.characterIndex; + const Length& numberOfCharacters = run.characterRun.numberOfCharacters; + + const UnderlinedCharacterRun& preRun = *preIt; + const CharacterIndex& preCharacterIndex = preRun.characterRun.characterIndex; + const Length& preNumberOfCharacters = preRun.characterRun.numberOfCharacters; + + if((preCharacterIndex <= characterIndex) && + ((characterIndex + numberOfCharacters) <= (preCharacterIndex + preNumberOfCharacters))) + { + it->properties.CopyIfNotDefined(preIt->properties); + } + + it++; + preIt++; + } + } +} + } // namespace Text } // namespace Toolkit