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%2Fstrikethrough-helper-functions.cpp;h=76b8ce38022f9e6fce9a928ab3f4f837c2a6e6c6;hp=b28f90f07c94e13f448098fa86b83af2203ab369;hb=e770d32b7703435f37ec18ceadf76df623355c24;hpb=8ef941787d6c53b99d72ab3cef4a55ae1d9e7e6d diff --git a/dali-toolkit/internal/text/rendering/styles/strikethrough-helper-functions.cpp b/dali-toolkit/internal/text/rendering/styles/strikethrough-helper-functions.cpp index b28f90f..76b8ce3 100644 --- a/dali-toolkit/internal/text/rendering/styles/strikethrough-helper-functions.cpp +++ b/dali-toolkit/internal/text/rendering/styles/strikethrough-helper-functions.cpp @@ -45,27 +45,34 @@ bool IsGlyphStrikethrough(GlyphIndex index, return false; } -float GetCurrentStrikethroughHeight(const Vector& strikethroughRuns, - Vector::ConstIterator currentStrikethroughGlyphRunIt, - const float strikethroughHeight) +StrikethroughStyleProperties GetCurrentStrikethroughProperties(GlyphIndex index, + const bool& isGlyphStrikethrough, + const Vector& strikethroughRuns, + Vector::ConstIterator& currentStrikethroughGlyphRunIt, + const StrikethroughStyleProperties& commonStrikethroughProperties) { - if(currentStrikethroughGlyphRunIt == strikethroughRuns.End()) + StrikethroughStyleProperties currentStrikethroughStyleProperties = commonStrikethroughProperties; + + if(isGlyphStrikethrough && (currentStrikethroughGlyphRunIt != strikethroughRuns.End())) { - return strikethroughHeight; - } + // Retrieve the latest run to handle the nested case. + for(Vector::ConstIterator it = currentStrikethroughGlyphRunIt + 1, + endIt = strikethroughRuns.End(); + it != endIt; + ++it) + { + const StrikethroughGlyphRun& run = *it; - const StrikethroughGlyphRun& strikethroughGlyphRun = *currentStrikethroughGlyphRunIt; - return (strikethroughGlyphRun.properties.heightDefined ? strikethroughGlyphRun.properties.height : strikethroughHeight); -} + if((run.glyphRun.glyphIndex <= index) && (index < (run.glyphRun.glyphIndex + run.glyphRun.numberOfGlyphs))) + { + currentStrikethroughGlyphRunIt = it; + } + } -StrikethroughStyleProperties GetCurrentStrikethroughProperties(const bool& isGlyphStrikethrough, - const Vector& strikethroughRuns, - Vector::ConstIterator currentStrikethroughGlyphRunIt, - const StrikethroughStyleProperties& commonStrikethroughProperties) -{ - return (isGlyphStrikethrough && (currentStrikethroughGlyphRunIt != strikethroughRuns.End())) - ? currentStrikethroughGlyphRunIt->properties - : commonStrikethroughProperties; + currentStrikethroughStyleProperties.OverrideByDefinedProperties(currentStrikethroughGlyphRunIt->properties); + } + + return currentStrikethroughStyleProperties; } /// Helper method to fetch the strikethrough metrics for the specified font glyph