[dali_2.1.7] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / text-controller.cpp
index 5ebd05a..1e1ab68 100644 (file)
@@ -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.
@@ -667,6 +667,9 @@ void Controller::SetFontSizeScale(float scale)
 {
   mImpl->mFontSizeScale = scale;
 
+  // No relayout is required
+  if(!mImpl->mFontSizeScaleEnabled) return;
+
   // Update the cursor position if it's in editing mode
   UpdateCursorPosition(mImpl->mEventData);
 
@@ -681,6 +684,24 @@ float Controller::GetFontSizeScale() const
   return mImpl->mFontDefaults ? mImpl->mFontSizeScale : 1.0f;
 }
 
+void Controller::SetFontSizeScaleEnabled(bool enabled)
+{
+  mImpl->mFontSizeScaleEnabled = enabled;
+
+  // Update the cursor position if it's in editing mode
+  UpdateCursorPosition(mImpl->mEventData);
+
+  // Clear the font-specific data
+  mImpl->ClearFontData();
+
+  mImpl->RequestRelayout();
+}
+
+bool Controller::IsFontSizeScaleEnabled() const
+{
+  return mImpl->mFontSizeScaleEnabled;
+}
+
 void Controller::SetDefaultFontSize(float fontSize, FontSizeType type)
 {
   EnsureCreated(mImpl->mFontDefaults);
@@ -805,6 +826,42 @@ float Controller::GetUnderlineHeight() const
   return mImpl->mModel->mVisualModel->GetUnderlineHeight();
 }
 
+void Controller::SetUnderlineType(Text::Underline::Type type)
+{
+  mImpl->mModel->mVisualModel->SetUnderlineType(type);
+
+  mImpl->RequestRelayout();
+}
+
+Text::Underline::Type Controller::GetUnderlineType() const
+{
+  return mImpl->mModel->mVisualModel->GetUnderlineType();
+}
+
+void Controller::SetDashedUnderlineWidth(float width)
+{
+  mImpl->mModel->mVisualModel->SetDashedUnderlineWidth(width);
+
+  mImpl->RequestRelayout();
+}
+
+float Controller::GetDashedUnderlineWidth() const
+{
+  return mImpl->mModel->mVisualModel->GetDashedUnderlineWidth();
+}
+
+void Controller::SetDashedUnderlineGap(float gap)
+{
+  mImpl->mModel->mVisualModel->SetDashedUnderlineGap(gap);
+
+  mImpl->RequestRelayout();
+}
+
+float Controller::GetDashedUnderlineGap() const
+{
+  return mImpl->mModel->mVisualModel->GetDashedUnderlineGap();
+}
+
 void Controller::SetOutlineColor(const Vector4& color)
 {
   mImpl->mModel->mVisualModel->SetOutlineColor(color);
@@ -1283,6 +1340,19 @@ void Controller::SetEllipsisPosition(Toolkit::DevelText::EllipsisPosition::Type
   mImpl->mModel->mVisualModel->SetEllipsisPosition(ellipsisPosition);
 }
 
+void Controller::SetCharacterSpacing(float characterSpacing)
+{
+  mImpl->mModel->mVisualModel->SetCharacterSpacing(characterSpacing);
+
+  mImpl->RelayoutAllCharacters();
+  mImpl->RequestRelayout();
+}
+
+const float Controller::GetCharacterSpacing() const
+{
+  return mImpl->mModel->mVisualModel->GetCharacterSpacing();
+}
+
 Controller::UpdateTextType Controller::Relayout(const Size& size, Dali::LayoutDirection::Type layoutDirection)
 {
   return Relayouter::Relayout(*this, size, layoutDirection);
@@ -1540,7 +1610,7 @@ bool Controller::ShouldClearFocusOnEscape() const
 
 Actor Controller::CreateBackgroundActor()
 {
-  return CreateControllerBackgroundActor(mImpl->mView, mImpl->mModel->mVisualModel, mImpl->mShaderBackground);
+  return CreateControllerBackgroundActor(mImpl->mView, mImpl->mModel->mVisualModel, mImpl->mModel->mLogicalModel, mImpl->mShaderBackground);
 }
 
 void Controller::GetAnchorActors(std::vector<Toolkit::TextAnchor>& anchorActors)