// INTERNAL INCLUDES
#include <dali/public-api/actors/renderable-actor.h>
-#include <dali-toolkit/public-api/markup-processor/markup-processor.h>
+#include <dali/public-api/text/text.h>
namespace Dali
{
+class TextStyle;
+
namespace Toolkit
{
namespace Internal
{
+namespace TextProcessor
+{
+// Forward declarations.
+struct BidirectionalParagraphInfo;
+struct BidirectionalLineInfo;
+} // namespace TextProcessor
+
namespace TextViewProcessor
{
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.
};
/**
Vector3 mPosition; ///< Position within the text-view
Vector2 mOffset; ///< Alignment and justification offset.
- 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.
- GradientInfo* mGradientInfo; ///< Stores gradient info.
+ 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.
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<WordLayoutInfo> 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<TextStyle*> 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
/**
* Default destructor.
*
- * Clears all words.
+ * Clears all words, deletes all text styles, the paragraph bidirectional info and all bidirectional infor for each line.
*/
~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<TextStyle*> 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<TextProcessor::BidirectionalLineInfo*> mBidirectionalLinesInfo; ///< Contains bidirectional info for each laid-out line.
};
typedef std::vector<ParagraphLayoutInfo> ParagraphLayoutInfoContainer;
TextLayoutInfo();
/**
+ * Defualt destructor.
+ *
+ * Clears the paragraph vector, the ellipsis text and deletes all ellipsis styles.
+ */
+ ~TextLayoutInfo();
+
+ /**
* Copy constructor.
*/
TextLayoutInfo( const TextLayoutInfo& text );
*/
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<TextStyle*> mEllipsisTextStyles; ///< Stores the style per each character of the ellipsis text.
};
} // namespace TextViewProcessor