Requests asynchronous rendering of text with a fixed size.
Change-Id: Ibae12de7ff3052b8826c0c8a7076347099842ffe
Signed-off-by: Bowon Ryu <bowon.ryu@samsung.com>
return GetImpl(textLabel).IsRemoveBackInset();
}
+void RequestAsyncRenderWithFixedSize(TextLabel textLabel, float width, float height)
+{
+ GetImpl(textLabel).RequestAsyncRenderWithFixedSize(width, height);
+}
+
} // namespace DevelTextLabel
} // namespace Toolkit
DALI_TOOLKIT_API bool IsRemoveBackInset(TextLabel textLabel);
/**
+ * @brief A method that requests asynchronous rendering of text with a fixed size.
+ *
+ * @param[in] textLabel The instance of TextLabel.
+ * @param[in] width The width of text to render.
+ * @param[in] height The height of text to render.
+ */
+DALI_TOOLKIT_API void RequestAsyncRenderWithFixedSize(TextLabel textLabel, float width, float height);
+
+/**
* @brief Anchor clicked signal type.
*
* @note Signal
}
}
-void TextLabel::AsyncLoadComplete()
+void TextLabel::AsyncLoadComplete(Text::AsyncTextRenderInfo renderInfo)
{
// Pure Virtual from AsyncTextInterface
- DALI_LOG_INFO(gLogFilter, Debug::General, "TextLabel::AsyncLoadComplete\n");
+ DALI_LOG_RELEASE_INFO("Rendered size : %f, %f\n", renderInfo.renderedSize.width, renderInfo.renderedSize.height);
// To avoid flickering issues, enable/disable the background visual when async load is completed.
EnableControlBackground(!mController->IsTextCutout());
}
}
+void TextLabel::RequestAsyncRenderWithFixedSize(float width, float height)
+{
+ if(mController->IsAsyncTextLoadEnabled())
+ {
+ DALI_LOG_RELEASE_INFO("Request size : %f, %f\n", width, height);
+
+ Actor self = Self();
+
+ Extents padding;
+ padding = self.GetProperty<Extents>(Toolkit::Control::Property::PADDING);
+
+ Vector2 contentSize(width - (padding.start + padding.end), height - (padding.top + padding.bottom));
+
+ // Support Right-To-Left
+ Dali::LayoutDirection::Type layoutDirection = mController->GetLayoutDirection(self);
+
+ // Support Right-To-Left of padding
+ if(Dali::LayoutDirection::RIGHT_TO_LEFT == layoutDirection)
+ {
+ std::swap(padding.start, padding.end);
+ }
+
+ AsyncTextParameters parameters = GetAsyncTextParameters(contentSize, padding, layoutDirection);
+ TextVisual::UpdateAsyncRenderer(mVisual, parameters);
+ mTextUpdateNeeded = false;
+ mIsPropertyUpdated = false;
+ }
+ else
+ {
+ DALI_LOG_WARNING("IsAsyncTextLoadEnabled is false\n");
+ }
+}
+
std::string TextLabel::TextLabelAccessible::GetNameRaw() const
{
return GetWholeText();
*/
void EnableControlBackground(const bool enable);
+ /**
+ * @brief A method that requests asynchronous rendering of text with a fixed size.
+ *
+ * @param[in] width The width of text to render.
+ * @param[in] height The height of text to render.
+ */
+ void RequestAsyncRenderWithFixedSize(float width, float height);
+
+
private: // From Control
/**
* @copydoc Control::OnInitialize()
/**
* @copydoc Text::AsyncTextInterface::AsyncLoadComplete()
*/
- void AsyncLoadComplete();
+ void AsyncLoadComplete(Text::AsyncTextRenderInfo renderInfo);
private: // Implementation
/**
/**
* @brief Called when the async load complete.
*/
- virtual void AsyncLoadComplete() = 0;
+ virtual void AsyncLoadComplete(Text::AsyncTextRenderInfo renderInfo) = 0;
};
} // namespace Text
renderInfo.styleEnabled = styleEnabled;
renderInfo.isOverlayStyle = isOverlayStyle;
+ if(parameters.isFixedSize)
+ {
+ renderInfo.renderedSize = Size(static_cast<float>(parameters.textWidth), static_cast<float>(parameters.textHeight));
+ }
+
return renderInfo;
}
// Store the control size and calculated wrap gap in render info.
renderInfo.controlSize = controlSize;
renderInfo.autoScrollWrapGap = wrapGap;
+ renderInfo.renderedSize = controlSize;
return renderInfo;
}
struct AsyncTextParameters
{
AsyncTextParameters()
- : maxTextureSize{0},
+ : isFixedSize{true},
+ maxTextureSize{0},
text{},
fontSize{0.f},
textColor{Color::BLACK},
{
}
+ bool isFixedSize;
+
int maxTextureSize; ///< The maximum size of texture.
std::string text; ///< The text to be rendered encoded in utf8.
width(0u),
height(0u),
controlSize(),
+ renderedSize(),
autoScrollWrapGap(0.f),
hasMultipleTextColors(false),
containsColorGlyph(false),
uint32_t width;
uint32_t height;
Size controlSize;
+ Size renderedSize;
float autoScrollWrapGap;
bool hasMultipleTextColors;
bool containsColorGlyph;
if(mAsyncTextInterface)
{
- mAsyncTextInterface->AsyncLoadComplete();
+ mAsyncTextInterface->AsyncLoadComplete(renderInfo);
}
}
else