Merge "Keep reference when member callback excute + Make NPatchData as RefObject...
authorDavid Steele <david.steele@samsung.com>
Thu, 12 Oct 2023 10:24:28 +0000 (10:24 +0000)
committerGerrit Code Review <gerrit@review>
Thu, 12 Oct 2023 10:24:28 +0000 (10:24 +0000)
automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp
dali-toolkit/devel-api/controls/text-controls/text-label-devel.cpp
dali-toolkit/devel-api/controls/text-controls/text-label-devel.h
dali-toolkit/internal/controls/text-controls/text-label-impl.cpp
dali-toolkit/internal/controls/text-controls/text-label-impl.h
dali-toolkit/internal/text/controller/text-controller-impl-model-updater.cpp
dali-toolkit/internal/text/controller/text-controller-impl.h
dali-toolkit/internal/text/controller/text-controller-relayouter.cpp
dali-toolkit/internal/text/controller/text-controller-relayouter.h
dali-toolkit/internal/text/controller/text-controller.cpp
dali-toolkit/internal/text/controller/text-controller.h

index bdaeb5b..8db73dd 100644 (file)
@@ -2078,6 +2078,72 @@ int UtcDaliToolkitTextlabelTextFitStressTest(void)
   END_TEST;
 }
 
+int UtcDaliToolkitTextlabelTextFitArray(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" UtcDaliToolkitTextlabelTextFitArray");
+  TextLabel label = TextLabel::New();
+  Vector2   size(300.0f, 80.0f);
+  label.SetProperty(Actor::Property::SIZE, size);
+  label.SetProperty(TextLabel::Property::TEXT, "A Quick Brown Fox Jumps Over The Lazy Dog");
+  label.SetProperty(DevelTextLabel::Property::MIN_LINE_SIZE, 80.f);
+  label.SetProperty(TextLabel::Property::POINT_SIZE, 10.f);
+  application.GetScene().Add(label);
+
+  // make sorted options.
+  std::vector<DevelTextLabel::FitOption> fitOptions;
+  fitOptions.push_back(DevelTextLabel::FitOption(10, 12));
+  fitOptions.push_back(DevelTextLabel::FitOption(8, 10));
+  fitOptions.push_back(DevelTextLabel::FitOption(6, 8));
+  fitOptions.push_back(DevelTextLabel::FitOption(4, 6));
+  fitOptions.push_back(DevelTextLabel::FitOption(20, 22));
+  fitOptions.push_back(DevelTextLabel::FitOption(22, 24));
+  fitOptions.push_back(DevelTextLabel::FitOption(12, 14));
+
+  DevelTextLabel::SetTextFitArray(label, true, fitOptions);
+
+  application.SendNotification();
+  application.Render();
+
+  bool enable = Dali::Toolkit::DevelTextLabel::IsTextFitArrayEnabled(label);
+  DALI_TEST_EQUALS(true, enable, TEST_LOCATION);
+
+  std::vector<Dali::Toolkit::DevelTextLabel::FitOption> getFitOptions = Dali::Toolkit::DevelTextLabel::GetTextFitArray(label);
+  size_t numberOfFitOptions = getFitOptions.size();
+  DALI_TEST_EQUALS(7u, numberOfFitOptions, TEST_LOCATION);
+
+  const Vector3 EXPECTED_NATURAL_SIZE(276.0f, 16.0f, 0.0f);
+  DALI_TEST_EQUALS(EXPECTED_NATURAL_SIZE, label.GetNaturalSize(), TEST_LOCATION);
+
+  std::vector<DevelTextLabel::FitOption> emptyFitOptions;
+  DevelTextLabel::SetTextFitArray(label, false, emptyFitOptions);
+
+  application.SendNotification();
+  application.Render();
+
+  enable = Dali::Toolkit::DevelTextLabel::IsTextFitArrayEnabled(label);
+  DALI_TEST_EQUALS(false, enable, TEST_LOCATION);
+
+  const Vector3 EXPECTED_NATURAL_SIZE_DISABLE(690.0f, 80.0f, 0.0f);
+  DALI_TEST_EQUALS(EXPECTED_NATURAL_SIZE_DISABLE, label.GetNaturalSize(), TEST_LOCATION);
+
+  // make unsorted options.
+  std::vector<DevelTextLabel::FitOption> unorderedFitOptions;
+  unorderedFitOptions.push_back(DevelTextLabel::FitOption(4, 6));
+  unorderedFitOptions.push_back(DevelTextLabel::FitOption(6, 8));
+  unorderedFitOptions.push_back(DevelTextLabel::FitOption(8, 10));
+  unorderedFitOptions.push_back(DevelTextLabel::FitOption(10, 8));
+
+  DevelTextLabel::SetTextFitArray(label, true, unorderedFitOptions);
+
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_EQUALS(EXPECTED_NATURAL_SIZE, label.GetNaturalSize(), TEST_LOCATION);
+
+  END_TEST;
+}
+
 int UtcDaliToolkitTextlabelMaxTextureSet(void)
 {
   ToolkitTestApplication application;
index d42e274..692aed8 100644 (file)
@@ -50,6 +50,21 @@ Rect<> GetTextBoundingRectangle(TextLabel textLabel, uint32_t startIndex, uint32
   return GetImpl(textLabel).GetTextBoundingRectangle(startIndex, endIndex);
 }
 
+void SetTextFitArray(TextLabel textLabel, const bool enable, std::vector<FitOption>& fitOptions)
+{
+  GetImpl(textLabel).SetTextFitArray(enable, fitOptions);
+}
+
+std::vector<FitOption>& GetTextFitArray(TextLabel textLabel)
+{
+  return GetImpl(textLabel).GetTextFitArray();
+}
+
+bool IsTextFitArrayEnabled(TextLabel textLabel)
+{
+  return GetImpl(textLabel).IsTextFitArrayEnabled();
+}
+
 } // namespace DevelTextLabel
 
 } // namespace Toolkit
