/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, true, "LOG_TEXT_CONTROLS");
#endif
-const std::string EMPTY_STRING("");
+const char* EMPTY_STRING = "";
template<typename Type>
void EnsureCreated(Type*& object)
{
EnsureCreated(mImpl->mFontDefaults);
- mImpl->mFontDefaults->mFontDescription.family = defaultFontFamily;
- DALI_LOG_INFO(gLogFilter, Debug::General, "Controller::SetDefaultFontFamily %s\n", defaultFontFamily.c_str());
- mImpl->mFontDefaults->familyDefined = !defaultFontFamily.empty();
+ if(mImpl->mFontDefaults->mFontDescription.family != defaultFontFamily)
+ {
+ mImpl->mFontDefaults->mFontDescription.family = defaultFontFamily;
+ DALI_LOG_INFO(gLogFilter, Debug::General, "Controller::SetDefaultFontFamily %s\n", defaultFontFamily.c_str());
+ mImpl->mFontDefaults->familyDefined = !defaultFontFamily.empty();
- // Update the cursor position if it's in editing mode
- UpdateCursorPosition(mImpl->mEventData);
+ // Update the cursor position if it's in editing mode
+ UpdateCursorPosition(mImpl->mEventData);
- // Clear the font-specific data
- mImpl->ClearFontData();
+ // Clear the font-specific data
+ mImpl->ClearFontData();
- mImpl->RequestRelayout();
+ mImpl->RequestRelayout();
+ }
}
-const std::string& Controller::GetDefaultFontFamily() const
+std::string Controller::GetDefaultFontFamily() const
{
return mImpl->mFontDefaults ? mImpl->mFontDefaults->mFontDescription.family : EMPTY_STRING;
}
PlaceholderHandler::SetPlaceholderFontFamily(*this, placeholderTextFontFamily);
}
-const std::string& Controller::GetPlaceholderFontFamily() const
+std::string Controller::GetPlaceholderFontFamily() const
{
return PlaceholderHandler::GetPlaceholderFontFamily(*this);
}
mImpl->mEmbossDefaults->properties = embossProperties;
}
-const std::string& Controller::GetDefaultEmbossProperties() const
+std::string Controller::GetDefaultEmbossProperties() const
{
return mImpl->mEmbossDefaults ? mImpl->mEmbossDefaults->properties : EMPTY_STRING;
}
mImpl->mOutlineDefaults->properties = outlineProperties;
}
-const std::string& Controller::GetDefaultOutlineProperties() const
+std::string Controller::GetDefaultOutlineProperties() const
{
return mImpl->mOutlineDefaults ? mImpl->mOutlineDefaults->properties : EMPTY_STRING;
}
InputFontHandler::SetInputFontFamily(*this, fontFamily);
}
-const std::string& Controller::GetInputFontFamily() const
+std::string Controller::GetInputFontFamily() const
{
return InputFontHandler::GetInputFontFamily(*this);
}
InputProperties::SetInputShadowProperties(*this, shadowProperties);
}
-const std::string& Controller::GetInputShadowProperties() const
+std::string Controller::GetInputShadowProperties() const
{
return InputProperties::GetInputShadowProperties(*this);
}
InputProperties::SetInputUnderlineProperties(*this, underlineProperties);
}
-const std::string& Controller::GetInputUnderlineProperties() const
+std::string Controller::GetInputUnderlineProperties() const
{
return InputProperties::GetInputUnderlineProperties(*this);
}
InputProperties::SetInputEmbossProperties(*this, embossProperties);
}
-const std::string& Controller::GetInputEmbossProperties() const
+std::string Controller::GetInputEmbossProperties() const
{
return InputProperties::GetInputEmbossProperties(*this);
}
InputProperties::SetInputOutlineProperties(*this, outlineProperties);
}
-const std::string& Controller::GetInputOutlineProperties() const
+std::string Controller::GetInputOutlineProperties() const
{
return InputProperties::GetInputOutlineProperties(*this);
}
}
}
-const std::string& Controller::GetInputStrikethroughProperties() const
+std::string Controller::GetInputStrikethroughProperties() const
{
return (NULL != mImpl->mEventData) ? mImpl->mEventData->mInputStyle.strikethroughProperties : EMPTY_STRING;
}
return GetCharacterBoundingRect(mImpl->mModel, charIndex);
}
+int Controller::GetCharacterIndexAtPosition(float visualX, float visualY)
+{
+ return GetCharIndexAtPosition(mImpl->mModel, visualX, visualY);
+}
+
Rect<> Controller::GetTextBoundingRectangle(CharacterIndex startIndex, CharacterIndex endIndex)
{
Vector<Vector2> sizeList;
Controller::~Controller()
{
- delete mImpl;
}
} // namespace Dali::Toolkit::Text