X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Ftext-controller-impl.cpp;h=e97535cf0ec1e0847ba03f6919c623cd1f077488;hb=e770d32b7703435f37ec18ceadf76df623355c24;hp=294b534827cb45dbcac1a360fa9de708816527a8;hpb=a3c24db302ffb83a32a0b5d8fba0b2c9de2b6634;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/text/text-controller-impl.cpp b/dali-toolkit/internal/text/text-controller-impl.cpp index 294b534..e97535c 100644 --- a/dali-toolkit/internal/text/text-controller-impl.cpp +++ b/dali-toolkit/internal/text/text-controller-impl.cpp @@ -712,6 +712,23 @@ bool Controller::Impl::SetDefaultLineSize(float lineSize) return false; } +bool Controller::Impl::SetRelativeLineSize(float relativeLineSize) +{ + if(std::fabs(relativeLineSize - GetRelativeLineSize()) > Math::MACHINE_EPSILON_1000) + { + mLayoutEngine.SetRelativeLineSize(relativeLineSize); + + RelayoutAllCharacters(); + return true; + } + return false; +} + +float Controller::Impl::GetRelativeLineSize() +{ + return mLayoutEngine.GetRelativeLineSize(); +} + string Controller::Impl::GetSelectedText() { string text; @@ -1619,26 +1636,26 @@ void Controller::Impl::CopyUnderlinedFromLogicalToVisualModels(bool shouldClearP { CharacterIndex characterIndex = it->characterRun.characterIndex; Length numberOfCharacters = it->characterRun.numberOfCharacters; - for(Length index = 0u; index < numberOfCharacters; index++) + + if(numberOfCharacters == 0) + { + continue; + } + + // Create one run for all glyphs of all run's characters that has same properties + // This enhance performance and reduce the needed memory to store glyphs-runs + UnderlinedGlyphRun underlineGlyphRun; + underlineGlyphRun.glyphRun.glyphIndex = charactersToGlyph[characterIndex]; + underlineGlyphRun.glyphRun.numberOfGlyphs = glyphsPerCharacter[characterIndex]; + //Copy properties (attributes) + underlineGlyphRun.properties = it->properties; + + for(Length index = 1u; index < numberOfCharacters; index++) { - UnderlinedGlyphRun underlineGlyphRun; - underlineGlyphRun.glyphRun.glyphIndex = charactersToGlyph[characterIndex + index]; - underlineGlyphRun.glyphRun.numberOfGlyphs = glyphsPerCharacter[characterIndex + index]; - - //Copy properties (attributes) - underlineGlyphRun.properties.type = it->properties.type; - underlineGlyphRun.properties.color = it->properties.color; - underlineGlyphRun.properties.height = it->properties.height; - underlineGlyphRun.properties.dashGap = it->properties.dashGap; - underlineGlyphRun.properties.dashWidth = it->properties.dashWidth; - underlineGlyphRun.properties.typeDefined = it->properties.typeDefined; - underlineGlyphRun.properties.colorDefined = it->properties.colorDefined; - underlineGlyphRun.properties.heightDefined = it->properties.heightDefined; - underlineGlyphRun.properties.dashGapDefined = it->properties.dashGapDefined; - underlineGlyphRun.properties.dashWidthDefined = it->properties.dashWidthDefined; - - mModel->mVisualModel->mUnderlineRuns.PushBack(underlineGlyphRun); + underlineGlyphRun.glyphRun.numberOfGlyphs += glyphsPerCharacter[characterIndex + index]; } + + mModel->mVisualModel->mUnderlineRuns.PushBack(underlineGlyphRun); } } @@ -1662,8 +1679,7 @@ void Controller::Impl::CopyStrikethroughFromLogicalToVisualModels() } StrikethroughGlyphRun strikethroughGlyphRun; - strikethroughGlyphRun.color = it->color; - strikethroughGlyphRun.isColorSet = it->isColorSet; + strikethroughGlyphRun.properties = it->properties; strikethroughGlyphRun.glyphRun.glyphIndex = charactersToGlyph[characterIndex]; strikethroughGlyphRun.glyphRun.numberOfGlyphs = glyphsPerCharacter[characterIndex];