You may need to add LineSize to TextFit items.
It is currently based on the TextLabel LineSize at the time the TextFit property is set.
Change-Id: I0d4661da7b653e8e765c2b029ce06749e01c8bd4
}
controller->SetTextFitEnabled(enabled);
+ // The TextFit operation is performed based on the MinLineSize set in the TextLabel at the moment when the TextFit property is set.
+ // So, if you change the TextLabel's MinLineSize after setting the TextFit property, it does not affect the operation of TextFit.
+ // This may require a new LineSize item in TextFit.
+ controller->SetTextFitLineSize(controller->GetDefaultLineSize());
if(isMinSizeSet)
{
controller->SetTextFitMinSize(minSize, type);
mTextFitMinSize(DEFAULT_TEXTFIT_MIN),
mTextFitMaxSize(DEFAULT_TEXTFIT_MAX),
mTextFitStepSize(DEFAULT_TEXTFIT_STEP),
+ mTextFitLineSize(0.f),
mFontSizeScale(DEFAULT_FONT_SIZE_SCALE),
mDisabledColorOpacity(DEFAULT_DISABLED_COLOR_OPACITY),
mFontSizeScaleEnabled(true),
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
+ float mTextFitLineSize; ///< This is the LineSize that is the standard when performing TextFit.
float mFontSizeScale; ///< Scale value for Font Size. Default 1.0
float mDisabledColorOpacity; ///< Color opacity when disabled.
bool mFontSizeScaleEnabled : 1; ///< Whether the font size scale is enabled.
DALI_TRACE_SCOPE(gTraceFilter, "DALI_TEXT_FIT_LAYOUT");
ModelPtr& model = impl.mModel;
- bool actualellipsis = model->mElideEnabled;
- float minPointSize = impl.mTextFitMinSize;
- float maxPointSize = impl.mTextFitMaxSize;
- float pointInterval = impl.mTextFitStepSize;
- float currentFitPointSize = impl.mFontDefaults->mFitPointSize;
+ bool actualellipsis = model->mElideEnabled;
+ float minPointSize = impl.mTextFitMinSize;
+ float maxPointSize = impl.mTextFitMaxSize;
+ float pointInterval = impl.mTextFitStepSize;
+ float currentFitPointSize = impl.mFontDefaults->mFitPointSize;
+ float currentDefaultLineSize = impl.mLayoutEngine.GetDefaultLineSize();
+ // Instead of using the LineSize of the current TextLabel, the LineSize set in TextFit is used.
+ impl.SetDefaultLineSize(impl.mTextFitLineSize);
model->mElideEnabled = false;
{
impl.mTextFitChanged = true;
}
+ // Revert back to the original TextLabel LineSize.
+ impl.SetDefaultLineSize(currentDefaultLineSize);
impl.mFontDefaults->mFitPointSize = bestPointSize;
impl.mFontDefaults->sizeDefined = true;
impl.ClearFontData();
return mImpl->mFontDefaults ? mImpl->mFontDefaults->mFitPointSize : 0.0f;
}
+void Controller::SetTextFitLineSize(float lineSize)
+{
+ mImpl->mTextFitLineSize = lineSize;
+}
+
void Controller::SetPlaceholderTextElideEnabled(bool enabled)
{
PlaceholderHandler::SetPlaceholderTextElideEnabled(*this, enabled);
bool IsTextFitChanged() const;
/**
+ * @brief Sets line size valid for text fit.
+ *
+ * @param[in] lineSize line size value
+ */
+ void SetTextFitLineSize(float lineSize);
+
+ /**
* @brief Sets disabled color opacity.
*
* @param[in] opacity The color opacity value in disabled state.