X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=base%2Fdali-toolkit%2Finternal%2Fcontrols%2Ftext-view%2Ftext-view-processor-types.h;h=15005cce26bdb9e9944407f4f436e7e076510764;hp=71fd21433c7197be883bcee66f7a671244dcc139;hb=refs%2Ftags%2Fsubmit%2Ftizen_mobile%2F20141120.000000;hpb=1bb77b62e55761f55511fedac0f831deff677782 diff --git a/base/dali-toolkit/internal/controls/text-view/text-view-processor-types.h b/base/dali-toolkit/internal/controls/text-view/text-view-processor-types.h index 71fd214..15005cc 100644 --- a/base/dali-toolkit/internal/controls/text-view/text-view-processor-types.h +++ b/base/dali-toolkit/internal/controls/text-view/text-view-processor-types.h @@ -20,17 +20,26 @@ // INTERNAL INCLUDES #include -#include +#include namespace Dali { +class TextStyle; + namespace Toolkit { namespace Internal { +namespace TextProcessor +{ +// Forward declarations. +struct BidirectionalParagraphInfo; +struct BidirectionalLineInfo; +} // namespace TextProcessor + namespace TextViewProcessor { @@ -84,6 +93,41 @@ struct TextInfoIndices std::size_t mParagraphIndex; ///< The paragraph index within the text. std::size_t mWordIndex; ///< The word index within the paragraph. std::size_t mCharacterIndex; ///< The character index within the word. + std::size_t mCharacterParagraphIndex; ///< The character index within the paragraph. +}; + +/** + * Stores gradient info. + * + * Used to fade in/out text-actors. + */ +struct GradientInfo +{ + /** + * Default constructor. + * + * Initializes all members to their default values. + */ + GradientInfo(); + + /** + * Default destructor. + */ + ~GradientInfo(); + + /** + * Copy constructor + */ + GradientInfo( const GradientInfo& info ); + + /** + * Assignment operator. + */ + GradientInfo& operator=( const GradientInfo& info ); + + Vector4 mGradientColor; ///< Gradient color. + Vector2 mStartPoint; ///< Gradient start point. + Vector2 mEndPoint; ///< Gradient end point. }; /** @@ -116,30 +160,25 @@ struct CharacterLayoutInfo */ CharacterLayoutInfo& operator=( const CharacterLayoutInfo& character ); - // Natural size (metrics) of the glyph. - float mHeight; ///< Natural height of the character. - float mAdvance; ///< Natural horizontal distance from origin of current character and the next one. - float mBearing; ///< Natural vertical distance from the baseline to the top of the glyph's bbox. - - // Size of the text-actor (may be modified by a scale factor). - Vector3 mPosition; ///< Position within the text-view - Vector2 mOffset; ///< Alignment and justification offset. - Size mSize; ///< Size of this character. + // Metrics of the glyph. + Size mSize; ///< Height of the font and advance (the horizontal distance from the origin of the current character and the next one). + float mBearing; ///< Vertical distance from the baseline to the top of the glyph's boundary box. float mAscender; ///< Distance from the base line to the top of the line. float mUnderlineThickness; ///< The underline's thickness. float mUnderlinePosition; ///< The underline's position. - RenderableActor mGlyphActor; ///< Handle to a text-actor. - MarkupProcessor::StyledText mStyledText; ///< Stores the text and its style. - float mColorAlpha; ///< Alpha component for the initial text color when text is faded. - Vector4 mGradientColor; ///< Gradient color. - Vector2 mStartPoint; ///< Gradient start point. - Vector2 mEndPoint; ///< Gradient end point. + // Position and alignment offset. It depends on the lay-out. + Vector3 mPosition; ///< Position within the text-view + Vector2 mOffset; ///< Alignment and justification offset. + + RenderableActor mGlyphActor; ///< Handle to a text-actor. + float mColorAlpha; ///< Alpha component for the initial text color when text is faded. + GradientInfo* mGradientInfo; ///< Stores gradient info. - bool mIsVisible:1; ///< Whether the text-actor is visible. - bool mSetText:1; ///< Whether a new text needs to be set in the text-actor. - bool mSetStyle:1; ///< Whether a new style needs to be set in the text-actor. - bool mIsColorGlyph:1; ///< Whether this character is an emoticon. + bool mIsVisible:1; ///< Whether the text-actor is visible. + bool mSetText:1; ///< Whether a new text needs to be set in the text-actor. + bool mSetStyle:1; ///< Whether a new style needs to be set in the text-actor. + bool mIsColorGlyph:1; ///< Whether this character is an emoticon. }; typedef std::vector CharacterLayoutInfoContainer; @@ -175,11 +214,36 @@ struct WordLayoutInfo Size mSize; ///< Size of the word. float mAscender; ///< Max of all ascenders of all characters. TextSeparatorType mType; ///< Whether this word is a word separator, a line separator or is not a separator. + std::size_t mFirstCharacter; ///< Index to the first character of the word within the paragraph. CharacterLayoutInfoContainer mCharactersLayoutInfo; ///< Layout info for all characters. }; typedef std::vector WordLayoutInfoContainer; /** + * Stores the reordered layout for right to left text. + */ +struct RightToLeftParagraphLayout +{ + RightToLeftParagraphLayout() + : mWordsLayoutInfo(), + mText(), + mTextStyles(), + mPreviousLayoutCleared( false ) + { + } + + WordLayoutInfoContainer mWordsLayoutInfo; ///< Layout info for all words. + Text mText; ///< Stores the text. + Vector mTextStyles; ///< Stores the style per each character. + bool mPreviousLayoutCleared:1; ///< Whether the previous right to left layout has been cleared. + + /** + * Clears the word layout vector, the text and the vector of styles. + */ + void Clear(); +}; + +/** * Layout information for a paragraph. */ struct ParagraphLayoutInfo @@ -194,7 +258,7 @@ struct ParagraphLayoutInfo /** * Default destructor. * - * Clears all words and deletes all text styles. + * Clears all words, deletes all text styles, the paragraph bidirectional info and all bidirectional infor for each line. */ ~ParagraphLayoutInfo(); @@ -208,11 +272,30 @@ struct ParagraphLayoutInfo */ ParagraphLayoutInfo& operator=( const ParagraphLayoutInfo& paragraph ); + /** + * Deletes the bidirectional info for each line. + */ + void ClearBidirectionalInfo(); + +private: + + /** + * Deletes all text styles. + */ + void ClearStyles(); + +public: Size mSize; ///< Size of the paragraph. float mAscender; ///< Max of all ascenders of all words. float mLineHeightOffset; ///< Line height offset. + std::size_t mFirstCharacter; ///< Index to the first character of the paragraph. std::size_t mNumberOfCharacters; ///< Stores the number of characters. WordLayoutInfoContainer mWordsLayoutInfo; ///< Layout info for all words. + Text mText; ///< Stores the text. + Vector mTextStyles; ///< Stores the style per each character. + RightToLeftParagraphLayout* mRightToLeftLayout; ///< Stores the reordered layout for the paragraph. + TextProcessor::BidirectionalParagraphInfo* mBidirectionalParagraphInfo; ///< Contains bidirectional info for the whole paragraph. Set to NULL if the paragraph has left to right characters only. + Vector mBidirectionalLinesInfo; ///< Contains bidirectional info for each laid-out line. }; typedef std::vector ParagraphLayoutInfoContainer; @@ -229,6 +312,13 @@ struct TextLayoutInfo TextLayoutInfo(); /** + * Defualt destructor. + * + * Clears the paragraph vector, the ellipsis text and deletes all ellipsis styles. + */ + ~TextLayoutInfo(); + + /** * Copy constructor. */ TextLayoutInfo( const TextLayoutInfo& text ); @@ -238,12 +328,21 @@ struct TextLayoutInfo */ TextLayoutInfo& operator=( const TextLayoutInfo& text ); +private: + /** + * Deletes all the ellipsis text styles. + */ + void ClearStyles(); + +public: Size mWholeTextSize; ///< width and height of the whole text. float mMaxWordWidth; ///< maximum width between all words. float mMaxItalicsOffset; ///< When rendering text-view in offscreen an extra width offset is needed to prevent italic characters to be cut if they are in the right edge. std::size_t mNumberOfCharacters; ///< Stores the number of characters. ParagraphLayoutInfoContainer mParagraphsLayoutInfo; ///< Layout information for all paragraphs. WordLayoutInfo mEllipsizeLayoutInfo; ///< Layout information for the ellipsize text. + Dali::Text mEllipsisText; ///< The ellipsis text. + Vector mEllipsisTextStyles; ///< Stores the style per each character of the ellipsis text. }; } // namespace TextViewProcessor