// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/alignment/alignment.h>
#include <dali-toolkit/public-api/controls/text-view/text-view.h>
-
-#include "text-view-impl.h"
-#include "text-view-processor-types.h"
+#include <dali-toolkit/internal/controls/text-view/text-view-impl.h>
namespace Dali
{
extern const float MINIMUM_FADE_BOUNDARY; // When the fade boundary is the same as the text-view boundary, this constant reduces it in order to avoid a zero division.
/**
- * Define the type of line wrap.
+ * Define how to wrap a paragraph in lines.
*/
enum HorizontalWrapType
{
- WrapByCharacter, ///< Wrap a line per character (It may split a word in two).
- WrapByWord, ///< Wrap a line by word.
- WrapByWordAndSplit, ///< Wrap the line by word and split a word if it doesn't fit.
- WrapByLine, ///< Wrap the line when a \n is found.
- WrapByLineAndSplit ///< Wrap the line when a \n is found and split if it doesn't fit.
+ WrapByCharacter, ///< Wrap the paragraph per character (It may split a word in two).
+ WrapByWord, ///< Wrap the paragraph by word.
+ WrapByWordAndSplit, ///< Wrap the paragraph by word and split a word if it doesn't fit.
+ WrapByParagraphCharacter, ///< Wrap the paragraph when a '\n' is found.
+ WrapByParagraphCharacterAndSplit ///< Wrap the paragraph when a '\n' is found and split if it doesn't fit.
};
/**
*/
~RelayoutParameters();
- Vector3 mPositionOffset; ///< Offset (position.x + size.width, position.y, position.z) of the previous text-actor.
- Size mLineSize; ///< Current line's size.
- Size mWordSize; ///< Current word's size.
- Size mCharacterSize; ///< Current character's size.
- TextViewProcessor::TextInfoIndices mIndices; ///< Current indices to line, group of words, word and character.
- std::size_t mCharacterGlobalIndex; ///< Index to a single character within the whole text.
- bool mIsFirstCharacter:1; ///< Whether is the first character of the whole text.
- bool mIsFirstCharacterOfWord:1; ///< Whether is the first character of the word.
- bool mIsNewLine:1; ///< Whether the current character is the first character of a new line.
- bool mIsNewLineCharacter:1; ///< Whether the current character is a new line character.
- bool mIsWhiteSpace:1; ///< Whether the current character is a white space.
- bool mIsVisible:1; ///< Whether the current character is visible.
+ Vector3 mPositionOffset; ///< Offset (position.x + size.width, position.y, position.z) of the previous text-actor.
+ Size mParagraphSize; ///< Current paragraphs's size.
+ Size mWordSize; ///< Current word's size.
+ Size mCharacterSize; ///< Current character's size.
+ TextViewProcessor::TextInfoIndices mIndices; ///< Current indices to paragraph, word and character.
+ std::size_t mCharacterGlobalIndex; ///< Index to a single character within the whole text.
+ bool mIsFirstCharacter:1; ///< Whether is the first character of the whole text.
+ bool mIsFirstCharacterOfWord:1; ///< Whether is the first character of the word.
+ bool mIsNewLine:1; ///< Whether the current character is the first character of a new line.
+ bool mIsNewParagraphCharacter:1; ///< Whether the current character is a new paragraph character.
+ bool mIsWhiteSpace:1; ///< Whether the current character is a white space.
+ bool mIsVisible:1; ///< Whether the current character is visible.
};
/**
Vector3 mPosition; ///< Position of the first character of the ellipsize text.
float mLineDescender; ///< Distance from the base line to the bottom.
- float mLineWidth; ///< Current laid out line's width.
+ float mLineWidth; ///< Current line's width.
Size mEllipsizeBoundary; ///< Where to start to ellipsize a line.
- std::size_t mFirstIndex; ///< Global index within the whole text of the first character of the laid out line.
- std::size_t mLastIndex; ///< Global index within the whole text of the last character of the laid out line.
+ std::size_t mFirstIndex; ///< Global index within the whole text of the first character of the line.
+ std::size_t mLastIndex; ///< Global index within the whole text of the last character of the line.
bool mEllipsizeLine:1; ///< Whether current line must be ellipsized.
bool mIsLineWidthFullyVisible:1; ///< Whether current line fits in text-view's width.
bool mIsLineHeightFullyVisible:1; ///< Whether current line fits in text-view's height.
};
/**
- * Stores underline info for a group of consecutive characters in the same laid out line.
+ * Stores underline info for a group of consecutive characters in the same line.
*/
struct UnderlineInfo
{
std::vector<UnderlineInfo> mUnderlineInfo; ///< Underline info for each group of consecutive underlined characters.
std::size_t mCharacterGlobalIndex; ///< Global index (within the whole text) to current character.
- std::size_t mLineGlobalIndex; ///< Index to current laid out line. It takes into account the current layout configuration (is not the number of \n)
+ std::size_t mLineGlobalIndex; ///< Index to current line. It takes into account the current layout configuration (is not the number of \n)
bool mCurrentUnderlineStatus:1; ///< Whether current character is underlined.
};
/**
- * Stores layout information of the piece of a line.
+ * Stores layout information of a line.
*/
-struct SubLineLayoutInfo
+struct LineLayoutInfo
{
/**
* Default constructor.
*
* Initializes each member to its default.
*/
- SubLineLayoutInfo();
+ LineLayoutInfo();
/**
* Empty destructor.
*
* @note Added to increase coverage.
*/
- ~SubLineLayoutInfo();
+ ~LineLayoutInfo();
- float mLineLength; ///< The length of the portion of the line which fits on the text-view width.
- float mMaxCharHeight; ///< The maximum height of all characters of the portion of line which fits on the text-view width.
- float mMaxAscender; ///< The maximum ascender of all characters of the portion of line which fits on the text-view width.
+ float mLineLength; ///< The length of the portion of the paragraph which fits on the text-view width.
+ float mMaxCharHeight; ///< The maximum height of all characters of the portion of the paragraph which fits on the text-view width.
+ float mMaxAscender; ///< The maximum ascender of all characters of the portion of the paragraph which fits on the text-view width.
};
/**
- * Calculates the layout info of the portion of the line which fits on the text-view width.
+ * Calculates the layout info of the portion of the paragraph which fits on the text-view width.
*
* @param[in] parentWidth Text-view width
- * @param[in] indices Indices to the word group, word and character.
- * @param[in] lineLayoutInfo Layout info for the line.
- * @param[in] splitPolicy Whether a line is wraped by word, by character or by word and character.
+ * @param[in] indices Indices to the word and character.
+ * @param[in] paragraphLayoutInfo Layout info for the paragraph.
+ * @param[in] splitPolicy Whether a paragraph is wraped by word, by character or by word and character.
* @param[in] shrinkFactor Shrink factor used.
- * @param[out] layoutInfo Layout information of the part of the line which fits in the text-view width.
+ * @param[out] layoutInfo Layout information of the part of the paragraph which fits in the text-view width.
*/
-void CalculateSubLineLayout( float parentWidth,
- const TextViewProcessor::TextInfoIndices& indices,
- const TextViewProcessor::LineLayoutInfo& lineLayoutInfo,
- HorizontalWrapType splitPolicy,
- float shrinkFactor,
- SubLineLayoutInfo& layoutInfo );
+void CalculateLineLayout( float parentWidth,
+ const TextViewProcessor::TextInfoIndices& indices,
+ const TextViewProcessor::ParagraphLayoutInfo& paragraphLayoutInfo,
+ HorizontalWrapType splitPolicy,
+ float shrinkFactor,
+ LineLayoutInfo& layoutInfo );
+
+/**
+ * Reorders the text layout of each line of each paragraph of the text.
+ *
+ * @param[in,out] relayoutData The text-view's data structures.
+ */
+void ReorderRightToLeftLayout( TextView::RelayoutData& relayoutData );
/**
* Calculates the \e x offset position for the whole text.
* This table is used to pass the size, the position and other layout info to other controls/actors.
*
* @param[in,out] minMaxXY The boundary box of the whole text.
+ * @param[in,out] wordLayoutInfo Word layout info.
* @param[in,out] characterLayoutInfo Character layout info.
+ * @param[in,out] relayoutParameters Temporary layout parameters.
* @param[in,out] relayoutData The text-view's data structures.
*/
void UpdateLayoutInfoTable( Vector4& minMaxXY,
- TextViewProcessor::WordGroupLayoutInfo& wordGroupLayoutInfo,
TextViewProcessor::WordLayoutInfo& wordLayoutInfo,
- TextViewProcessor::CharacterLayoutInfo& characterGroupLayoutInfo,
+ TextViewProcessor::CharacterLayoutInfo& characterLayoutInfo,
RelayoutParameters& relayoutParameters,
TextView::RelayoutData& relayoutData );
*
* @param[in] layoutParameters The layout parameters.
* @param[in] characterLayoutInfo Character layout info.
+ * @param[in] style The style of the character. Used to get the color (and alpha) of the character.
* @param[in,out] relayoutParameters Temporary layout parameters.
* @param[in,out] fadeParameters Temporary fade parameters.
* @param[in,out] relayoutData The text-view's data structures.
*/
void CalculateVisibilityForFade( const Internal::TextView::LayoutParameters& layoutParameters,
TextViewProcessor::CharacterLayoutInfo& characterLayoutInfo,
+ const TextStyle& style,
RelayoutParameters& relayoutParameters,
FadeParameters& fadeParameters,
TextView::RelayoutData& relayoutData );
TextView::RelayoutData& relayoutData );
/**
+ * Replace the text which exceeds the boundary by the ellipsis text.
*
+ * @param[in] layoutParameters The layout parameters.
+ * @param[in,out] ellipsisParameters Temporary ellipsis parameters.
+ * @param[in,out] relayoutData The text-view's data structures.
*/
void EllipsizeLine( const TextView::LayoutParameters& layoutParameters,
EllipsizeParameters& ellipsizeParameters,
TextView::RelayoutData& relayoutData );
/**
- * Traverse all text updating text-actor handles with new size, position, ...
+ * Traverse all text initializing all non initialized text-actor handles
+ * and updating text-actor handles with new size, position, ...
*
* @param[in] visualParameters Some visual parameters (fade, sort modifier and blending).
* @param[in,out] relayoutData Natural size (metrics), layout, text-actor info.
+ * @param[in] createGlyphActors Whether to create RenderableActor for text-actors or emojis.
*/
void UpdateTextActorInfo( const TextView::VisualParameters& visualParameters,
- TextView::RelayoutData& relayoutData );
+ TextView::RelayoutData& relayoutData,
+ bool createGlyphActors );
/**
* Traverses the whole text and for each piece of underlined text,
const std::vector<RenderableActor>& glyphActors );
/**
- * Inserts the text-actors into the text-view and/or the text-actor's list.
+ * Inserts the text-actors into the text-view and the text-actor's list.
*
- * @param[in] relayoutOperationMask Whether the text-actors should be added into the text-view, the list of text-actors or in both.
* @param[in,out] textView The text-view.
* @param[in,out] relayoutData The text-view's data structures.
*/
-void InsertToTextView( TextView::RelayoutOperationMask relayoutOperationMask,
- Actor textView,
+void InsertToTextView( Actor textView,
TextView::RelayoutData& relayoutData );
/**