Merge "Makes the LTR/RTL alignment of text follow the system language by default...
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / text-view-interface.h
index d005a4a..ee4c306 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef __DALI_TOOLKIT_TEXT_VIEW_INTERFACE_H__
-#define __DALI_TOOLKIT_TEXT_VIEW_INTERFACE_H__
+#ifndef DALI_TOOLKIT_TEXT_VIEW_INTERFACE_H
+#define DALI_TOOLKIT_TEXT_VIEW_INTERFACE_H
 
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
 
 namespace Dali
 {
-
 struct Vector2;
+struct Vector4;
 
 namespace Toolkit
 {
-
 namespace Text
 {
+struct GlyphRun;
 
 /**
- * @brief Abstract interface to provide the information necessary displaying text.
+ * @brief Abstract interface to provide the information necessary to display text.
  *
  * This includes:
  * - The font & glyph IDs needed to get bitmaps etc. from TextAbstraction
@@ -43,7 +43,6 @@ namespace Text
 class ViewInterface
 {
 public:
-
   /**
    * @brief Constructor.
    */
@@ -55,6 +54,21 @@ public:
   virtual ~ViewInterface();
 
   /**
+   * @brief Retrieves the target size of the UI control.
+   *
+   * @return The control's size.
+   */
+  virtual const Vector2& GetControlSize() const = 0;
+
+  /**
+   * @brief Retrieves the text's layout size.
+   *
+   * @return The text's size. Note that this may be larger than the control size,
+   * in the case where text is scrolling/clipped.
+   */
+  virtual const Vector2& GetLayoutSize() const = 0;
+
+  /**
    * Retrieves the number of glyphs.
    *
    * @return The number of glyphs.
@@ -62,28 +76,153 @@ public:
   virtual Length GetNumberOfGlyphs() const = 0;
 
   /**
-   * @brief Retrieves glyphs in the given buffer.
+   * @brief Retrieves glyphs and positions in the given buffers.
+   *
+   * @note The size of the @p glyphs and @p glyphPositions buffers need to be big enough to copy the @p numberOfGlyphs glyphs and positions.
+   * @note The returned number of glyphs may be less than @p numberOfGlyphs if a line has ellipsis.
    *
-   * The size of the @p glyphs buffer needs to be big enough to copy the @p numberOfGlyphs.
    * @param[out] glyphs Pointer to a buffer where the glyphs are copied.
+   * @param[out] glyphPositions Pointer to a buffer where the glyph's positions are copied.
+   * @param[out] minLineOffset The minimum line offset.
    * @param[in] glyphIndex Index to the first glyph.
    * @param[in] numberOfGlyphs Number of glyphs to be copied.
+   *
+   * @return The number of glyphs.
+   */
+  virtual Length GetGlyphs(GlyphInfo* glyphs,
+                           Vector2*   glyphPositions,
+                           float&     minLineOffset,
+                           GlyphIndex glyphIndex,
+                           Length     numberOfGlyphs) const = 0;
+
+  /**
+   * @brief Retrieves the vector of colors.
+   *
+   * @return Pointer to the vector of colors.
+   */
+  virtual const Vector4* const GetColors() const = 0;
+
+  /**
+   * @brief Retrieves the vector of indices to the vector of colors.
+   *
+   * @return Pointer to a vector which stores for each glyph the index to the vector of colors.
+   */
+  virtual const ColorIndex* const GetColorIndices() const = 0;
+
+  /**
+   * @brief Retrieves the vector of background colors.
+   *
+   * @return Pointer to the vector of background colors.
+   */
+  virtual const Vector4* const GetBackgroundColors() const = 0;
+
+  /**
+   * @brief Retrieves the vector of indices to the vector of background colors.
+   *
+   * @return Pointer to a vector which stores for each glyph the index to the vector of background colors.
+   */
+  virtual const ColorIndex* const GetBackgroundColorIndices() const = 0;
+
+  /**
+   * @brief checks if there is background colors set using markup.
+   *
+   * @return boolean if there is background colors set using markup .
+   */
+  virtual bool const IsMarkupBackgroundColorSet() const = 0;
+
+  /**
+   * @brief Retrieves the text color
+   *
+   * @return The text color
+   */
+  virtual const Vector4& GetTextColor() const = 0;
+
+  /**
+   * @brief Retrieves the shadow offset, 0 indicates no shadow.
+   *
+   * @return The shadow offset.
+   */
+  virtual const Vector2& GetShadowOffset() const = 0;
+
+  /**
+   * @brief Retrieves the shadow color.
+   *
+   * @return The shadow color.
+   */
+  virtual const Vector4& GetShadowColor() const = 0;
+
+  /**
+   * @brief Retrieves the underline color.
+   *
+   * @return The underline color.
+   */
+  virtual const Vector4& GetUnderlineColor() const = 0;
+
+  /**
+   * @brief Returns whether underline is enabled or not.
+   *
+   * @return The underline state.
+   */
+  virtual bool IsUnderlineEnabled() const = 0;
+
+  /**
+   * @brief Returns the hyphens glyph info.
+   *
+   * @return hyphens glyph info.
+   */
+  virtual const GlyphInfo* GetHyphens() const = 0;
+
+  /**
+   * @brief Returns the indices of the hyphen in the text.
+   *
+   * @return the hyphen indices.
+   */
+  virtual const Length* GetHyphenIndices() const = 0;
+
+  /**
+   * @brief Returns number of hyphens to add in text.
+   *
+   * @return number of hyphens.
+   */
+  virtual Length GetHyphensCount() const = 0;
+  /**
+   * @brief Retrieves the underline height override
+   *
+   * @return Returns the override height for an underline, 0 indicates that adaptor will determine the height
+   */
+  virtual float GetUnderlineHeight() const = 0;
+
+  /**
+   * @brief Retrieves the number of underline runs.
+   *
+   * @return The number of underline runs.
+   */
+  virtual Length GetNumberOfUnderlineRuns() const = 0;
+
+  /**
+   * @brief Retrieves the underline runs.
+   *
+   * @param[out] underlineRuns Pointer to a buffer where the underline runs are copied.
+   * @param[in] index Index of the first underline run to be copied.
+   * @param[in] numberOfRuns Number of underline runs to be copied.
+   */
+  virtual void GetUnderlineRuns(GlyphRun*         underlineRuns,
+                                UnderlineRunIndex index,
+                                Length            numberOfRuns) const = 0;
+
+  /**
+   * @brief Retrieve the outline color.
+   *
+   * @return The outline color.
    */
-  virtual void GetGlyphs( GlyphInfo* glyphs,
-                          GlyphIndex glyphIndex,
-                          Length numberOfGlyphs ) const = 0;
+  virtual const Vector4& GetOutlineColor() const = 0;
 
   /**
-   * @brief Retrieves the glyph positions.
+   * @brief Retrieves the width of an outline
    *
-   * @pre The size of the @p positions buffer needs to be big enough to copy the @p numberOfGlyphs positions.
-   * @param[out] glyphPositions Pointer to a buffer where the glyph positions are copied.
-   * @param[in] glyphIndex Index to the first glyph position.
-   * @param[in] numberOfGlyphs The number of positions to be copied.
+   * @return The width of the outline.
    */
-  virtual void GetGlyphPositions( Vector2* glyphPositions,
-                                  GlyphIndex glyphIndex,
-                                  Length numberOfGlyphs ) const = 0;
+  virtual uint16_t GetOutlineWidth() const = 0;
 };
 
 } // namespace Text
@@ -92,4 +231,4 @@ public:
 
 } // namespace Dali
 
-#endif // __DALI_TOOLKIT_TEXT_VIEW_INTERFACE_H__
+#endif // DALI_TOOLKIT_TEXT_VIEW_INTERFACE_H