Add GetCharacterBoundingRectangle API.
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / text-geometry.h
index c783d9b..6dae02a 100644 (file)
@@ -70,6 +70,52 @@ float GetLineLeft(const LineRun& lineRun);
   */
 float GetLineTop(const Vector<LineRun>& lines, const LineRun& lineRun);
 
+/**
+  * @brief Get the rendered size and position of a specific character in a rectangle.
+  * If the text is not yet rendered or the index > text.Count(); a rect of {0, 0, 0, 0} is returned.
+  * The Width  of the character = glyph.advance
+  * The Height of the character = glyph.height
+  * The Left (X) of the character = characterPosition.x - glyph.xBearing; Regardless of the language direction RTL or LTR, the x point is the left x-point of the glyph. 
+  * The Top  (Y) of the character = characterPosition.y.
+  * @param[in] textModel text model containing text info.
+  * @param[in] charIndex character index to which we want to calculate the geometry for.
+  * @return Rect {x, y, width, height}.
+  */
+Rect<> GetCharacterBoundingRect(ModelPtr textModel, const uint32_t charIndex);
+
+/**
+  * @brief Get the left point of the character (x).
+  *
+  * @param[in] glyph the requested character glyph.
+  * @param[in] characterPosition the position of the requested character.
+  * @return x point of the character.
+  */
+float GetCharacterLeft(const GlyphInfo& glyph, const Vector2& characterPosition);
+
+/**
+  * @brief Get the top point of the character (y).
+  *
+  * @param[in] characterPosition the position of the requested character.
+  * @return y point of the character.
+  */
+float GetCharacterTop(const Vector2& characterPosition);
+
+/**
+  * @brief Get the height of the character.
+  *
+  * @param[in] glyph the requested character glyph.
+  * @return height of the character.
+  */
+float GetCharacterHeight(const GlyphInfo& glyph);
+
+/**
+  * @brief Get the left point of the character.
+  *
+  * @param[in] glyph the requested character glyph.
+  * @return width of the character.
+  */
+float GetCharacterWidth(const GlyphInfo& glyph);
+
 } // namespace Text
 
 } // namespace Toolkit