Added new property to TextLabel, TextField, and TextEditor.
Example:
textLabel.SetProperty(DevelTextLabel::Property::REMOVE_FRONT_INSET, false);
textLabel.SetProperty(DevelTextLabel::Property::REMOVE_BACK_INSET, false);
When REMOVE_FRONT_INSET is set to false, the xBearing of first glyph won't be trimmed.
When REMOVE_BACK_INSET is set to false, the advance of last glyph won't be trimmed.
Change-Id: I58a0f9254358e39c3e379bb3262a65beda7c76ed
const char* const PROPERTY_NAME_INPUT_METHOD_SETTINGS = "inputMethodSettings";
const char* const PROPERTY_NAME_INPUT_FILTER = "inputFilter";
+const char* const PROPERTY_NAME_REMOVE_FRONT_INSET = "removeFrontInset";
+const char* const PROPERTY_NAME_REMOVE_BACK_INSET = "removeBackInset";
+
const Vector4 PLACEHOLDER_TEXT_COLOR(0.8f, 0.8f, 0.8f, 0.8f);
const Dali::Vector4 LIGHT_BLUE(0.75f, 0.96f, 1.f, 1.f); // The text highlight color.
DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_STRIKETHROUGH) == DevelTextEditor::Property::STRIKETHROUGH);
DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_STRIKETHROUGH) == DevelTextEditor::Property::INPUT_STRIKETHROUGH);
DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SELECTION_POPUP_STYLE) == DevelTextEditor::Property::SELECTION_POPUP_STYLE);
+ DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_REMOVE_FRONT_INSET) == DevelTextEditor::Property::REMOVE_FRONT_INSET);
+ DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_REMOVE_BACK_INSET) == DevelTextEditor::Property::REMOVE_BACK_INSET);
END_TEST;
}
editor.SetProperty(DevelTextEditor::Property::MIN_LINE_SIZE, 50.f);
DALI_TEST_EQUALS(editor.GetProperty<float>(DevelTextEditor::Property::MIN_LINE_SIZE), 50.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
+ // Check Remove Front/Back Inset Property
+ DALI_TEST_CHECK(editor.GetProperty<bool>(DevelTextEditor::Property::REMOVE_FRONT_INSET));
+ editor.SetProperty(DevelTextEditor::Property::REMOVE_FRONT_INSET, false);
+ DALI_TEST_CHECK(!editor.GetProperty<bool>(DevelTextEditor::Property::REMOVE_FRONT_INSET));
+
+ DALI_TEST_CHECK(editor.GetProperty<bool>(DevelTextEditor::Property::REMOVE_BACK_INSET));
+ editor.SetProperty(DevelTextEditor::Property::REMOVE_BACK_INSET, false);
+ DALI_TEST_CHECK(!editor.GetProperty<bool>(DevelTextEditor::Property::REMOVE_BACK_INSET));
+
+ application.SendNotification();
+ application.Render();
+
END_TEST;
}
TestTextGeometryUtils::CheckRectGeometryResult(textBoundingRectangle, expectedTextBoundingRectangle);
END_TEST;
-}
\ No newline at end of file
+}
+
+int utcDaliTextEditorRemoveFrontInset(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextEditorRemoveFrontInset");
+ TextEditor editor = TextEditor::New();
+ DALI_TEST_CHECK(editor);
+ application.GetScene().Add(editor);
+ application.SendNotification();
+ application.Render();
+ DevelTextEditor::SetRemoveFrontInset(editor, false);
+ DALI_TEST_CHECK(!DevelTextEditor::IsRemoveFrontInset(editor));
+ END_TEST;
+}
+int utcDaliTextEditorRemoveBackInset(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextEditorRemoveBackInset");
+ TextEditor editor = TextEditor::New();
+ DALI_TEST_CHECK(editor);
+ application.GetScene().Add(editor);
+ application.SendNotification();
+ application.Render();
+ DevelTextEditor::SetRemoveBackInset(editor, false);
+ DALI_TEST_CHECK(!DevelTextEditor::IsRemoveBackInset(editor));
+ END_TEST;
+}
const char* const PROPERTY_NAME_GRAB_HANDLE_COLOR = "grabHandleColor";
const char* const PROPERTY_NAME_INPUT_FILTER = "inputFilter";
+const char* const PROPERTY_NAME_REMOVE_FRONT_INSET = "removeFrontInset";
+const char* const PROPERTY_NAME_REMOVE_BACK_INSET = "removeBackInset";
+
const Vector4 PLACEHOLDER_TEXT_COLOR(0.8f, 0.8f, 0.8f, 0.8f);
const Dali::Vector4 LIGHT_BLUE(0.75f, 0.96f, 1.f, 1.f); // The text highlight color.
DALI_TEST_CHECK(field.GetPropertyIndex(PROPERTY_NAME_STRIKETHROUGH) == DevelTextField::Property::STRIKETHROUGH);
DALI_TEST_CHECK(field.GetPropertyIndex(PROPERTY_NAME_INPUT_STRIKETHROUGH) == DevelTextField::Property::INPUT_STRIKETHROUGH);
DALI_TEST_CHECK(field.GetPropertyIndex(PROPERTY_NAME_SELECTION_POPUP_STYLE) == DevelTextField::Property::SELECTION_POPUP_STYLE);
+ DALI_TEST_CHECK(field.GetPropertyIndex(PROPERTY_NAME_REMOVE_FRONT_INSET) == DevelTextField::Property::REMOVE_FRONT_INSET);
+ DALI_TEST_CHECK(field.GetPropertyIndex(PROPERTY_NAME_REMOVE_BACK_INSET) == DevelTextField::Property::REMOVE_BACK_INSET);
END_TEST;
}
application.SendNotification();
application.Render();
+ // Check Remove Front/Back Inset Property
+ DALI_TEST_CHECK(field.GetProperty<bool>(DevelTextField::Property::REMOVE_FRONT_INSET));
+ field.SetProperty(DevelTextField::Property::REMOVE_FRONT_INSET, false);
+ DALI_TEST_CHECK(!field.GetProperty<bool>(DevelTextField::Property::REMOVE_FRONT_INSET));
+
+ DALI_TEST_CHECK(field.GetProperty<bool>(DevelTextField::Property::REMOVE_BACK_INSET));
+ field.SetProperty(DevelTextField::Property::REMOVE_BACK_INSET, false);
+ DALI_TEST_CHECK(!field.GetProperty<bool>(DevelTextField::Property::REMOVE_BACK_INSET));
+
+ application.SendNotification();
+ application.Render();
+
+
END_TEST;
}
application.Render();
END_TEST;
-}
\ No newline at end of file
+}
+
+int utcDaliTextFieldRemoveFrontInset(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextFieldRemoveFrontInset");
+
+ TextField field = TextField::New();
+ DALI_TEST_CHECK(field);
+
+ application.GetScene().Add(field);
+ application.SendNotification();
+ application.Render();
+
+ DevelTextField::SetRemoveFrontInset(field, false);
+ DALI_TEST_CHECK(!DevelTextField::IsRemoveFrontInset(field));
+
+ END_TEST;
+}
+
+int utcDaliTextFieldRemoveBackInset(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextFieldRemoveBackInset");
+
+ TextField field = TextField::New();
+ DALI_TEST_CHECK(field);
+
+ application.GetScene().Add(field);
+ application.SendNotification();
+ application.Render();
+
+ DevelTextField::SetRemoveBackInset(field, false);
+ DALI_TEST_CHECK(!DevelTextField::IsRemoveBackInset(field));
+
+ END_TEST;
+}
const char* const PROPERTY_NAME_ANCHOR_COLOR = "anchorColor";
const char* const PROPERTY_NAME_ANCHOR_CLICKED_COLOR = "anchorClickedColor";
+const char* const PROPERTY_NAME_REMOVE_FRONT_INSET = "removeFrontInset";
+const char* const PROPERTY_NAME_REMOVE_BACK_INSET = "removeBackInset";
+
const std::string DEFAULT_FONT_DIR("/resources/fonts");
const unsigned int EMOJI_FONT_SIZE = 3840u; // 60 * 64
DALI_TEST_CHECK(label.GetPropertyIndex(PROPERTY_NAME_STRIKETHROUGH) == DevelTextLabel::Property::STRIKETHROUGH);
DALI_TEST_CHECK(label.GetPropertyIndex(PROPERTY_NAME_ANCHOR_COLOR) == DevelTextLabel::Property::ANCHOR_COLOR);
DALI_TEST_CHECK(label.GetPropertyIndex(PROPERTY_NAME_ANCHOR_CLICKED_COLOR) == DevelTextLabel::Property::ANCHOR_CLICKED_COLOR);
+ DALI_TEST_CHECK(label.GetPropertyIndex(PROPERTY_NAME_REMOVE_FRONT_INSET) == DevelTextLabel::Property::REMOVE_FRONT_INSET);
+ DALI_TEST_CHECK(label.GetPropertyIndex(PROPERTY_NAME_REMOVE_BACK_INSET) == DevelTextLabel::Property::REMOVE_BACK_INSET);
END_TEST;
}
application.SendNotification();
application.Render();
+ // Check Remove Front/Back Inset Property
+ DALI_TEST_CHECK(label.GetProperty<bool>(DevelTextLabel::Property::REMOVE_FRONT_INSET));
+ label.SetProperty(DevelTextLabel::Property::REMOVE_FRONT_INSET, false);
+ DALI_TEST_CHECK(!label.GetProperty<bool>(DevelTextLabel::Property::REMOVE_FRONT_INSET));
+
+ DALI_TEST_CHECK(label.GetProperty<bool>(DevelTextLabel::Property::REMOVE_BACK_INSET));
+ label.SetProperty(DevelTextLabel::Property::REMOVE_BACK_INSET, false);
+ DALI_TEST_CHECK(!label.GetProperty<bool>(DevelTextLabel::Property::REMOVE_BACK_INSET));
+
+ application.SendNotification();
+ application.Render();
+
END_TEST;
}
TestTextGeometryUtils::CheckRectGeometryResult(textBoundingRectangle, expectedTextBoundingRectangle);
END_TEST;
+}
+
+int utcDaliTextLabelRemoveFrontInset(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextLabelRemoveFrontInset");
+
+ TextLabel label = TextLabel::New();
+ DALI_TEST_CHECK(label);
+
+ application.GetScene().Add(label);
+ application.SendNotification();
+ application.Render();
+
+ DevelTextLabel::SetRemoveFrontInset(label, false);
+ DALI_TEST_CHECK(!DevelTextLabel::IsRemoveFrontInset(label));
+
+ END_TEST;
+}
+
+int utcDaliTextLabelRemoveBackInset(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextLabelRemoveBackInset");
+
+ TextLabel label = TextLabel::New();
+ DALI_TEST_CHECK(label);
+
+ application.GetScene().Add(label);
+ application.SendNotification();
+ application.Render();
+
+ DevelTextLabel::SetRemoveBackInset(label, false);
+ DALI_TEST_CHECK(!DevelTextLabel::IsRemoveBackInset(label));
+
+ END_TEST;
}
\ No newline at end of file
GetImpl(textEditor).PasteText();
}
+void SetRemoveFrontInset(TextEditor textEditor, const bool remove)
+{
+ GetImpl(textEditor).SetRemoveFrontInset(remove);
+}
+
+bool IsRemoveFrontInset(TextEditor textEditor)
+{
+ return GetImpl(textEditor).IsRemoveFrontInset();
+}
+
+void SetRemoveBackInset(TextEditor textEditor, const bool remove)
+{
+ GetImpl(textEditor).SetRemoveBackInset(remove);
+}
+
+bool IsRemoveBackInset(TextEditor textEditor)
+{
+ return GetImpl(textEditor).IsRemoveBackInset();
+}
+
} // namespace DevelTextEditor
} // namespace Toolkit
* @see Dali::Toolkit::TextSelectionPopup::Property
*/
SELECTION_POPUP_STYLE,
+
+ /**
+ * @brief Whether to trim the xBearing of first glyph of the text.
+ * @details Name "removeFrontInset", type Property::BOOLEAN.
+ */
+ REMOVE_FRONT_INSET,
+
+ /**
+ * @brief Whether to trim the advance of last glyph of the text.
+ * @details Name "removeBackInset", type Property::BOOLEAN.
+ */
+ REMOVE_BACK_INSET,
};
} // namespace Property
*/
DALI_TOOLKIT_API void PasteText(TextEditor textEditor);
+/**
+ * @brief Set removing front inset to text label.
+ *
+ * @param[in] textEditor The instance of TextLabel.
+ * @param[in] remove Whether front inset of text label has to be removed or not.
+ */
+DALI_TOOLKIT_API void SetRemoveFrontInset(TextEditor textEditor, const bool remove);
+
+/**
+ * @brief Whether front inset of text label is removed or not.
+ *
+ * @param[in] textEditor The instance of TextLabel.
+ * @return True if the front inset of text label is removed.
+ */
+DALI_TOOLKIT_API bool IsRemoveFrontInset(TextEditor textEditor);
+
+/**
+ * @brief Set removing back inset to text label.
+ *
+ * @param[in] textEditor The instance of TextLabel.
+ * @param[in] remove Whether back inset of text label has to be removed or not.
+ */
+DALI_TOOLKIT_API void SetRemoveBackInset(TextEditor textEditor, const bool remove);
+
+/**
+ * @brief Whether back inset of text label is removed or not.
+ *
+ * @param[in] textEditor The instance of TextLabel.
+ * @return True if the back inset of text label is removed.
+ */
+DALI_TOOLKIT_API bool IsRemoveBackInset(TextEditor textEditor);
+
+
} // namespace DevelTextEditor
} // namespace Toolkit
GetImpl(textField).PasteText();
}
+void SetRemoveFrontInset(TextField textField, const bool remove)
+{
+ GetImpl(textField).SetRemoveFrontInset(remove);
+}
+
+bool IsRemoveFrontInset(TextField textField)
+{
+ return GetImpl(textField).IsRemoveFrontInset();
+}
+
+void SetRemoveBackInset(TextField textField, const bool remove)
+{
+ GetImpl(textField).SetRemoveBackInset(remove);
+}
+
+bool IsRemoveBackInset(TextField textField)
+{
+ return GetImpl(textField).IsRemoveBackInset();
+}
+
} // namespace DevelTextField
} // namespace Toolkit
* @see Dali::Toolkit::TextSelectionPopup::Property
*/
SELECTION_POPUP_STYLE,
+
+ /**
+ * @brief Whether to trim the xBearing of first glyph of the text.
+ * @details Name "removeFrontInset", type Property::BOOLEAN.
+ */
+ REMOVE_FRONT_INSET,
+
+ /**
+ * @brief Whether to trim the advance of last glyph of the text.
+ * @details Name "removeBackInset", type Property::BOOLEAN.
+ */
+ REMOVE_BACK_INSET,
};
} // namespace Property
*/
DALI_TOOLKIT_API void PasteText(TextField textField);
+/**
+ * @brief Set removing front inset to TextField.
+ *
+ * @param[in] textField The instance of TextField.
+ * @param[in] remove Whether front inset of TextField has to be removed or not.
+ */
+DALI_TOOLKIT_API void SetRemoveFrontInset(TextField textField, const bool remove);
+
+/**
+ * @brief Whether front inset of TextField is removed or not.
+ *
+ * @param[in] textField The instance of TextField.
+ * @return True if the front inset of TextField is removed.
+ */
+DALI_TOOLKIT_API bool IsRemoveFrontInset(TextField textField);
+
+/**
+ * @brief Set removing back inset to TextField.
+ *
+ * @param[in] textField The instance of TextField.
+ * @param[in] remove Whether back inset of TextField has to be removed or not.
+ */
+DALI_TOOLKIT_API void SetRemoveBackInset(TextField textField, const bool remove);
+
+/**
+ * @brief Whether back inset of TextField is removed or not.
+ *
+ * @param[in] textField The instance of TextField.
+ * @return True if the back inset of TextField is removed.
+ */
+DALI_TOOLKIT_API bool IsRemoveBackInset(TextField textField);
+
} // namespace DevelTextField
} // namespace Toolkit
return GetImpl(textLabel).IsTextFitArrayEnabled();
}
+void SetRemoveFrontInset(TextLabel textLabel, const bool remove)
+{
+ GetImpl(textLabel).SetRemoveFrontInset(remove);
+}
+
+bool IsRemoveFrontInset(TextLabel textLabel)
+{
+ return GetImpl(textLabel).IsRemoveFrontInset();
+}
+
+void SetRemoveBackInset(TextLabel textLabel, const bool remove)
+{
+ GetImpl(textLabel).SetRemoveBackInset(remove);
+}
+
+bool IsRemoveBackInset(TextLabel textLabel)
+{
+ return GetImpl(textLabel).IsRemoveBackInset();
+}
+
} // namespace DevelTextLabel
} // namespace Toolkit
* @note If there is a color attribute in the anchor tag, the markup attribute takes precedence.
*/
ANCHOR_CLICKED_COLOR,
+
+ /**
+ * @brief Whether to trim the xBearing of first glyph of the text.
+ * @details Name "removeFrontInset", type Property::BOOLEAN.
+ */
+ REMOVE_FRONT_INSET,
+
+ /**
+ * @brief Whether to trim the advance of last glyph of the text.
+ * @details Name "removeBackInset", type Property::BOOLEAN.
+ */
+ REMOVE_BACK_INSET,
};
} // namespace Property
DALI_TOOLKIT_API bool IsTextFitArrayEnabled(TextLabel textLabel);
/**
+ * @brief Set removing front inset to text label.
+ *
+ * @param[in] textLabel The instance of TextLabel.
+ * @param[in] remove Whether front inset of text label has to be removed or not.
+ */
+DALI_TOOLKIT_API void SetRemoveFrontInset(TextLabel textLabel, const bool remove);
+
+/**
+ * @brief Whether front inset of text label is removed or not.
+ *
+ * @param[in] textLabel The instance of TextLabel.
+ * @return True if the front inset of text label is removed.
+ */
+DALI_TOOLKIT_API bool IsRemoveFrontInset(TextLabel textLabel);
+
+/**
+ * @brief Set removing back inset to text label.
+ *
+ * @param[in] textLabel The instance of TextLabel.
+ * @param[in] remove Whether back inset of text label has to be removed or not.
+ */
+DALI_TOOLKIT_API void SetRemoveBackInset(TextLabel textLabel, const bool remove);
+
+/**
+ * @brief Whether back inset of text label is removed or not.
+ *
+ * @param[in] textLabel The instance of TextLabel.
+ * @return True if the back inset of text label is removed.
+ */
+DALI_TOOLKIT_API bool IsRemoveBackInset(TextLabel textLabel);
+
+/**
* @brief Anchor clicked signal type.
*
* @note Signal
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "relativeLineSize", FLOAT, RELATIVE_LINE_SIZE )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "verticalAlignment", STRING, VERTICAL_ALIGNMENT )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "selectionPopupStyle", MAP, SELECTION_POPUP_STYLE )
+DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "removeFrontInset", BOOLEAN, REMOVE_FRONT_INSET )
+DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "removeBackInset", BOOLEAN, REMOVE_BACK_INSET )
DALI_SIGNAL_REGISTRATION(Toolkit, TextEditor, "textChanged", SIGNAL_TEXT_CHANGED )
DALI_SIGNAL_REGISTRATION(Toolkit, TextEditor, "inputStyleChanged", SIGNAL_INPUT_STYLE_CHANGED )
mController->ChangedLayoutDirection();
}
+void TextEditor::SetRemoveFrontInset(bool remove)
+{
+ mController->SetRemoveFrontInset(remove);
+}
+
+bool TextEditor::IsRemoveFrontInset() const
+{
+ return mController->IsRemoveFrontInset();
+}
+
+void TextEditor::SetRemoveBackInset(bool remove)
+{
+ mController->SetRemoveBackInset(remove);
+}
+
+bool TextEditor::IsRemoveBackInset() const
+{
+ return mController->IsRemoveBackInset();
+}
+
TextEditor::TextEditor(ControlBehaviour additionalBehaviour)
: Control(ControlBehaviour(CONTROL_BEHAVIOUR_DEFAULT | additionalBehaviour)),
mAnimationPeriod(0.0f, 0.0f),
*/
void AnchorClicked(const std::string& href) override;
+ /**
+ * @brief Set removing front inset to TextEditor.
+ *
+ * @param[in] remove Whether front inset of TextEditor has to be removed or not.
+ */
+ void SetRemoveFrontInset(const bool remove);
+
+ /**
+ * @brief Whether front inset of TextEditor is removed or not.
+ *
+ * @return True if the front inset of TextEditor is removed.
+ */
+ bool IsRemoveFrontInset() const;
+
+ /**
+ * @brief Set removing back inset to TextEditor.
+ *
+ * @param[in] remove Whether back inset of TextEditor has to be removed or not.
+ */
+ void SetRemoveBackInset(const bool remove);
+
+ /**
+ * @brief Whether back inset of TextEditor is removed or not.
+ *
+ * @return True if the back inset of TextEditor is removed.
+ */
+ bool IsRemoveBackInset() const;
+
private: // Implementation
/**
* @copydoc Dali::Toolkit::Text::Controller::(InputMethodContext& inputMethodContext, const InputMethodContext::EventData& inputMethodContextEvent)
}
break;
}
+ case Toolkit::DevelTextEditor::Property::REMOVE_FRONT_INSET:
+ {
+ const bool remove = value.Get<bool>();
+ impl.mController->SetRemoveFrontInset(remove);
+ break;
+ }
+ case Toolkit::DevelTextEditor::Property::REMOVE_BACK_INSET:
+ {
+ const bool remove = value.Get<bool>();
+ impl.mController->SetRemoveBackInset(remove);
+ break;
+ }
}
}
value = map;
break;
}
+ case Toolkit::DevelTextEditor::Property::REMOVE_FRONT_INSET:
+ {
+ value = impl.mController->IsRemoveFrontInset();
+ break;
+ }
+ case Toolkit::DevelTextEditor::Property::REMOVE_BACK_INSET:
+ {
+ value = impl.mController->IsRemoveBackInset();
+ break;
+ }
} //switch
return value;
}
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextField, "inputStrikethrough", MAP, INPUT_STRIKETHROUGH )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextField, "characterSpacing", FLOAT, CHARACTER_SPACING )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextField, "selectionPopupStyle", MAP, SELECTION_POPUP_STYLE )
+DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextField, "removeFrontInset", BOOLEAN, REMOVE_FRONT_INSET )
+DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextField, "removeBackInset", BOOLEAN, REMOVE_BACK_INSET )
DALI_SIGNAL_REGISTRATION(Toolkit, TextField, "textChanged", SIGNAL_TEXT_CHANGED )
DALI_SIGNAL_REGISTRATION(Toolkit, TextField, "maxLengthReached", SIGNAL_MAX_LENGTH_REACHED )
mController->SetSpannedText(spannedText);
}
+void TextField::SetRemoveFrontInset(bool remove)
+{
+ mController->SetRemoveFrontInset(remove);
+}
+
+bool TextField::IsRemoveFrontInset() const
+{
+ return mController->IsRemoveFrontInset();
+}
+
+void TextField::SetRemoveBackInset(bool remove)
+{
+ mController->SetRemoveBackInset(remove);
+}
+
+bool TextField::IsRemoveBackInset() const
+{
+ return mController->IsRemoveBackInset();
+}
+
std::string TextField::TextFieldAccessible::GetName() const
{
if(IsHiddenInput())
*/
void SetSpannedText(const Text::Spanned& spannedText);
+ /**
+ * @brief Set removing front inset to TextField.
+ *
+ * @param[in] remove Whether front inset of TextField has to be removed or not.
+ */
+ void SetRemoveFrontInset(const bool remove);
+
+ /**
+ * @brief Whether front inset of TextField is removed or not.
+ *
+ * @return True if the front inset of TextField is removed.
+ */
+ bool IsRemoveFrontInset() const;
+
+ /**
+ * @brief Set removing back inset to TextField.
+ *
+ * @param[in] remove Whether back inset of TextField has to be removed or not.
+ */
+ void SetRemoveBackInset(const bool remove);
+
+ /**
+ * @brief Whether back inset of TextField is removed or not.
+ *
+ * @return True if the back inset of TextField is removed.
+ */
+ bool IsRemoveBackInset() const;
+
private: // Implementation
/**
* @copydoc Dali::Toolkit::Text::Controller::(InputMethodContext& inputMethodContext, const InputMethodContext::EventData& inputMethodContextEvent)
}
break;
}
+ case Toolkit::DevelTextField::Property::REMOVE_FRONT_INSET:
+ {
+ const bool remove = value.Get<bool>();
+ impl.mController->SetRemoveFrontInset(remove);
+ break;
+ }
+ case Toolkit::DevelTextField::Property::REMOVE_BACK_INSET:
+ {
+ const bool remove = value.Get<bool>();
+ impl.mController->SetRemoveBackInset(remove);
+ break;
+ }
}
}
value = map;
break;
}
+ case Toolkit::DevelTextField::Property::REMOVE_FRONT_INSET:
+ {
+ value = impl.mController->IsRemoveFrontInset();
+ break;
+ }
+ case Toolkit::DevelTextField::Property::REMOVE_BACK_INSET:
+ {
+ value = impl.mController->IsRemoveBackInset();
+ break;
+ }
+
} //switch
return value;
}
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextLabel, "relativeLineSize", FLOAT, RELATIVE_LINE_SIZE )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextLabel, "anchorColor", VECTOR4, ANCHOR_COLOR )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextLabel, "anchorClickedColor", VECTOR4, ANCHOR_CLICKED_COLOR )
+DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextLabel, "removeFrontInset", BOOLEAN, REMOVE_FRONT_INSET )
+DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextLabel, "removeBackInset", BOOLEAN, REMOVE_BACK_INSET )
DALI_ANIMATABLE_PROPERTY_REGISTRATION_WITH_DEFAULT(Toolkit, TextLabel, "textColor", Color::BLACK, TEXT_COLOR )
DALI_ANIMATABLE_PROPERTY_COMPONENT_REGISTRATION(Toolkit, TextLabel, "textColorRed", TEXT_COLOR_RED, TEXT_COLOR, 0)
}
break;
}
+ case Toolkit::DevelTextLabel::Property::REMOVE_FRONT_INSET:
+ {
+ const bool remove = value.Get<bool>();
+ impl.mController->SetRemoveFrontInset(remove);
+ break;
+ }
+ case Toolkit::DevelTextLabel::Property::REMOVE_BACK_INSET:
+ {
+ const bool remove = value.Get<bool>();
+ impl.mController->SetRemoveBackInset(remove);
+ break;
+ }
}
// Request relayout when text update is needed. It's necessary to call it
value = impl.mController->GetAnchorClickedColor();
break;
}
+ case Toolkit::DevelTextLabel::Property::REMOVE_FRONT_INSET:
+ {
+ value = impl.mController->IsRemoveFrontInset();
+ break;
+ }
+ case Toolkit::DevelTextLabel::Property::REMOVE_BACK_INSET:
+ {
+ value = impl.mController->IsRemoveBackInset();
+ break;
+ }
}
}
return mController->IsTextFitArrayEnabled();
}
+void TextLabel::SetRemoveFrontInset(bool remove)
+{
+ mController->SetRemoveFrontInset(remove);
+}
+
+bool TextLabel::IsRemoveFrontInset() const
+{
+ return mController->IsRemoveFrontInset();
+}
+
+void TextLabel::SetRemoveBackInset(bool remove)
+{
+ mController->SetRemoveBackInset(remove);
+}
+
+bool TextLabel::IsRemoveBackInset() const
+{
+ return mController->IsRemoveBackInset();
+}
+
std::string TextLabel::TextLabelAccessible::GetNameRaw() const
{
return GetWholeText();
*/
std::string GetLocale();
+ /**
+ * @brief Set removing front inset to text label.
+ *
+ * @param[in] remove Whether front inset of text label has to be removed or not.
+ */
+ void SetRemoveFrontInset(const bool remove);
+
+ /**
+ * @brief Whether front inset of text label is removed or not.
+ *
+ * @return True if the front inset of text label is removed.
+ */
+ bool IsRemoveFrontInset() const;
+
+ /**
+ * @brief Set removing back inset to text label.
+ *
+ * @param[in] remove Whether back inset of text label has to be removed or not.
+ */
+ void SetRemoveBackInset(const bool remove);
+
+ /**
+ * @brief Whether back inset of text label is removed or not.
+ *
+ * @return True if the back inset of text label is removed.
+ */
+ bool IsRemoveBackInset() const;
+
private: // From Control
/**
* @copydoc Control::OnInitialize()
mImpl->mModel->mIgnoreSpacesAfterText = ignore;
}
+bool Controller::IsRemoveFrontInset() const
+{
+ return mImpl->mModel->mRemoveFrontInset;
+}
+
+void Controller::SetRemoveFrontInset(bool remove)
+{
+ mImpl->mModel->mRemoveFrontInset = remove;
+}
+
+bool Controller::IsRemoveBackInset() const
+{
+ return mImpl->mModel->mRemoveBackInset;
+}
+
+void Controller::SetRemoveBackInset(bool remove)
+{
+ mImpl->mModel->mRemoveBackInset = remove;
+}
+
void Controller::ChangedLayoutDirection()
{
mImpl->mIsLayoutDirectionChanged = true;
void SetIgnoreSpacesAfterText(bool ignore);
/**
+ * @brief Retrieves removeFrontInset value from model
+ * @return The value of removeFrontInset
+ */
+ bool IsRemoveFrontInset() const;
+
+ /**
+ * @brief Sets removeFrontInset value to model
+ * @param[in] remove The value of removeFrontInset for the text
+ */
+ void SetRemoveFrontInset(bool remove);
+
+ /**
+ * @brief Retrieves removeBackInset value from model
+ * @return The value of removeBackInset
+ */
+ bool IsRemoveBackInset() const;
+
+ /**
+ * @brief Sets removeBackInset value to model
+ * @param[in] remove The value of removeBackInset for the text
+ */
+ void SetRemoveBackInset(bool remove);
+
+ /**
* @brief Sets SetMatchLayoutDirection value to model
* @param[in] match The value of matchLayoutDirection for the text
*/
{
whiteSpaceLengthEndOfLine = 0.f;
}
- length = std::max(length, penX + glyphMetrics.xBearing + glyphMetrics.width);
+
+ if(parameters.textModel->mRemoveBackInset)
+ {
+ length = std::max(length, penX + glyphMetrics.xBearing + glyphMetrics.width);
+ }
+ else
+ {
+ length = std::max(length, penX + glyphMetrics.advance);
+ }
+
penX += (glyphMetrics.advance + parameters.interGlyphExtraAdvance);
}
}
{
whiteSpaceLengthEndOfLine = 0.f;
}
- length = std::max(length, penX + glyphMetrics.xBearing + glyphMetrics.width);
+
+ if(parameters.textModel->mRemoveBackInset)
+ {
+ length = std::max(length, penX + glyphMetrics.xBearing + glyphMetrics.width);
+ }
+ else
+ {
+ length = std::max(length, penX + glyphMetrics.advance);
+ }
penX += (glyphMetrics.advance + parameters.interGlyphExtraAdvance);
}
}
// The initial start point is zero. However it needs a correction according the 'x' bearing of the first glyph.
// i.e. if the bearing of the first glyph is negative it may exceed the boundaries of the text area.
// It needs to add as well space for the cursor if the text is in edit mode and extra space in case the text is outlined.
- tmpLineLayout.penX = -glyphMetrics.xBearing + mCursorWidth + outlineWidth;
+
+ tmpLineLayout.penX = mCursorWidth + outlineWidth;
+ if(parameters.textModel->mRemoveFrontInset)
+ {
+ tmpLineLayout.penX -= glyphMetrics.xBearing;
+ }
tmpLineLayout.relativeLineSize = lineLayout.relativeLineSize;
tmpLineLayout.penX += tmpLineLayout.previousAdvance + tmpLineLayout.whiteSpaceLengthEndOfLine;
tmpLineLayout.previousAdvance = (glyphMetrics.advance + parameters.interGlyphExtraAdvance);
- tmpLineLayout.length = std::max(tmpLineLayout.length, tmpLineLayout.penX + glyphMetrics.xBearing + glyphMetrics.width);
+ if(parameters.textModel->mRemoveBackInset)
+ {
+ tmpLineLayout.length = std::max(tmpLineLayout.length, tmpLineLayout.penX + glyphMetrics.xBearing + glyphMetrics.width);
+ }
+ else
+ {
+ tmpLineLayout.length = std::max(tmpLineLayout.length, tmpLineLayout.penX + glyphMetrics.advance);
+ }
// Clear the white space length at the end of the line.
tmpLineLayout.whiteSpaceLengthEndOfLine = 0.f;
// If it has a negative x bearing, it will exceed the boundaries of the actor,
// so the penX position needs to be moved to the right.
const GlyphInfo& glyph = *(glyphsBuffer + startIndexForGlyph);
- float penX = -glyph.xBearing + mCursorWidth + outlineWidth; //
+ float penX = mCursorWidth + outlineWidth; //
+
+ if(layoutParameters.textModel->mRemoveFrontInset)
+ {
+ penX -= glyph.xBearing;
+ }
CalculateGlyphPositionsLTR(layoutParameters.textModel->mVisualModel,
layoutParameters.textModel->mLogicalModel,
mAlignmentOffset(0.0f),
mElideEnabled(false),
mIgnoreSpacesAfterText(true),
+ mRemoveFrontInset(true),
+ mRemoveBackInset(true),
mMatchLayoutDirection(DevelText::MatchLayoutDirection::INHERIT),
mEllipsisPosition(DevelText::EllipsisPosition::END)
{
float mAlignmentOffset; ///< The alignment offset.
bool mElideEnabled : 1; ///< Whether the text's elide is enabled.
bool mIgnoreSpacesAfterText : 1; ///< Whether ignoring spaces after text or not. Default is true.
+ bool mRemoveFrontInset : 1; ///< Whether to ignore xBearing of the first glyph. Default is true.
+ bool mRemoveBackInset : 1; ///< Whether to ignore advance of the last glyph. Default is true.
DevelText::MatchLayoutDirection mMatchLayoutDirection; ///< Whether to match text alignment with layout direction or not.
DevelText::EllipsisPosition::Type mEllipsisPosition; ///< Where is the location the text elide
Vector2 mVisualTransformOffset; ///< The offset of the layout based on the controller due to alignment.