index a96092f..d9edbb4 100644 (file)
@@ -205,6 +205,33 @@ enum Type
 
 } // namespace Property
 
+struct FitOption
+{
+  FitOption(float pointSize = 0.0f, float minLineSize = 0.0f)
+  : mPointSize(pointSize), mMinLineSize(minLineSize) {}
+
+  float GetPointSize() const
+  {
+    return mPointSize;
+  }
+  float GetMinLineSize() const
+  {
+    return mMinLineSize;
+  }
+  void SetPointSize(float pointSize)
+  {
+    mPointSize = pointSize;
+  }
+  void SetMinLineSize(float minLineSize)
+  {
+    mMinLineSize = minLineSize;
+  }
+
+private:
+  float mPointSize   = 0.0f;
+  float mMinLineSize = 0.0f;
+};
+
 /**
  * @brief Get the rendered size of a specific text range.
  * if the requested text is at multilines, multiple sizes will be returned for each text located in a separate line.
@@ -240,6 +267,30 @@ DALI_TOOLKIT_API Vector<Vector2> GetTextPosition(TextLabel textLabel, const uint
 DALI_TOOLKIT_API Rect<> GetTextBoundingRectangle(TextLabel textLabel, uint32_t startIndex, uint32_t endIndex);
 
 /**
+ * @brief Set text fit array to text label.
+ *
+ * @param[in] textLabel The instance of TextLabel.
+ * @param[in] enable Whether the text fit array is enabled or not.
+ * @param[in] fitOptions list of the fit options.
+ */
+DALI_TOOLKIT_API void SetTextFitArray(TextLabel textLabel, const bool enable, std::vector<FitOption>& fitOptions);
+
+/**
+ * @brief Get the text fit array of text label.
+ *
+ * @param[in] textLabel The instance of TextLabel.
+ * @return list of the fit options.
+ */
+DALI_TOOLKIT_API std::vector<FitOption>& GetTextFitArray(TextLabel textLabel);
+
+/**
+ * @brief Whether the text fit array is enabled or not.
+ *
+ * @return True if the text fit array is enabled.
+ */
+DALI_TOOLKIT_API bool IsTextFitArrayEnabled(TextLabel textLabel);
+
+/**
  * @brief Anchor clicked signal type.
  *
  * @note Signal
index aef9910..f1034f2 100644 (file)
@@ -496,14 +496,26 @@ void TextLabel::SetProperty(BaseObject* object, Property::Index index, const Pro
       }
       case Toolkit::DevelTextLabel::Property::TEXT_FIT:
       {
+        // If TextFitArray is enabled, this should be disabled.
+        if(impl.mController->IsTextFitArrayEnabled())
+        {
+          impl.mController->SetDefaultLineSize(impl.mController->GetCurrentLineSize());
+          impl.mController->SetTextFitArrayEnabled(false);
+        }
+
         ParseTextFitProperty(impl.mController, value.GetMap());
         impl.mController->SetTextFitChanged(true);
         break;
       }
       case Toolkit::DevelTextLabel::Property::MIN_LINE_SIZE:
       {
-        const float lineSize   = value.Get<float>();
-        impl.mTextUpdateNeeded = impl.mController->SetDefaultLineSize(lineSize) || impl.mTextUpdateNeeded;
+        const float lineSize = value.Get<float>();
+        // If TextFitArray is enabled, do not update the default line size.
+        if(!impl.mController->IsTextFitArrayEnabled())
+        {
+          impl.mTextUpdateNeeded = impl.mController->SetDefaultLineSize(lineSize) || impl.mTextUpdateNeeded;
+        }
+        impl.mController->SetCurrentLineSize(lineSize);
         break;
       }
       case Toolkit::DevelTextLabel::Property::FONT_SIZE_SCALE:
@@ -785,7 +797,8 @@ Property::Value TextLabel::GetProperty(BaseObject* object, Property::Index index
       }
       case Toolkit::DevelTextLabel::Property::MIN_LINE_SIZE:
       {
-        value = impl.mController->GetDefaultLineSize();
+        // If TextFitArray is enabled, the stored value (MIN_LINE_SIZE set by the user) is retrun.
+        value = impl.mController->IsTextFitArrayEnabled() ? impl.mController->GetCurrentLineSize() : impl.mController->GetDefaultLineSize();
         break;
       }
       case Toolkit::DevelTextLabel::Property::FONT_SIZE_SCALE:
@@ -1050,7 +1063,12 @@ void TextLabel::OnRelayout(const Vector2& size, RelayoutContainer& container)
 
   Vector2 contentSize(size.x - (padding.start + padding.end), size.y - (padding.top + padding.bottom));
 
-  if(mController->IsTextFitEnabled())
+  if(mController->IsTextFitArrayEnabled())
+  {
+    mController->FitArrayPointSizeforLayout(contentSize);
+    mController->SetTextFitContentSize(contentSize);
+  }
+  else if(mController->IsTextFitEnabled())
   {
     mController->FitPointSizeforLayout(contentSize);
     mController->SetTextFitContentSize(contentSize);
@@ -1275,6 +1293,27 @@ void TextLabel::SetSpannedText(const Text::Spanned& spannedText)
   mController->SetSpannedText(spannedText);
 }
 
+void TextLabel::SetTextFitArray(const bool enable, std::vector<Toolkit::DevelTextLabel::FitOption>& fitOptions)
+{
+  if(!enable)
+  {
+    // If TextFitArray is disabled, MinLineSize shoud be restored to its original size.
+    mController->SetDefaultLineSize(mController->GetCurrentLineSize());
+  }
+  mController->SetTextFitArrayEnabled(enable);
+  mController->SetTextFitArray(fitOptions);
+}
+
+std::vector<Toolkit::DevelTextLabel::FitOption>& TextLabel::GetTextFitArray()
+{
+  return mController->GetTextFitArray();
+}
+
+bool TextLabel::IsTextFitArrayEnabled() const
+{
+  return mController->IsTextFitArrayEnabled();
+}
+
 std::string TextLabel::TextLabelAccessible::GetNameRaw() const
 {
   return GetWholeText();
index b564958..66cb0a6 100644 (file)
@@ -171,6 +171,28 @@ public:
    */
   void SetSpannedText(const Text::Spanned& spannedText);
 
