X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Frendering%2Fstyles%2Funderline-helper-functions.cpp;h=873ef86c6bba63edcd04d1605e082a5a42954c61;hp=6720b917e2cf56a53b3b32c0913478d760ec72ac;hb=HEAD;hpb=a3c24db302ffb83a32a0b5d8fba0b2c9de2b6634 diff --git a/dali-toolkit/internal/text/rendering/styles/underline-helper-functions.cpp b/dali-toolkit/internal/text/rendering/styles/underline-helper-functions.cpp index 6720b91..873ef86 100644 --- a/dali-toolkit/internal/text/rendering/styles/underline-helper-functions.cpp +++ b/dali-toolkit/internal/text/rendering/styles/underline-helper-functions.cpp @@ -45,27 +45,34 @@ bool IsGlyphUnderlined(GlyphIndex index, return false; } -float GetCurrentUnderlineHeight(const Vector& underlineRuns, - Vector::ConstIterator currentUnderlinedGlyphRunIt, - const float underlineHeight) +UnderlineStyleProperties GetCurrentUnderlineProperties(GlyphIndex index, + const bool& isGlyphUnderlined, + const Vector& underlineRuns, + Vector::ConstIterator& currentUnderlinedGlyphRunIt, + const UnderlineStyleProperties& commonUnderlineProperties) { - if(currentUnderlinedGlyphRunIt == underlineRuns.End()) + UnderlineStyleProperties currentUnderlineStyleProperties = commonUnderlineProperties; + + if(isGlyphUnderlined && (currentUnderlinedGlyphRunIt != underlineRuns.End())) { - return underlineHeight; - } + // Retrieve the latest run to handle the nested case. + for(Vector::ConstIterator it = currentUnderlinedGlyphRunIt + 1, + endIt = underlineRuns.End(); + it != endIt; + ++it) + { + const UnderlinedGlyphRun& run = *it; - const UnderlinedGlyphRun& underlinedGlyphRun = *currentUnderlinedGlyphRunIt; - return (underlinedGlyphRun.properties.heightDefined ? underlinedGlyphRun.properties.height : underlineHeight); -} + if((run.glyphRun.glyphIndex <= index) && (index < (run.glyphRun.glyphIndex + run.glyphRun.numberOfGlyphs))) + { + currentUnderlinedGlyphRunIt = it; + } + } -UnderlineStyleProperties GetCurrentUnderlineProperties(const bool& isGlyphUnderlined, - const Vector& underlineRuns, - Vector::ConstIterator currentUnderlinedGlyphRunIt, - const UnderlineStyleProperties& commonUnderlineProperties) -{ - return (isGlyphUnderlined && (currentUnderlinedGlyphRunIt != underlineRuns.End())) - ? currentUnderlinedGlyphRunIt->properties - : commonUnderlineProperties; + currentUnderlineStyleProperties.OverrideByDefinedProperties(currentUnderlinedGlyphRunIt->properties); + } + + return currentUnderlineStyleProperties; } float FetchUnderlinePositionFromFontMetrics(const FontMetrics& fontMetrics)