// EXTERNAL INCLUDES
#include <dali/public-api/common/dali-vector.h>
#include <dali/public-api/common/intrusive-ptr.h>
+#include <dali/public-api/math/vector2.h>
#include <dali/public-api/math/vector4.h>
#include <dali/public-api/object/ref-object.h>
// INTERNAL INCLUDES
#include <dali-toolkit/internal/text/line-run.h>
+#include <dali-toolkit/internal/text/color-run.h>
namespace Dali
{
-struct Vector2;
-
namespace Toolkit
{
namespace Text
{
-struct LineRun;
class VisualModel;
typedef IntrusivePtr<VisualModel> VisualModelPtr;
*
* @pre The glyphs per character table needs to be created first.
*
+ * @param[in] startIndex The character from where the conversion table is created.
+ * @param[in] startGlyphIndex The glyph from where the conversion table is created.
* @param[in] numberOfCharacters The number of characters.
*/
- void CreateCharacterToGlyphTable( Length numberOfCharacters = 0u );
+ void CreateCharacterToGlyphTable( CharacterIndex startIndex,
+ GlyphIndex startGlyphIndex,
+ Length numberOfCharacters );
/**
* @brief Creates an array containing the number of glyphs per character.
*
+ * @param[in] startIndex The character from where the table is created.
+ * @param[in] startGlyphIndex The glyph from where the conversion table is created.
* @param[in] numberOfCharacters The number of characters.
*/
- void CreateGlyphsPerCharacterTable( Length numberOfCharacters = 0u );
+ void CreateGlyphsPerCharacterTable( CharacterIndex startIndex,
+ GlyphIndex startGlyphIndex,
+ Length numberOfCharacters );
/**
* @brief Retrieves glyphs in the given buffer.
GlyphIndex glyphIndex,
Length numberOfGlyphs ) const;
- // Character <--> Glyph conversion
-
- /**
- * @brief Retrieves for each character the number of glyphs the character is shaped.
- *
- * @param[out] glyphsPerCharacter Pointer to a buffer where the number of glyphs for each character are copied.
- * @param[in] characterIndex Index to the first character.
- * @param[in] numberOfCharacters The number of characters.
- */
- void GetGlyphsPerCharacterMap( Length* glyphsPerCharacter,
- CharacterIndex characterIndex,
- Length numberOfCharacters ) const;
-
// Position interface
/**
*/
LineIndex GetLineOfCharacter( CharacterIndex characterIndex );
+ // Underline runs
+
+ /**
+ * @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.
+ */
+ void GetUnderlineRuns( GlyphRun* underlineRuns,
+ UnderlineRunIndex index,
+ Length numberOfRuns ) const;
+
// Size interface
/**
const Vector2& GetNaturalSize() const;
/**
- * @brief Sets the text's actual size after it has been laid out.
+ * @brief Sets the text's layout size.
*
* @param[in] size The text's size.
*/
- void SetActualSize( const Vector2& size );
+ void SetLayoutSize( const Vector2& size );
/**
- * @brief Retrieves the text's actual size after it has been laid out.
+ * @brief Retrieves the text's layout size.
*
* @return The text's size.
*/
- const Vector2& GetActualSize() const;
+ const Vector2& GetLayoutSize() const;
/**
* @brief Set the text's color
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.
Vector2 mControlSize; ///< The size of the UI control the decorator is adding it's decorations to.
Vector4 mTextColor; ///< The text color
private:
Size mNaturalSize; ///< Size of the text with no line wrapping.
- Size mActualSize; ///< Size of the laid-out text considering the layout properties set.
+ Size mLayoutSize; ///< Size of the laid-out text considering the layout properties set.
// Caches to increase performance in some consecutive operations.
LineIndex mCachedLineIndex; ///< Used to increase performance in consecutive calls to GetLineOfGlyph() or GetLineOfCharacter() with consecutive glyphs or characters.
bool mUnderlineEnabled:1; ///< Underline enabled flag
bool mUnderlineColorSet:1; ///< Has the underline color been explicitly set?
-
};
} // namespace Text