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=c87fe88cd8cfdeb27ce30903cabc8c4e09173408;hb=HEAD;hpb=5151d2e631f0173f3ad7a5600b7286317741a596 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 c87fe88..76b8ce3 100644 --- a/dali-toolkit/internal/text/rendering/styles/strikethrough-helper-functions.cpp +++ b/dali-toolkit/internal/text/rendering/styles/strikethrough-helper-functions.cpp @@ -24,7 +24,58 @@ namespace Toolkit { namespace Text { -/// Helper method to fetch the underline metrics for the specified font glyph +bool IsGlyphStrikethrough(GlyphIndex index, + const Vector& strikethroughRuns, + Vector::ConstIterator& currentStrikethroughGlyphRunIt) +{ + for(Vector::ConstIterator it = strikethroughRuns.Begin(), + endIt = strikethroughRuns.End(); + it != endIt; + ++it) + { + const StrikethroughGlyphRun& run = *it; + + if((run.glyphRun.glyphIndex <= index) && (index < run.glyphRun.glyphIndex + run.glyphRun.numberOfGlyphs)) + { + currentStrikethroughGlyphRunIt = it; + return true; + } + } + + return false; +} + +StrikethroughStyleProperties GetCurrentStrikethroughProperties(GlyphIndex index, + const bool& isGlyphStrikethrough, + const Vector& strikethroughRuns, + Vector::ConstIterator& currentStrikethroughGlyphRunIt, + const StrikethroughStyleProperties& commonStrikethroughProperties) +{ + StrikethroughStyleProperties currentStrikethroughStyleProperties = commonStrikethroughProperties; + + if(isGlyphStrikethrough && (currentStrikethroughGlyphRunIt != strikethroughRuns.End())) + { + // 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; + + if((run.glyphRun.glyphIndex <= index) && (index < (run.glyphRun.glyphIndex + run.glyphRun.numberOfGlyphs))) + { + currentStrikethroughGlyphRunIt = it; + } + } + + currentStrikethroughStyleProperties.OverrideByDefinedProperties(currentStrikethroughGlyphRunIt->properties); + } + + return currentStrikethroughStyleProperties; +} + +/// Helper method to fetch the strikethrough metrics for the specified font glyph void CalcualteStrikethroughHeight(float& currentStrikethroughHeight, float& maxStrikethroughHeight) { //Height of strikethrough represents the thickness of line.