+  /**
+   * @brief Set text fit array to text label.
+   *
+   * @param[in] enable Whether the text fit array is enabled or not.
+   * @param[in] fitOptions list of the fit options.
+   */
+  void SetTextFitArray(const bool enable, std::vector<Toolkit::DevelTextLabel::FitOption>& fitOptions);
+
+  /**
+   * @brief Get the text fit array of text label.
+   *
+   * @return list of the fit options.
+   */
+  std::vector<Toolkit::DevelTextLabel::FitOption>& GetTextFitArray();
+
+  /**
+   * @brief Whether the text fit array is enabled or not.
+   *
+   * @return True if the text fit array is enabled.
+   */
+  bool IsTextFitArrayEnabled() const;
+
 private: // From Control
   /**
    * @copydoc Control::OnInitialize()
index 958d663..fb4eb5f 100644 (file)
@@ -262,7 +262,7 @@ bool ControllerImplModelUpdater::Update(Controller::Impl& impl, OperationsMask o
         // Set the normal font and the placeholder font.
         defaultFontDescription = impl.mFontDefaults->mFontDescription;
 
-        if(impl.mTextFitEnabled)
+        if(impl.mTextFitEnabled || impl.mTextFitArrayEnabled)
         {
           defaultPointSize = impl.mFontDefaults->mFitPointSize * numberOfPointsPerOneUnitOfPointSize;
         }
index 97010cc..b15f31e 100644 (file)
@@ -341,6 +341,8 @@ struct Controller::Impl
     mMaximumNumberOfCharacters(50u),
     mHiddenInput(NULL),
     mInputFilter(nullptr),
+    mTextFitContentSize(),
+    mTextFitArray(),
     mRecalculateNaturalSize(true),
     mMarkupProcessorEnabled(false),
     mClipboardHideEnabled(true),
@@ -355,6 +357,7 @@ struct Controller::Impl
     mStrikethroughSetByString(false),
     mShouldClearFocusOnEscape(true),
     mLayoutDirection(LayoutDirection::LEFT_TO_RIGHT),
+    mCurrentLineSize(0.f),
     mTextFitMinSize(DEFAULT_TEXTFIT_MIN),
     mTextFitMaxSize(DEFAULT_TEXTFIT_MAX),
     mTextFitStepSize(DEFAULT_TEXTFIT_STEP),
@@ -364,6 +367,7 @@ struct Controller::Impl
     mFontSizeScaleEnabled(true),
     mTextFitEnabled(false),
     mTextFitChanged(false),
+    mTextFitArrayEnabled(false),
     mIsLayoutDirectionChanged(false),
     mIsUserInteractionEnabled(true)
   {
@@ -1025,6 +1029,8 @@ public:
   std::unique_ptr<InputFilter> mInputFilter;                ///< Avoid allocating this when the user does not specify input filter mode.
   Vector2                      mTextFitContentSize;         ///< Size of Text fit content
 
+  std::vector<Toolkit::DevelTextLabel::FitOption> mTextFitArray; ///< List of FitOption for TextFitArray operation.
+
   bool               mRecalculateNaturalSize : 1;         ///< Whether the natural size needs to be recalculated.
   bool               mMarkupProcessorEnabled : 1;         ///< Whether the mark-up procesor is enabled.
   bool               mClipboardHideEnabled : 1;           ///< Whether the ClipboardHide function work or not
@@ -1043,6 +1049,7 @@ public:
 
   Shader mShaderBackground; ///< The shader for text background.
 
+  float mCurrentLineSize;              ///< Used to store the MinLineSize set by user when TextFitArray is enabled.
   float mTextFitMinSize;               ///< Minimum Font Size for text fit. Default 10
   float mTextFitMaxSize;               ///< Maximum Font Size for text fit. Default 100
   float mTextFitStepSize;              ///< Step Size for font intervalse. Default 1
@@ -1052,6 +1059,7 @@ public:
   bool  mFontSizeScaleEnabled : 1;     ///< Whether the font size scale is enabled.
   bool  mTextFitEnabled : 1;           ///< Whether the text's fit is enabled.
   bool  mTextFitChanged : 1;           ///< Whether the text fit property has changed.
+  bool  mTextFitArrayEnabled : 1;      ///< Whether the text's fit array is enabled.
   bool  mIsLayoutDirectionChanged : 1; ///< Whether the layout has changed.
   bool  mIsUserInteractionEnabled : 1; ///< Whether the user interaction is enabled.
 
index fafff2f..6b3bba7 100644 (file)
@@ -250,6 +250,117 @@ bool Controller::Relayouter::CheckForTextFit(Controller& controller, float point
   return true;
 }
 
+void Controller::Relayouter::FitArrayPointSizeforLayout(Controller& controller, const Size& layoutSize)
+{
+  Controller::Impl& impl = *controller.mImpl;
+
+  const OperationsMask operations = impl.mOperationsPending;
+  if(NO_OPERATION != (UPDATE_LAYOUT_SIZE & operations) || impl.mTextFitContentSize != layoutSize)
+  {
+    DALI_TRACE_SCOPE(gTraceFilter, "DALI_TEXT_FIT_ARRAY_LAYOUT");
+    std::vector<Toolkit::DevelTextLabel::FitOption> fitOptions = impl.mTextFitArray;
+    int numberOfFitOptions = static_cast<int>(fitOptions.size());
+    if(numberOfFitOptions == 0)
+    {
+      DALI_LOG_ERROR("fitOptions is empty\n");
+      return;
+    }
+
+    ModelPtr& model          = impl.mModel;
+    bool      actualellipsis = model->mElideEnabled;
+    model->mElideEnabled     = false;
+
+    // Sort in ascending order by PointSize.
+    std::sort(fitOptions.begin(), fitOptions.end(), compareByPointSize);
+
+    // Decide whether to use binary search.
+    // If MinLineSize is not sorted in ascending order,
+    // binary search cannot guarantee that it will always find the best value.
+    bool  binarySearch    = true;
+    float prevMinLineSize = 0.0f;
+    for(Toolkit::DevelTextLabel::FitOption& option : fitOptions)
+    {
+      float optionMinLineSize = option.GetMinLineSize();
+      if(prevMinLineSize > optionMinLineSize)
+      {
+        binarySearch = false;
+        break;
+      }
+      prevMinLineSize = optionMinLineSize;
+    }
+
+    // Set the first FitOption(Minimum PointSize) to the best value.
+    // If the search does not find an optimal value, the minimum PointSize will be used to text fit.
+    Toolkit::DevelTextLabel::FitOption firstOption = fitOptions.front();
+    bool  bestSizeUpdatedLatest = false;
+    float bestPointSize         = firstOption.GetPointSize();
+    float bestMinLineSize       = firstOption.GetMinLineSize();
+
+    if(binarySearch)
+    {
+      int left = 0u;
+      int right = numberOfFitOptions - 1;
+
+      while (left <= right)
+      {
+        int mid = left + (right - left) / 2;
+        Toolkit::DevelTextLabel::FitOption option = fitOptions[mid];
+        float testPointSize   = option.GetPointSize();
+        float testMinLineSize = option.GetMinLineSize();
+        impl.SetDefaultLineSize(testMinLineSize);
+
+        if(CheckForTextFit(controller, testPointSize, layoutSize))
+        {
+          bestSizeUpdatedLatest = true;
+          bestPointSize   = testPointSize;
+          bestMinLineSize = testMinLineSize;
+          left = mid + 1;
+        }
+        else
+        {
+          bestSizeUpdatedLatest = false;
+          right = mid - 1;
+        }
+      }
+    }
+    else
+    {
+      // If binary search is not possible, search sequentially starting from the largest PointSize.
+      for(auto it = fitOptions.rbegin(); it != fitOptions.rend(); ++it)
+      {
+        Toolkit::DevelTextLabel::FitOption option = *it;
+        float testPointSize   = option.GetPointSize();
+        float testMinLineSize = option.GetMinLineSize();
+        impl.SetDefaultLineSize(testMinLineSize);
+
+        if(CheckForTextFit(controller, testPointSize, layoutSize))
+        {
+          bestSizeUpdatedLatest = true;
+          bestPointSize   = testPointSize;
+          bestMinLineSize = testMinLineSize;
+          break;
+        }
+        else
+        {
+          bestSizeUpdatedLatest = false;
+        }
+      }
+    }
+
+    // Best point size was not updated. re-run so the TextFit should be fitted really.
+    if(!bestSizeUpdatedLatest)
+    {
+      impl.SetDefaultLineSize(bestMinLineSize);
+      CheckForTextFit(controller, bestPointSize, layoutSize);
+    }
+
+    model->mElideEnabled              = actualellipsis;
+    impl.mFontDefaults->mFitPointSize = bestPointSize;
+    impl.mFontDefaults->sizeDefined   = true;
+    impl.ClearFontData();
+  }
+}
+
 void Controller::Relayouter::FitPointSizeforLayout(Controller& controller, const Size& layoutSize)
 {
   Controller::Impl& impl = *controller.mImpl;
index ca4e666..2776778 100644 (file)
@@ -64,6 +64,14 @@ struct Controller::Relayouter
   static void FitPointSizeforLayout(Controller& controller, const Size& layoutSize);
 
   /**
+   * @brief Calculates the point size for text for given layout() using text fit array.
+   *
+   * @param[in] controller A reference to the controller class
+   * @param[in] layoutSize The layout size
+   */
+  static void FitArrayPointSizeforLayout(Controller& controller, const Size& layoutSize);
+
+  /**
    * @brief Called by the Controller to get the height for a particular width.
    *
    * @param[in] controller A reference to the controller class
@@ -128,6 +136,11 @@ private:
   static void DoRelayoutHorizontalAlignment(Controller::Impl& impl, const Size& size, const CharacterIndex startIndex, const Length requestedNumberOfCharacters);
 };
 
+inline bool compareByPointSize(Toolkit::DevelTextLabel::FitOption& lhs, Toolkit::DevelTextLabel::FitOption& rhs)
+{
+  return lhs.GetPointSize() < rhs.GetPointSize();
+}
+
 } // namespace Text
 
 } // namespace Toolkit
index f61a037..129a3d9 100644 (file)
@@ -374,6 +374,16 @@ bool Controller::IsTextFitChanged() const
   return mImpl->mTextFitChanged;
 }
 
+void Controller::SetCurrentLineSize(float lineSize)
+{
+  mImpl->mCurrentLineSize = lineSize;
+}
+
+float Controller::GetCurrentLineSize() const
+{
+  return mImpl->mCurrentLineSize;
+}
+
 void Controller::SetTextFitMinSize(float minSize, FontSizeType type)
 {
   mImpl->mTextFitMinSize = (type == POINT_SIZE) ? minSize : ConvertPixelToPoint(minSize);
@@ -424,6 +434,28 @@ void Controller::SetTextFitLineSize(float lineSize)
   mImpl->mTextFitLineSize = lineSize;
 }
 
+void Controller::SetTextFitArrayEnabled(bool enabled)
+{
+  mImpl->mTextFitArrayEnabled = enabled;
+  mImpl->ClearFontData();
+  mImpl->RequestRelayout();
+}
+
+bool Controller::IsTextFitArrayEnabled() const
+{
+  return mImpl->mTextFitArrayEnabled;
+}
+
+void Controller::SetTextFitArray(std::vector<Toolkit::DevelTextLabel::FitOption>& fitOptions)
+{
+  mImpl->mTextFitArray = fitOptions;
+}
+
+std::vector<Toolkit::DevelTextLabel::FitOption>& Controller::GetTextFitArray()
+{
+  return mImpl->mTextFitArray;
+}
+
 void Controller::SetPlaceholderTextElideEnabled(bool enabled)
 {
   PlaceholderHandler::SetPlaceholderTextElideEnabled(*this, enabled);
@@ -1292,6 +1324,11 @@ void Controller::FitPointSizeforLayout(Size layoutSize)
   Relayouter::FitPointSizeforLayout(*this, layoutSize);
 }
 
+void Controller::FitArrayPointSizeforLayout(Size layoutSize)
+{
+  Relayouter::FitArrayPointSizeforLayout(*this, layoutSize);
+}
+
 float Controller::GetHeightForWidth(float width)
 {
   return Relayouter::GetHeightForWidth(*this, width);
index 4932cec..9276807 100644 (file)
@@ -435,6 +435,20 @@ public: // Configure the text controller.
   bool IsTextFitEnabled() const;
 
   /**
+   * @brief Sets current line size.
+   *
+   * @param[in] lineSize line size value to store the MinLineSize set by user when TextFitArray is enabled.
+   */
+  void SetCurrentLineSize(float lineSize);
+
+  /**
+   * @brief Retrieves the current line size.
+   *
+   * @return The current line size
+   */
+  float GetCurrentLineSize() const;
+
+  /**
    * @brief Sets minimum size valid for text fit.
    *
    * @param[in] minimum size value.
@@ -522,6 +536,34 @@ public: // Configure the text controller.
   void SetTextFitLineSize(float lineSize);
 
   /**
+   * @brief Enable or disable the text fit array.
+   *
+   * @param[in] enabled Whether to enable the text fit array.
+   */
+  void SetTextFitArrayEnabled(bool enabled);
+
+  /**
+   * @brief Whether the text fit array is enabled or not.
+   *
+   * @return True if the text fit array is enabled.
+   */
+  bool IsTextFitArrayEnabled() const;
+
+  /**
+   * @brief Sets the text fit array.
+   *
+   * @param[in] fitOptions The list of text fit options.
+   */
+  void SetTextFitArray(std::vector<Toolkit::DevelTextLabel::FitOption>& fitOptions);
+
+  /**
+   * @brief Retrieve the text fit array.
+   *
+   * @return The list of text fit options.
+   */
+  std::vector<Toolkit::DevelTextLabel::FitOption>& GetTextFitArray();
+
+  /**
    * @brief Sets disabled color opacity.
    *
    * @param[in] opacity The color opacity value in disabled state.
@@ -1595,6 +1637,11 @@ public: // Queries & retrieves.
   void FitPointSizeforLayout(Size layoutSize);
 
   /**
+   * @brief Calculates the point size for text for given layout() using fit array.
+   */
+  void FitArrayPointSizeforLayout(Size layoutSize);
+
+  /**
    * @brief Checks if the point size fits within the layout size.
    *
    * @return Whether the point size fits within the layout size.