[Tizen] Introduce REMOVE_FRONT_INSET, REMOVE_BACK_INSET Property 62/310962/2
authorANZ1217 <chihun.jeong@samsung.com>
Wed, 21 Feb 2024 05:39:52 +0000 (14:39 +0900)
committerANZ1217 <chihun.jeong@samsung.com>
Fri, 10 May 2024 08:34:56 +0000 (17:34 +0900)
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

22 files changed:
automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp
automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp
automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp
dali-toolkit/devel-api/controls/text-controls/text-editor-devel.cpp
dali-toolkit/devel-api/controls/text-controls/text-editor-devel.h
dali-toolkit/devel-api/controls/text-controls/text-field-devel.cpp
dali-toolkit/devel-api/controls/text-controls/text-field-devel.h
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-editor-impl.cpp
dali-toolkit/internal/controls/text-controls/text-editor-impl.h
dali-toolkit/internal/controls/text-controls/text-editor-property-handler.cpp
dali-toolkit/internal/controls/text-controls/text-field-impl.cpp
dali-toolkit/internal/controls/text-controls/text-field-impl.h
dali-toolkit/internal/controls/text-controls/text-field-property-handler.cpp
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.cpp
dali-toolkit/internal/text/controller/text-controller.h
dali-toolkit/internal/text/layouts/layout-engine.cpp
dali-toolkit/internal/text/text-model.cpp
dali-toolkit/internal/text/text-model.h

index 14a4c41..6a5745c 100644 (file)
@@ -117,6 +117,9 @@ const char* const PROPERTY_NAME_ENABLE_GRAB_HANDLE_POPUP        = "enableGrabHan
 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.
 
@@ -634,6 +637,8 @@ int UtcDaliTextEditorGetPropertyP(void)
   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;
 }
@@ -1267,6 +1272,18 @@ int UtcDaliTextEditorSetPropertyP(void)
   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;
 }
 
@@ -6628,4 +6645,31 @@ int utcDaliTextEditorGetTextBoundingRectangle(void)
   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;
+}
index cae5939..d098f99 100644 (file)
@@ -115,6 +115,9 @@ const char* const PROPERTY_NAME_ENABLE_FONT_SIZE_SCALE          = "enableFontSiz
 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.
 
@@ -643,6 +646,8 @@ int UtcDaliTextFieldGetPropertyP(void)
   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;
 }
@@ -1269,6 +1274,19 @@ int UtcDaliTextFieldSetPropertyP(void)
   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;
 }
 
@@ -6134,4 +6152,40 @@ int utcDaliTextFieldDecoratorColor(void)
   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;
+}
index 9ff7e75..576bd0f 100644 (file)
@@ -80,6 +80,9 @@ const char* const PROPERTY_NAME_ELLIPSIS_POSITION    = "ellipsisPosition";
 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
 
@@ -360,6 +363,8 @@ int UtcDaliToolkitTextLabelGetPropertyP(void)
   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;
 }
@@ -1024,6 +1029,18 @@ int UtcDaliToolkitTextLabelSetPropertyP(void)
   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;
 }
 
@@ -3330,4 +3347,40 @@ int utcDaliTextLabelGetTextBoundingRectangle(void)
   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
index eeef11f..84a80b7 100644 (file)
@@ -115,6 +115,26 @@ void PasteText(TextEditor textEditor)
   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
index 9aab35f..1831327 100644 (file)
@@ -325,6 +325,18 @@ enum Type
    * @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
@@ -575,6 +587,39 @@ DALI_TOOLKIT_API std::string CutText(TextEditor textEditor);
  */
 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
index 2105756..7f19475 100644 (file)
@@ -105,6 +105,26 @@ void PasteText(TextField textField)
   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
index a061819..8d368ee 100644 (file)
@@ -249,6 +249,18 @@ enum
    * @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
@@ -474,6 +486,38 @@ DALI_TOOLKIT_API std::string CutText(TextField textField);
  */
 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
