support strikethrough markup tag
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / visual-model-impl.h
index 710f0ab..673156b 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_TEXT_VISUAL_MODEL_IMPL_H
 
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -28,6 +28,7 @@
 // INTERNAL INCLUDES
 #include <dali-toolkit/internal/text/color-run.h>
 #include <dali-toolkit/internal/text/line-run.h>
+#include <dali-toolkit/internal/text/strikethrough-glyph-run.h>
 #include <dali-toolkit/public-api/text/text-enumerations.h>
 
 // DEVEL INCLUDES
@@ -552,6 +553,24 @@ public:
    */
   float GetStrikethroughHeight() const;
 
+  /**
+   * @brief Retrieves the strikethrough runs.
+   *
+   * @param[out] strikethroughRuns Pointer to a buffer where the strikethrough runs are copied.
+   * @param[in] index Index of the first strikethrough run to be copied.
+   * @param[in] numberOfRuns Number of strikethrough runs to be copied.
+   */
+  void GetStrikethroughRuns(StrikethroughGlyphRun* strikethroughRuns,
+                            StrikethroughRunIndex  index,
+                            Length                 numberOfRuns) const;
+
+  /**
+   * @brief Retrieves the number of strikethrough runs.
+   *
+   * @return The number of strikethrough runs.
+   */
+  Length GetNumberOfStrikethroughRuns() const;
+
 protected:
   /**
    * @brief A reference counted object may only be deleted by calling Unreference().
@@ -571,33 +590,34 @@ private:
   VisualModel& operator=(const VisualModel& handle);
 
 public:
-  Vector<GlyphInfo>      mGlyphs;                 ///< For each glyph, the font's id, glyph's index within the font and glyph's metrics.
-  Vector<CharacterIndex> mGlyphsToCharacters;     ///< For each glyph, the index of the first character.
-  Vector<GlyphIndex>     mCharactersToGlyph;      ///< For each character, the index of the first glyph.
-  Vector<Length>         mCharactersPerGlyph;     ///< For each glyph, the number of characters that form the glyph.
-  Vector<Length>         mGlyphsPerCharacter;     ///< For each character, the number of glyphs that are shaped.
-  Vector<Vector2>        mGlyphPositions;         ///< For each glyph, the position.
-  Vector<LineRun>        mLines;                  ///< The laid out lines.
-  Vector<GlyphRun>       mUnderlineRuns;          ///< Runs of glyphs that are underlined.
-  Vector<Vector4>        mColors;                 ///< Colors of the glyphs.
-  Vector<ColorIndex>     mColorIndices;           ///< Indices to the vector of colors for each glyphs.
-  Vector<Vector4>        mBackgroundColors;       ///< Background colors of the glyphs.
-  Vector<ColorIndex>     mBackgroundColorIndices; ///< Indices to the vector of background colors for each glyphs.
-  Vector4                mTextColor;              ///< The text color
-  Vector4                mShadowColor;            ///< Color of drop shadow
-  Vector4                mUnderlineColor;         ///< Color of underline
-  Vector4                mOutlineColor;           ///< Color of outline
-  Vector4                mBackgroundColor;        ///< Color of text background
-  Vector4                mStrikethroughColor;     ///< Color of text background
-  Size                   mControlSize;            ///< The size of the UI control.
-  Vector2                mShadowOffset;           ///< Offset for drop shadow, 0 indicates no shadow
-  float                  mUnderlineHeight;        ///< Fixed height for underline to override font metrics.
-  float                  mStrikethroughHeight;    ///< Fixed height for strikethrough to override font metrics.
-  Text::Underline::Type  mUnderlineType;          ///< The type of the underline.
-  float                  mDashedUnderlineWidth;   ///< The width of the dashes of the dashed underline.
-  float                  mDashedUnderlineGap;     ///< The gap between the dashes of the dashed underline.
-  float                  mShadowBlurRadius;       ///< Blur radius of shadow, 0 indicates no blur.
-  uint16_t               mOutlineWidth;           ///< Width of outline.
+  Vector<GlyphInfo>             mGlyphs;                 ///< For each glyph, the font's id, glyph's index within the font and glyph's metrics.
+  Vector<CharacterIndex>        mGlyphsToCharacters;     ///< For each glyph, the index of the first character.
+  Vector<GlyphIndex>            mCharactersToGlyph;      ///< For each character, the index of the first glyph.
+  Vector<Length>                mCharactersPerGlyph;     ///< For each glyph, the number of characters that form the glyph.
+  Vector<Length>                mGlyphsPerCharacter;     ///< For each character, the number of glyphs that are shaped.
+  Vector<Vector2>               mGlyphPositions;         ///< For each glyph, the position.
+  Vector<LineRun>               mLines;                  ///< The laid out lines.
+  Vector<GlyphRun>              mUnderlineRuns;          ///< Runs of glyphs that are underlined.
+  Vector<Vector4>               mColors;                 ///< Colors of the glyphs.
+  Vector<ColorIndex>            mColorIndices;           ///< Indices to the vector of colors for each glyphs.
+  Vector<Vector4>               mBackgroundColors;       ///< Background colors of the glyphs.
+  Vector<ColorIndex>            mBackgroundColorIndices; ///< Indices to the vector of background colors for each glyphs.
+  Vector4                       mTextColor;              ///< The text color
+  Vector4                       mShadowColor;            ///< Color of drop shadow
+  Vector4                       mUnderlineColor;         ///< Color of underline
+  Vector4                       mOutlineColor;           ///< Color of outline
+  Vector4                       mBackgroundColor;        ///< Color of text background
+  Vector4                       mStrikethroughColor;     ///< Color of text background
+  Size                          mControlSize;            ///< The size of the UI control.
+  Vector2                       mShadowOffset;           ///< Offset for drop shadow, 0 indicates no shadow
+  float                         mUnderlineHeight;        ///< Fixed height for underline to override font metrics.
+  float                         mStrikethroughHeight;    ///< Fixed height for strikethrough to override font metrics.
+  Text::Underline::Type         mUnderlineType;          ///< The type of the underline.
+  float                         mDashedUnderlineWidth;   ///< The width of the dashes of the dashed underline.
+  float                         mDashedUnderlineGap;     ///< The gap between the dashes of the dashed underline.
+  float                         mShadowBlurRadius;       ///< Blur radius of shadow, 0 indicates no blur.
+  uint16_t                      mOutlineWidth;           ///< Width of outline.
+  Vector<StrikethroughGlyphRun> mStrikethroughRuns;      ///< Runs of glyphs that have strikethrough.
 
 private:
   Size mNaturalSize; ///< Size of the text with no line wrapping.