X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Fvisual-model-impl.h;h=853e946c786208d690875361012b188aaab936ef;hp=32ab3867c9564b1c498d47f50f4164a7c88a2292;hb=41d36118a13932bcf1db39b780ac437fcda8aa08;hpb=b766a879a8f8b55a7017847894a2f1bc7edd83d8 diff --git a/dali-toolkit/internal/text/visual-model-impl.h b/dali-toolkit/internal/text/visual-model-impl.h old mode 100644 new mode 100755 index 32ab386..853e946 --- 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) 2019 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. @@ -27,6 +27,7 @@ // INTERNAL INCLUDES #include +#include namespace Dali { @@ -65,16 +66,24 @@ public: * * @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. @@ -88,19 +97,6 @@ public: 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 /** @@ -152,6 +148,19 @@ public: */ 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 /** @@ -169,18 +178,18 @@ public: 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 @@ -225,6 +234,20 @@ public: const Vector4& GetShadowColor() const; /** + * @brief Set the shadow blur radius. + * + * @param[in] shadowBlurRadius The shadow blur radius, 0,0 indicates no blur. + */ + void SetShadowBlurRadius( const float& shadowBlurRadius ); + + /** + * @brief Retrieve the shadow blur radius. + * + * @return The shadow blur radius. + */ + const float& GetShadowBlurRadius() const; + + /** * @brief Sets the text's underline color. * * @param[in] color The text's underline color. @@ -271,6 +294,69 @@ public: */ float GetUnderlineHeight() const; + /** + * @brief Retrieves the number of underline runs. + * + * @return The number of underline runs. + */ + Length GetNumberOfUnderlineRuns() const; + + /** + * @brief Set the outline color. + * + * @param[in] color color of outline. + */ + void SetOutlineColor( const Vector4& color ); + + /** + * @brief Retrieve the outline color. + * + * @return The outline color. + */ + const Vector4& GetOutlineColor() const; + + /** + * @brief Set the outline width + * + * @param[in] width The width in pixels of the outline, 0 indicates no outline + */ + void SetOutlineWidth( uint16_t width ); + + /** + * @brief Retrieves the width of an outline + * + * @return The width of the outline. + */ + uint16_t GetOutlineWidth() const; + + /** + * @brief Sets the text's background color. + * + * @param[in] color The text's background color. + */ + void SetBackgroundColor( const Vector4& color ); + + /** + * @brief Retrieves the text's background color. + * + * @return The text's background color. + */ + const Vector4& GetBackgroundColor() const; + + /** + * @brief Sets whether the text has a background or not. + * + * @param[in] enabled true if the text has a background. + */ + void SetBackgroundEnabled( bool enabled ); + + /** + * @brief Returns whether the text has a background or not. + * + * @return whether the text has a background or not. + */ + bool IsBackgroundEnabled() const; + protected: /** @@ -300,18 +386,27 @@ public: 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. - Vector2 mControlSize; ///< The size of the UI control the decorator is adding it's decorations to. 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 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. @@ -320,7 +415,7 @@ public: bool mUnderlineEnabled:1; ///< Underline enabled flag bool mUnderlineColorSet:1; ///< Has the underline color been explicitly set? - + bool mBackgroundEnabled:1; ///< Background enabled flag }; } // namespace Text @@ -329,4 +424,4 @@ public: } // namespace Dali -#endif // __DALI_TOOLKIT_TEXT_VISUAL_MODEL_IMPL_H__ +#endif // DALI_TOOLKIT_TEXT_VISUAL_MODEL_IMPL_H