X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Fvisual-model-impl.h;h=359b695deb20c9ca441ed9eddc5b142a878afef9;hb=75fe6c4a2f784bd52ccf8eb16049317825338a6e;hp=227019f2650c9782a961b7eb9960394ec16fbd11;hpb=5064025f6246c31c82cd1531084b639ac9c3237d;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/text/visual-model-impl.h b/dali-toolkit/internal/text/visual-model-impl.h index 227019f..359b695 100644 --- a/dali-toolkit/internal/text/visual-model-impl.h +++ b/dali-toolkit/internal/text/visual-model-impl.h @@ -1,8 +1,8 @@ -#ifndef __DALI_TOOLKIT_TEXT_VISUAL_MODEL_IMPL_H__ -#define __DALI_TOOLKIT_TEXT_VISUAL_MODEL_IMPL_H__ +#ifndef DALI_TOOLKIT_TEXT_VISUAL_MODEL_IMPL_H +#define DALI_TOOLKIT_TEXT_VISUAL_MODEL_IMPL_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. @@ -21,24 +21,30 @@ // EXTERNAL INCLUDES #include #include +#include #include #include // INTERNAL INCLUDES +#include #include +// DEVEL INCLUDES +#include + namespace Dali { - -struct Vector2; - namespace Toolkit { - namespace Text { +struct HyphenInfo +{ + Vector glyph; + Vector position; + Vector index; +}; -struct LineRun; class VisualModel; typedef IntrusivePtr VisualModelPtr; @@ -52,7 +58,6 @@ typedef IntrusivePtr VisualModelPtr; class VisualModel : public RefObject { public: - /** * @brief Create a new instance of a VisualModel. * @@ -63,43 +68,28 @@ public: // Glyph interface. /** - * @brief Replaces any glyphs previously set. - * - * @note If the number of glyphs is zero, all buffers are cleared. - * @note If one pointer is NULL and the number of glyphs is not zero, the buffer is not touched. - * - * @param[in] glyphs An array of glyphs in the visual order. - * @param[in] characterIndices An array containing the first character in the logical model that each glyph relates to. - * @param[in] charactersPerGlyph An array containing the number of characters per glyph. - * @param[in] numberOfGlyphs The number of glyphs. - */ - void SetGlyphs( const GlyphInfo* const glyphs, - const CharacterIndex* const characterIndices, - const Length* const charactersPerGlyph, - Length numberOfGlyphs ); - - /** * @brief Creates the character to glyph conversion table. * * @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 ); - - /** - * @brief Retrieves the number of glyphs. - * - * @return The number of glyphs. - */ - Length GetNumberOfGlyphs() const; + void CreateGlyphsPerCharacterTable(CharacterIndex startIndex, + GlyphIndex startGlyphIndex, + Length numberOfCharacters); /** * @brief Retrieves glyphs in the given buffer. @@ -109,439 +99,430 @@ public: * @param[in] glyphIndex Index to the first glyph. * @param[in] numberOfGlyphs Number of glyphs to be copied. */ - void GetGlyphs( GlyphInfo* glyphs, - GlyphIndex glyphIndex, - Length numberOfGlyphs ) const; + void GetGlyphs(GlyphInfo* glyphs, + GlyphIndex glyphIndex, + Length numberOfGlyphs) const; + + // Position interface /** - * @brief Retrieves a glyph. + * @brief Retrieves the glyph positions. * - * @param[in] glyphIndex Index to a glyph. + * @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. + */ + void GetGlyphPositions(Vector2* glyphPositions, + GlyphIndex glyphIndex, + Length numberOfGlyphs) const; + + // Line interface. + + /** + * @brief Retrieves the number of lines and the index to the first line where the given range of glyphs is laid out. * - * @return A glyph. + * @param[in] glyphIndex Index to the first glyph. + * @param[in] numberOfGlyphs The number of glyph. + * @param[out] firstLine Index to the line containing the glyph index. + * @param[out] numberOfLines The number of lines. */ - const GlyphInfo& GetGlyphInfo( GlyphIndex glyphIndex ) const; + void GetNumberOfLines(GlyphIndex glyphIndex, + Length numberOfGlyphs, + LineIndex& firstLine, + Length& numberOfLines) const; /** - * @brief Replaces glyphs. + * @brief Retrieves the lines where the given range of glyphs is laid out. * - * If the @p numberOfGlyphsToRemove is zero, this operation is like an insert. - * If the @p numberOfGlyphsToInsert is zero, this operation is like a remove. + * The size of the @p lines buffer needs to be big enough to copy the @p numberOfLines. * - * @param[in] glyphIndex Where to replace the glyphs. - * @param[in] numberOfGlyphsToRemove The number of glyphs to be removed. - * @param[in] glyphs Pointer to a buffer with the new glyphs. - * @param[in] numberOfCharacters Pointer to a buffer with the number of characters per glyph. - * @param[in] numberOfGlyphsToInsert The number of new glyphs in the buffer. + * @param[out] lines Pointer to a buffer where the lines are copied. + * @param[in] glyphIndex Index to the first glyphs of the range. + * @param[in] numberOfGlyphs Number of glyphs in the range. */ - void ReplaceGlyphs( GlyphIndex glyphIndex, - Length numberOfGlyphsToRemove, - const GlyphInfo* const glyphs, - const Length* const numberOfCharacters, - Length numberOfGlyphsToInsert ); - - // Character <--> Glyph conversion + void GetLinesOfGlyphRange(LineRun* lines, + GlyphIndex glyphIndex, + Length numberOfGlyphs) const; /** - * @brief Retrieves the first character in the logical model which a glyph represents. + * @brief Retrieves the line index where the character is laid-out. * - * @note After shaping several characters may be represented by the same glyph. - * Alternatively several glyphs may be required to display a character. - * @param[in] glyphIndex The glyph index. - * @return The character index. + * @param[in] characterIndex The character's index. + * + * @return The line index. */ - CharacterIndex GetCharacterIndex( GlyphIndex glyphIndex ) const; + LineIndex GetLineOfCharacter(CharacterIndex characterIndex); + + // Underline runs /** - * @brief Query the number of characters the glyph represents. + * @brief Retrieves the underline runs. * - * @param[in] glyphIndex The glyph index. - * @return The number of characters represented by the glyph. + * @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. */ - Length GetCharactersPerGlyph( GlyphIndex glyphIndex ) const; + void GetUnderlineRuns(GlyphRun* underlineRuns, + UnderlineRunIndex index, + Length numberOfRuns) const; + + // Size interface /** - * @brief Retrieves the first glyph in the visual model which represents a given character. + * @brief Sets the natural size. * - * @note After shaping several characters may be represented by the same glyph. - * Alternatively several glyphs may be required to display a character. - * @param[in] characterIndex The character index. - * @return The glyph index. + * @param[in] size The text's natural size. */ - GlyphIndex GetGlyphIndex( CharacterIndex characterIndex ) const; + void SetNaturalSize(const Vector2& size); /** - * @brief Retrieves the whole or part of the character to glyph conversion map. + * @brief Retrieves the natural size. * - * The size of the buffer needs to be big enough to copy the @p numberOfCharacters. + * @return The text's natural size. + */ + const Vector2& GetNaturalSize() const; + + /** + * @brief Sets the text's layout size. * - * @param[out] characterToGlyphMap Pointer to a buffer where the conversion map is copied. - * @param[in] characterIndex Index to the first character. - * @param[in] numberOfCharacters The number of characters. + * @param[in] size The text's size. */ - void GetCharacterToGlyphMap( GlyphIndex* characterToGlyphMap, - CharacterIndex characterIndex, - Length numberOfCharacters ) const; + void SetLayoutSize(const Vector2& size); /** - * @brief Retrieves the whole or part of the glyph to character conversion map. + * @brief Retrieves the text's layout size. * - * The size of the buffer needs to be big enough to copy the @p numberOfGlyphs. + * @return The text's size. + */ + const Vector2& GetLayoutSize() const; + + /** + * @brief Set the text's color * - * @param[out] glyphToCharacter Pointer to a buffer where the conversion map is copied. - * @param[in] glyphIndex Index to the first glyph. - * @param[in] numberOfGlyphs The number of glyphs. + * @param[in] textColor The text's color */ - void GetGlyphToCharacterMap( CharacterIndex* glyphToCharacter, - GlyphIndex glyphIndex, - Length numberOfGlyphs ) const; + void SetTextColor(const Vector4& textColor); /** - * @brief Retrieves for each glyph the number of characters the glyph represents. + * @brief Retrieve the text's color * - * @param[out] charactersPerGlyph Pointer to a buffer where the number of characters for each glyph are copied. - * @param[in] glyphIndex Index to the first glyph. - * @param[in] numberOfGlyphs The number of glyphs. + * @return The text's color */ - void GetCharactersPerGlyphMap( Length* charactersPerGlyph, - GlyphIndex glyphIndex, - Length numberOfGlyphs ) const; + const Vector4& GetTextColor() const; /** - * @brief Retrieves for each character the number of glyphs the character is shaped. + * @brief Sets the text's shadow offset. * - * @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. + * @param[in] shadowOffset The shadow offset, 0,0 indicates no shadow. */ - void GetGlyphsPerCharacterMap( Length* glyphsPerCharacter, - CharacterIndex characterIndex, - Length numberOfCharacters ) const; + void SetShadowOffset(const Vector2& shadowOffset); - // Position interface + /** + * @brief Retrieves the text's shadow offset. + * + * @return The text's shadow offset, 0,0 indicates no shadow. + */ + const Vector2& GetShadowOffset() const; /** - * @brief Replaces any glyph positions previously set. + * @brief Sets the text's shadow color. * - * @note If the number of glyphs is zero the position buffer is cleared. + * @param[in] shadowColor The shadow color. + */ + void SetShadowColor(const Vector4& shadowColor); + + /** + * @brief Retrieves the text's shadow color. * - * @param[in] glyphPositions An array of visual positions for each glyph. - * @param[in] numberOfGlyphs The number of positions. + * @return The text's shadow color. */ - void SetGlyphPositions( const Vector2* const glyphPositions, - Length numberOfGlyphs ); + const Vector4& GetShadowColor() const; /** - * @brief Retrieves the number of glyph positions set. + * @brief Set the shadow blur radius. * - * @note This may be less than the number of glyphs in the model. - * @return The number of glyphs. + * @param[in] shadowBlurRadius The shadow blur radius, 0,0 indicates no blur. */ - Length GetNumberOfGlyphPositions() const; + void SetShadowBlurRadius(const float& shadowBlurRadius); /** - * @brief Retrieves the glyph positions. + * @brief Retrieve the shadow blur radius. * - * @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 shadow blur radius. */ - void GetGlyphPositions( Vector2* glyphPositions, - GlyphIndex glyphIndex, - Length numberOfGlyphs ) const; + const float& GetShadowBlurRadius() const; /** - * @brief Retrieve the glyph's position of the given glyph. + * @brief Sets the text's underline color. * - * @param[in] glyphIndex Index to the glyph. + * @param[in] color The text's underline color. + */ + void SetUnderlineColor(const Vector4& color); + + /** + * @brief Retrieves the text's underline color. * - * @return The glyph's position. + * @return The text's underline color. */ - const Vector2& GetGlyphPosition( GlyphIndex glyphIndex ) const; + const Vector4& GetUnderlineColor() const; /** - * @brief Replaces glyph's positions. + * @brief Sets the text underline flag. * - * If the @p numberOfGlyphsToRemove is zero, this operation is like an insert. - * If the @p numberOfGlyphsToInsert is zero, this operation is like a remove. + * @param[in] enabled true if underlined. + */ + void SetUnderlineEnabled(bool enabled); + + /** + * @brief Returns whether the text is underlined or not. * - * @param[in] glyphIndex Where to replace the glyph's positions. - * @param[in] numberOfGlyphsToRemove The number of glyph's positions to be removed. - * @param[in] positions Pointer to a buffer with the new glyph's positions. - * @param[in] numberOfGlyphsToInsert The number of new glyph's positions in the buffer. + * @return underline state. */ - void ReplaceGlyphPositions( GlyphIndex glyphIndex, - Length numberOfGlyphsToRemove, - const Vector2* const positions, - Length numberOfGlyphsToInsert ); + bool IsUnderlineEnabled() const; - // Line interface. + /** + * @brief Clear the caches. + */ + void ClearCaches(); /** - * @brief Sets the lines. - * - * Replaces any lines previously set. - * - * Every line is an item run containing the index to the first glyph of the line and the number of glyphs. - * - * @note If the number of lines is zero or the pointer is NULL, the lines buffer is cleared. + * @brief Set the override used for underline height, 0 indicates height will be come from font metrics * - * @param[in] lines Pointer to a buffer containing all the line runs. - * @param[in] numberOfLines The number of lines in the buffer. + * @param[in] height The height in pixels of the underline */ - void SetLines( const LineRun* const lines, - Length numberOfLines ); + void SetUnderlineHeight(float height); /** - * @brief Retrieves the number of lines of the whole text. + * @brief Retrieves the underline height override * - * @return The number of lines. + * @return Returns the override height for an underline, 0 indicates that font metrics will determine the height */ - Length GetNumberOfLines() const; + float GetUnderlineHeight() const; /** - * @brief Retrieves lines. + * @brief Retrieves the number of underline runs. * - * The size of the @p lines buffer needs to be big enough to copy the @p numberOfLines. - * - * @param[out] lines Pointer to a buffer where the lines are copied. - * @param[in] lineIndex Index to the first line. - * @param[in] numberOfLines Number of lines to be copied. + * @return The number of underline runs. */ - void GetLines( LineRun* lines, - LineIndex lineIndex, - Length numberOfLines ) const; + Length GetNumberOfUnderlineRuns() const; /** - * @brief Retrieves the number of lines and the index to the first line where the given range of glyphs is laid out. + * @brief Set the outline color. * - * @param[in] glyphIndex Index to the first glyph. - * @param[in] numberOfGlyphs The number of glyph. - * @param[out] firstLine Index to the line containing the glyph index. - * @param[out] numberOfLines The number of lines. + * @param[in] color color of outline. */ - void GetNumberOfLines( GlyphIndex glyphIndex, - Length numberOfGlyphs, - LineIndex& firstLine, - Length& numberOfLines ) const; + void SetOutlineColor(const Vector4& color); + /** - * @brief Retrieves the lines where the given range of glyphs is laid out. - * - * The size of the @p lines buffer needs to be big enough to copy the @p numberOfLines. + * @brief Retrieve the outline color. * - * @param[out] lines Pointer to a buffer where the lines are copied. - * @param[in] glyphIndex Index to the first glyphs of the range. - * @param[in] numberOfGlyphs Number of glyphs in the range. + * @return The outline color. */ - void GetLinesOfGlyphRange( LineRun* lines, - GlyphIndex glyphIndex, - Length numberOfGlyphs ) const; + const Vector4& GetOutlineColor() const; /** - * @brief Retrieves the line index where the glyph is laid-out. + * @brief Set the outline width * - * @param[in] glyphIndex The glyph's index. - * - * @return The line index. + * @param[in] width The width in pixels of the outline, 0 indicates no outline */ - LineIndex GetLineOfGlyph( GlyphIndex glyphIndex ); + void SetOutlineWidth(uint16_t width); /** - * @brief Retrieves the line index where the character is laid-out. + * @brief Retrieves the width of an outline * - * @param[in] characterIndex The character's index. - * - * @return The line index. + * @return The width of the outline. */ - LineIndex GetLineOfCharacter( CharacterIndex characterIndex ); + uint16_t GetOutlineWidth() const; /** - * @brief Replaces lines for the given range of glyphs. + * @brief Sets the text's background color. * - * If the @p numberOfGlyphsToRemove is zero, this operation is like an insert. - * If the @p numberOfGlyphsToInsert is zero, this operation is like a remove. - * - * @param[in] glyphIndex Index of the first glyph where to replace the line info. - * @param[in] numberOfGlyphsToRemove The number of glyphs to be the line info removed. - * @param[in] lines Pointer to a buffer with the lines. - * @param[in] numberOfGlyphsToInsert The number of characters to be the line info inserted. + * @param[in] color The text's background color. */ - void ReplaceLines( GlyphIndex glyphIndex, - Length numberOfGlyphsToRemove, - const LineRun* const lines, - Length numberOfGlyphsToInsert ); - - // Size interface + void SetBackgroundColor(const Vector4& color); /** - * @brief Sets the natural size. + * @brief Retrieves the text's background color. * - * @param[in] size The text's natural size. + * @return The text's background color. */ - void SetNaturalSize( const Vector2& size ); + const Vector4& GetBackgroundColor() const; /** - * @brief Retrieves the natural size. + * @brief Sets whether the text has a background or not. * - * @return The text's natural size. + * @param[in] enabled true if the text has a background. */ - const Vector2& GetNaturalSize() const; + void SetBackgroundEnabled(bool enabled); /** - * @brief Sets the text's actual size after it has been laid out. + * @brief Returns whether the text has a background or not. * - * @param[in] size The text's size. + * @return whether the text has a background or not. */ - void SetActualSize( const Vector2& size ); + bool IsBackgroundEnabled() const; /** - * @brief Retrieves the text's actual size after it has been laid out. + * @brief Sets whether the text has a markup-processor or not. * - * @return The text's size. + * @param[in] enabled true if the text has a markup-processor. */ - const Vector2& GetActualSize() const; + void SetMarkupProcessorEnabled(bool enabled); /** - * @brief Set the text's color + * @brief Returns whether the text has a markup-processor or not. * - * @param[in] textColor The text's color + * @return whether the text has a markup-processor or not. */ - void SetTextColor( const Vector4& textColor ); + bool IsMarkupProcessorEnabled() const; /** - * @brief Retrieve the text's color - * - * @return The text's color + * @brief Sets ellipsis position + * @param[in] ellipsisPosition The ellipsis position for the text */ - const Vector4& GetTextColor() const; + void SetEllipsisPosition(Toolkit::DevelText::EllipsisPosition::Type ellipsisPosition); /** - * @brief Sets the text's shadow offset. + * @brief Retrieves ellipsis position for text. * - * @param[in] shadowOffset The shadow offset, 0,0 indicates no shadow. + * @return The ellipsis position. */ - void SetShadowOffset( const Vector2& shadowOffset ); + Toolkit::DevelText::EllipsisPosition::Type GetEllipsisPosition() const; /** - * @brief Retrieves the text's shadow offset. + * @brief Enable or disable the text elide. * - * @return The text's shadow offset, 0,0 indicates no shadow. + * @param[in] enabled Whether to enable the text elide. */ - const Vector2& GetShadowOffset() const; + void SetTextElideEnabled(bool enabled); /** - * @brief Sets the text's shadow color. + * @brief Whether the text elide property is enabled. * - * @param[in] shadowColor The shadow color. + * @return @e true if the text elide property is enabled, @e false otherwise. */ - void SetShadowColor( const Vector4& shadowColor ); + bool IsTextElideEnabled() const; /** - * @brief Retrieves the text's shadow color. + * @brief Sets the start index of laid-out glyphs. * - * @return The text's shadow color. + * @param[in] startIndexOfElidedGlyphs The start index of laid-out glyphs. */ - const Vector4& GetShadowColor() const; + void SetStartIndexOfElidedGlyphs(GlyphIndex startIndexOfElidedGlyphs); /** - * @brief Sets the text's underline color. + * @brief Sets the end index of elided glyphs. * - * @param[in] color The text's underline color. + * @param[in] endIndexOfElidedGlyphs The end index of elided glyphs. */ - void SetUnderlineColor( const Vector4& color ); + void SetEndIndexOfElidedGlyphs(GlyphIndex endIndexOfElidedGlyphs); /** - * @brief Retrieves the text's underline color. + * @brief Sets the first middle index of elided glyphs, index before ellipsis of middle. * - * @return The text's underline color. + * @param[in] firstMiddleIndexOfElidedGlyphs The first middle index of elided glyphs, index before ellipsis of middle. */ - const Vector4& GetUnderlineColor() const; + void SetFirstMiddleIndexOfElidedGlyphs(GlyphIndex firstMiddleIndexOfElidedGlyphs); /** - * @brief Sets the text underline flag. + * @brief Sets the second middle index of elided glyphs, index of ellipsis of middle. * - * @param[in] enabled true if underlined. + * @param[in] secondMiddleIndexOfElidedGlyphs The second middle index of elided glyphs, index of ellipsis of middle. */ - void SetUnderlineEnabled( bool enabled ); + void SetSecondMiddleIndexOfElidedGlyphs(GlyphIndex secondMiddleIndexOfElidedGlyphs); /** - * @brief Returns whether the text is underlined or not. + * @brief Retrieves the start index of laid-out glyphs. * - * @return underline state. + * @return The start index of laid-out glyphs. */ - bool IsUnderlineEnabled() const; + GlyphIndex GetStartIndexOfElidedGlyphs() const; /** - * @brief Clear the caches. + * @brief Retrieves the end index of laid-out glyphs. + * + * @return The end index of laid-out glyphs. */ - void ClearCaches(); + GlyphIndex GetEndIndexOfElidedGlyphs() const; /** - * @brief Set the override used for underline height, 0 indicates height will be come from font metrics + * @brief Retrieves the first middle index of elided glyphs, index before ellipsis of middle. * - * @param[in] height The height in pixels of the underline + * @return The first middle index of elided glyphs, index before ellipsis of middle. */ - void SetUnderlineHeight( float height ); + GlyphIndex GetFirstMiddleIndexOfElidedGlyphs() const; /** - * @brief Retrieves the underline height override + * @brief Retrieves the second middle index of elided glyphs, index of ellipsis of middle. * - * @return Returns the override height for an underline, 0 indicates that font metrics will determine the height + * @return The second middle index of elided glyphs, index of ellipsis of middle. */ - float GetUnderlineHeight() const; + GlyphIndex GetSecondMiddleIndexOfElidedGlyphs() const; protected: - /** * @brief A reference counted object may only be deleted by calling Unreference(). */ virtual ~VisualModel(); private: - /** * @brief Private constructor. */ VisualModel(); // Undefined - VisualModel( const VisualModel& handle ); + VisualModel(const VisualModel& handle); // Undefined - VisualModel& operator=( const VisualModel& handle ); + VisualModel& operator=(const VisualModel& handle); public: - - Vector mGlyphs; ///< For each glyph, the font's id, glyph's index within the font and glyph's metrics. - Vector mGlyphsToCharacters; ///< For each glyph, the index of the first character. - Vector mCharactersToGlyph; ///< For each character, the index of the first glyph. - Vector mCharactersPerGlyph; ///< For each glyph, the number of characters that form the glyph. - Vector mGlyphsPerCharacter; ///< For each character, the number of glyphs that are shaped. - Vector mGlyphPositions; ///< For each glyph, the position. - Vector mLines; ///< The laid out lines. - - Vector4 mTextColor; ///< The text color - Vector4 mShadowColor; ///< Color of drop shadow - Vector4 mUnderlineColor; ///< Color of underline - Vector2 mShadowOffset; ///< Offset for drop shadow, 0 indicates no shadow - float mUnderlineHeight; ///< Fixed height for underline to override font metrics. - - + Vector mGlyphs; ///< For each glyph, the font's id, glyph's index within the font and glyph's metrics. + Vector mGlyphsToCharacters; ///< For each glyph, the index of the first character. + Vector mCharactersToGlyph; ///< For each character, the index of the first glyph. + Vector mCharactersPerGlyph; ///< For each glyph, the number of characters that form the glyph. + Vector mGlyphsPerCharacter; ///< For each character, the number of glyphs that are shaped. + Vector mGlyphPositions; ///< For each glyph, the position. + Vector mLines; ///< The laid out lines. + Vector mUnderlineRuns; ///< Runs of glyphs that are underlined. + Vector mColors; ///< Colors of the glyphs. + Vector mColorIndices; ///< Indices to the vector of colors for each glyphs. + Vector mBackgroundColors; ///< Background colors of the glyphs. + Vector 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 + 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 mShadowBlurRadius; ///< Blur radius of shadow, 0 indicates no blur. + uint16_t mOutlineWidth; ///< Width of outline. 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 mNaturalSize; ///< Size of the text with no line wrapping. + 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. -public: - - bool mUnderlineEnabled:1; ///< Underline enabled flag - bool mUnderlineColorSet:1; ///< Has the underline color been explicitly set? + DevelText::EllipsisPosition::Type mEllipsisPosition; ///< Where is the location the text elide + GlyphIndex mStartIndexOfElidedGlyphs; ///< The start index of elided glyphs. + GlyphIndex mEndIndexOfElidedGlyphs; ///< The end index of elided glyphs. + GlyphIndex mFirstMiddleIndexOfElidedGlyphs; ///< The first end index of elided glyphs, index before ellipsis of middle. + GlyphIndex mSecondMiddleIndexOfElidedGlyphs; ///< The first end index of elided glyphs, index of ellipsis of middle. + bool mTextElideEnabled : 1; ///< Whether the text's elide is enabled. +public: + bool mUnderlineEnabled : 1; ///< Underline enabled flag + bool mUnderlineColorSet : 1; ///< Has the underline color been explicitly set? + bool mBackgroundEnabled : 1; ///< Background enabled flag + bool mMarkupProcessorEnabled : 1; ///< Markup-processor enabled flag + HyphenInfo mHyphen; ///< Contains hyphen glyph info & the character index to draw hyphen after. }; } // namespace Text @@ -550,4 +531,4 @@ public: } // namespace Dali -#endif // __DALI_TOOLKIT_TEXT_VISUAL_MODEL_IMPL_H__ +#endif // DALI_TOOLKIT_TEXT_VISUAL_MODEL_IMPL_H