X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Ftext-controller-impl.cpp;h=db6fde1c81297e6967136ffe041522ecd59ffd15;hb=2512aa2794f3c5ea5841542b9ed9c8c32973540b;hp=e0603f81b43d6f2e2ad720dd41160f6c2e8f9889;hpb=48000ec3ab1ca2d1f8001d192112e32357bb1dfc;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 e0603f8..db6fde1 100644 --- a/dali-toolkit/internal/text/text-controller-impl.cpp +++ b/dali-toolkit/internal/text/text-controller-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. + * Copyright (c) 2022 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,11 +22,13 @@ #include #include #include +#include #include // INTERNAL INCLUDES #include #include +#include #include #include #include @@ -672,11 +674,11 @@ float Controller::Impl::GetDefaultFontLineHeight() if(nullptr == mFontDefaults) { TextAbstraction::FontDescription fontDescription; - defaultFontId = mFontClient.GetFontId(fontDescription, TextAbstraction::FontClient::DEFAULT_POINT_SIZE * mFontSizeScale); + defaultFontId = mFontClient.GetFontId(fontDescription, TextAbstraction::FontClient::DEFAULT_POINT_SIZE * GetFontSizeScale()); } else { - defaultFontId = mFontDefaults->GetFontId(mFontClient, mFontDefaults->mDefaultPointSize * mFontSizeScale); + defaultFontId = mFontDefaults->GetFontId(mFontClient, mFontDefaults->mDefaultPointSize * GetFontSizeScale()); } Text::FontMetrics fontMetrics; @@ -691,7 +693,7 @@ bool Controller::Impl::SetDefaultLineSpacing(float lineSpacing) { mLayoutEngine.SetDefaultLineSpacing(lineSpacing); - RelayoutForNewLineSize(); + RelayoutAllCharacters(); return true; } return false; @@ -703,7 +705,7 @@ bool Controller::Impl::SetDefaultLineSize(float lineSize) { mLayoutEngine.SetDefaultLineSize(lineSize); - RelayoutForNewLineSize(); + RelayoutAllCharacters(); return true; } return false; @@ -1461,7 +1463,7 @@ void Controller::Impl::RequestRelayout() } } -void Controller::Impl::RelayoutForNewLineSize() +void Controller::Impl::RelayoutAllCharacters() { // relayout all characters mTextUpdateInfo.mCharacterIndex = 0; @@ -1626,6 +1628,34 @@ void Controller::Impl::CopyUnderlinedFromLogicalToVisualModels(bool shouldClearP } } +void Controller::Impl::CopyStrikethroughFromLogicalToVisualModels() +{ + //Strikethrough character runs from markup-processor + const Vector& strikethroughCharacterRuns = mModel->mLogicalModel->mStrikethroughCharacterRuns; + const Vector& charactersToGlyph = mModel->mVisualModel->mCharactersToGlyph; + const Vector& glyphsPerCharacter = mModel->mVisualModel->mGlyphsPerCharacter; + + mModel->mVisualModel->mStrikethroughRuns.Clear(); + + for(Vector::ConstIterator it = strikethroughCharacterRuns.Begin(), endIt = strikethroughCharacterRuns.End(); it != endIt; ++it) + { + CharacterIndex characterIndex = it->characterRun.characterIndex; + Length numberOfCharacters = it->characterRun.numberOfCharacters; + StrikethroughGlyphRun strikethroughGlyphRun; + strikethroughGlyphRun.color = it->color; + strikethroughGlyphRun.isColorSet = it->isColorSet; + strikethroughGlyphRun.glyphRun.glyphIndex = charactersToGlyph[characterIndex]; + strikethroughGlyphRun.glyphRun.numberOfGlyphs = glyphsPerCharacter[characterIndex]; + + for(Length index = 1u; index < numberOfCharacters; index++) + { + strikethroughGlyphRun.glyphRun.numberOfGlyphs += glyphsPerCharacter[characterIndex + index]; + } + + mModel->mVisualModel->mStrikethroughRuns.PushBack(strikethroughGlyphRun); + } +} + void Controller::Impl::SetAutoScrollEnabled(bool enable) { if(mLayoutEngine.GetLayout() == Layout::Engine::SINGLE_LINE_BOX)