index 692aed8..48a4567 100644 (file)
@@ -65,6 +65,26 @@ bool IsTextFitArrayEnabled(TextLabel textLabel)
   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
index 8771255..ed2e5d9 100644 (file)
@@ -218,6 +218,18 @@ enum Type
    * @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
@@ -308,6 +320,38 @@ DALI_TOOLKIT_API std::vector<FitOption>& GetTextFitArray(TextLabel textLabel);
 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
index 54947d5..f6a2144 100644 (file)
@@ -162,6 +162,8 @@ DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit,           TextEditor, "characterSpacin
 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    )
@@ -1381,6 +1383,26 @@ void TextEditor::OnLayoutDirectionChanged(Actor actor, LayoutDirection::Type typ
   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),
index 7b30c17..63d25be 100644 (file)
@@ -440,6 +440,34 @@ public:
    */
   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)
index 067023a..984be66 100644 (file)
@@ -751,6 +751,18 @@ void TextEditor::PropertyHandler::SetProperty(Toolkit::TextEditor textEditor, Pr
       }
       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;
+    }
   }
 }
 
@@ -1180,6 +1192,16 @@ Property::Value TextEditor::PropertyHandler::GetProperty(Toolkit::TextEditor tex
       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;
 }
index 5109a21..b6efa63 100644 (file)
@@ -147,6 +147,8 @@ DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit,           TextField, "strikethrough",
 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     )
@@ -1235,6 +1237,26 @@ void TextField::SetSpannedText(const Text::Spanned& spannedText)
   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())
index afaed24..f1dae5a 100644 (file)
@@ -412,6 +412,34 @@ public:
    */
   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)
index 45af9b7..5151ef1 100644 (file)
@@ -709,6 +709,18 @@ void TextField::PropertyHandler::SetProperty(Toolkit::TextField textField, Prope
       }
       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;
+    }
   }
 }
 
@@ -1096,6 +1108,17 @@ Property::Value TextField::PropertyHandler::GetProperty(Toolkit::TextField textF
       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;
 }
index a860dc8..27d2998 100644 (file)
@@ -144,6 +144,8 @@ DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit,           TextLabel, "characterSpacing
 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)
@@ -590,6 +592,18 @@ void TextLabel::SetProperty(BaseObject* object, Property::Index index, const Pro
         }
         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
@@ -864,6 +878,16 @@ Property::Value TextLabel::GetProperty(BaseObject* object, Property::Index index
         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;
+      }
     }
   }
 
@@ -1374,6 +1398,26 @@ bool TextLabel::IsTextFitArrayEnabled() const
   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();
index 7ef28c6..5730cc5 100644 (file)
@@ -198,6 +198,34 @@ public:
    */
   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()
index 33fcaff..60f7765 100644 (file)
@@ -304,6 +304,26 @@ void Controller::SetIgnoreSpacesAfterText(bool ignore)
   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;
index 2343ad3..07d5754 100644 (file)
@@ -1822,6 +1822,30 @@ public: // Queries & retrieves.
   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
    */
index 57f4d6c..e78a544 100644 (file)
@@ -449,7 +449,16 @@ struct Engine::Impl
           {
             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);
         }
       }
@@ -512,7 +521,15 @@ struct Engine::Impl
         {
           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);
       }
     }
@@ -745,7 +762,12 @@ struct Engine::Impl
     // 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;
 
@@ -842,7 +864,14 @@ struct Engine::Impl
         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;
@@ -1105,7 +1134,12 @@ struct Engine::Impl
     // 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,
index c9f553d..01c6f60 100644 (file)
@@ -368,6 +368,8 @@ Model::Model()
   mAlignmentOffset(0.0f),
   mElideEnabled(false),
   mIgnoreSpacesAfterText(true),
+  mRemoveFrontInset(true),
+  mRemoveBackInset(true),
   mMatchLayoutDirection(DevelText::MatchLayoutDirection::INHERIT),
   mEllipsisPosition(DevelText::EllipsisPosition::END)
 {
index c95b2be..eb0d8a6 100644 (file)
@@ -408,6 +408,8 @@ public:
   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.