( relayoutParameters.mIsFirstCharacterOfWord && ( wordOffset + relayoutParameters.mWordSize.width > relayoutData.mTextViewSize.width ) ) )
{
if( !relayoutParameters.mIsNewLine &&
- ( relayoutParameters.mIsWhiteSpace || relayoutParameters.mIsNewLineCharacter ) )
+ ( relayoutParameters.mIsWhiteSpace || relayoutParameters.mIsNewParagraphCharacter ) )
{
// Current character is a white space. Don't want to move a white space to the next line.
// These white spaces are placed just in the edge.
}
else
{
- // Calculates the length of the portion of the line which doesn't exceed the text-view's width and the max character height for the current line.
- TextViewRelayout::SubLineLayoutInfo subLineInfo;
+ // Calculates the length of the portion of the paragraph which doesn't exceed the text-view's width and the max character height for the current line.
+ TextViewRelayout::LineLayoutInfo subLineInfo;
subLineInfo.mLineLength = 0.f;
subLineInfo.mMaxCharHeight = 0.f;
subLineInfo.mMaxAscender = 0.f;
- const TextViewProcessor::LineLayoutInfo& lineLayoutInfo( *( relayoutData.mTextLayoutInfo.mLinesLayoutInfo.begin() + relayoutParameters.mIndices.mLineIndex ) );
+ const TextViewProcessor::ParagraphLayoutInfo& paragraphLayoutInfo( *( relayoutData.mTextLayoutInfo.mParagraphsLayoutInfo.begin() + relayoutParameters.mIndices.mParagraphIndex ) );
- TextViewRelayout::CalculateSubLineLayout( relayoutData.mTextViewSize.width,
- relayoutParameters.mIndices,
- lineLayoutInfo,
- TextViewRelayout::WrapByWord,
- 1.f, // Shrink factor
- subLineInfo );
+ TextViewRelayout::CalculateLineLayout( relayoutData.mTextViewSize.width,
+ relayoutParameters.mIndices,
+ paragraphLayoutInfo,
+ TextViewRelayout::WrapByWord,
+ 1.f, // Shrink factor
+ subLineInfo );
if( subLineInfo.mLineLength < Math::MACHINE_EPSILON_1000 )
{
// It may mean there is a word which is actually longer than the width of the text-view.
// In that case the length of this word is needed.
- if( !lineLayoutInfo.mWordsLayoutInfo.empty() )
+ if( !paragraphLayoutInfo.mWordsLayoutInfo.empty() )
{
- const TextViewProcessor::WordLayoutInfo& wordLayoutInfo( *( lineLayoutInfo.mWordsLayoutInfo.begin() + relayoutParameters.mIndices.mWordIndex ) );
+ const TextViewProcessor::WordLayoutInfo& wordLayoutInfo( *( paragraphLayoutInfo.mWordsLayoutInfo.begin() + relayoutParameters.mIndices.mWordIndex ) );
subLineInfo.mLineLength = wordLayoutInfo.mSize.width;
}
}
- // Stores some info to calculate the line justification in a post-process.
- TextView::LineJustificationInfo justificationInfo;
-
- justificationInfo.mIndices = relayoutParameters.mIndices;
- justificationInfo.mLineLength = subLineInfo.mLineLength;
-
- relayoutData.mLineJustificationInfo.push_back( justificationInfo );
-
Toolkit::TextView::LineLayoutInfo lineInfo;
lineInfo.mCharacterGlobalIndex = relayoutParameters.mCharacterGlobalIndex; // Index to the first character of the next line.
- lineInfo.mSize = Size( subLineInfo.mLineLength, subLineInfo.mMaxCharHeight ); // Size of this piece of line.
- lineInfo.mAscender = subLineInfo.mMaxAscender; // Ascender of this piece of line.
+ lineInfo.mSize = Size( subLineInfo.mLineLength, subLineInfo.mMaxCharHeight ); // Size of this piece of paragraph.
+ lineInfo.mAscender = subLineInfo.mMaxAscender; // Ascender of this piece of paragraph.
relayoutData.mLines.push_back( lineInfo );
return Vector3( 0.f, previousPositionY + subLineInfo.mMaxCharHeight + layoutParameters.mLineHeightOffset, 0.f );
( wordOffset + relayoutParameters.mCharacterSize.width > relayoutData.mTextViewSize.width ) )
{
if( !relayoutParameters.mIsNewLine &&
- ( relayoutParameters.mIsWhiteSpace || relayoutParameters.mIsNewLineCharacter ) )
+ ( relayoutParameters.mIsWhiteSpace || relayoutParameters.mIsNewParagraphCharacter ) )
{
// Current character is a white space. Don't want to move a white space to the next line.
// These white spaces are placed just in the edge.
else
{
// Calculates the line length and the max character height for the current line.
- TextViewRelayout::SubLineLayoutInfo subLineInfo;
+ TextViewRelayout::LineLayoutInfo subLineInfo;
subLineInfo.mLineLength = 0.f;
subLineInfo.mMaxCharHeight = 0.f;
subLineInfo.mMaxAscender = 0.f;
- const TextViewProcessor::LineLayoutInfo& lineLayoutInfo( *( relayoutData.mTextLayoutInfo.mLinesLayoutInfo.begin() + relayoutParameters.mIndices.mLineIndex ) );
-
- TextViewRelayout::CalculateSubLineLayout( relayoutData.mTextViewSize.width,
- relayoutParameters.mIndices,
- lineLayoutInfo,
- TextViewRelayout::WrapByWordAndSplit,
- 1.f, // Shrink factor.
- subLineInfo );
+ const TextViewProcessor::ParagraphLayoutInfo& paragraphLayoutInfo( *( relayoutData.mTextLayoutInfo.mParagraphsLayoutInfo.begin() + relayoutParameters.mIndices.mParagraphIndex ) );
- // Stores some info to calculate the line justification in a post-process.
- TextView::LineJustificationInfo justificationInfo;
-
- justificationInfo.mIndices = relayoutParameters.mIndices;
- justificationInfo.mLineLength = subLineInfo.mLineLength;
-
- relayoutData.mLineJustificationInfo.push_back( justificationInfo );
+ TextViewRelayout::CalculateLineLayout( relayoutData.mTextViewSize.width,
+ relayoutParameters.mIndices,
+ paragraphLayoutInfo,
+ TextViewRelayout::WrapByWordAndSplit,
+ 1.f, // Shrink factor.
+ subLineInfo );
Toolkit::TextView::LineLayoutInfo lineInfo;
lineInfo.mCharacterGlobalIndex = relayoutParameters.mCharacterGlobalIndex; // Index to the first character of the next line.
- lineInfo.mSize = Size( subLineInfo.mLineLength, subLineInfo.mMaxCharHeight ); // Size of this piece of line.
- lineInfo.mAscender = subLineInfo.mMaxAscender; // Ascender of this piece of line.
+ lineInfo.mSize = Size( subLineInfo.mLineLength, subLineInfo.mMaxCharHeight ); // Size of this piece of paragraph.
+ lineInfo.mAscender = subLineInfo.mMaxAscender; // Ascender of this piece of paragraph.
relayoutData.mLines.push_back( lineInfo );
return Vector3( 0.f, previousPositionY + subLineInfo.mMaxCharHeight + layoutParameters.mLineHeightOffset, 0.f );
( relayoutParameters.mIsFirstCharacterOfWord && ( wordOffset + wordSize.width > relayoutData.mTextViewSize.width ) ) ) // The word doesn't fit in the parent width.
{
if( !relayoutParameters.mIsNewLine &&
- ( relayoutParameters.mIsWhiteSpace || relayoutParameters.mIsNewLineCharacter ) )
+ ( relayoutParameters.mIsWhiteSpace || relayoutParameters.mIsNewParagraphCharacter ) )
{
// Current character is a white space. Don't want to move a white space to the next line.
// These white spaces are placed just in the edge.
else
{
// Calculates the line length and the max character height for the current line.
- TextViewRelayout::SubLineLayoutInfo subLineInfo;
+ TextViewRelayout::LineLayoutInfo subLineInfo;
subLineInfo.mLineLength = 0.f;
subLineInfo.mMaxCharHeight = 0.f;
subLineInfo.mMaxAscender = 0.f;
- const TextViewProcessor::LineLayoutInfo& lineLayoutInfo( *( relayoutData.mTextLayoutInfo.mLinesLayoutInfo.begin() + relayoutParameters.mIndices.mLineIndex ) );
-
- TextViewRelayout::CalculateSubLineLayout( relayoutData.mTextViewSize.width,
- relayoutParameters.mIndices,
- lineLayoutInfo,
- TextViewRelayout::WrapByWord,
- relayoutData.mShrinkFactor,
- subLineInfo );
+ const TextViewProcessor::ParagraphLayoutInfo& paragraphLayoutInfo( *( relayoutData.mTextLayoutInfo.mParagraphsLayoutInfo.begin() + relayoutParameters.mIndices.mParagraphIndex ) );
- // Stores some info to calculate the line justification in a post-process.
- TextView::LineJustificationInfo justificationInfo;
-
- justificationInfo.mIndices = relayoutParameters.mIndices;
- justificationInfo.mLineLength = subLineInfo.mLineLength;
-
- relayoutData.mLineJustificationInfo.push_back( justificationInfo );
+ TextViewRelayout::CalculateLineLayout( relayoutData.mTextViewSize.width,
+ relayoutParameters.mIndices,
+ paragraphLayoutInfo,
+ TextViewRelayout::WrapByWord,
+ relayoutData.mShrinkFactor,
+ subLineInfo );
Toolkit::TextView::LineLayoutInfo lineInfo;
lineInfo.mCharacterGlobalIndex = relayoutParameters.mCharacterGlobalIndex; // Index to the first character of the next line.
- lineInfo.mSize = Size( subLineInfo.mLineLength, subLineInfo.mMaxCharHeight ); // Size of this piece of line.
- lineInfo.mAscender = subLineInfo.mMaxAscender; // Ascender of this piece of line.
+ lineInfo.mSize = Size( subLineInfo.mLineLength, subLineInfo.mMaxCharHeight ); // Size of this piece of paragraph.
+ lineInfo.mAscender = subLineInfo.mMaxAscender; // Ascender of this piece of paragraph.
relayoutData.mLines.push_back( lineInfo );
return Vector3( 0.f, previousPositionY + subLineInfo.mMaxCharHeight + layoutParameters.mLineHeightOffset * relayoutData.mShrinkFactor, 0.f );
const float parentWidth = relayoutData.mTextViewSize.width;
TextViewProcessor::TextLayoutInfo& textLayoutInfo = relayoutData.mTextLayoutInfo;
- relayoutData.mLineJustificationInfo.clear();
-
// Reset the text height. This value is returned in order to shrink further or not the text.
newTextHeight = 0.f;
// Stores the position of the previous character.
Vector3 previousPosition;
- // Reset the index of lines.
+ // Reset the index of paragraphs.
TextViewProcessor::TextInfoIndices indices;
- // Whether the last character of the whole text is a new line char.
+ // Whether the last character of the whole text is a new paragraph char.
// This information is used to increase or not the height of the whole text by one line.
// Increase the whole text's height by one line is useful i.e. in TextInput to place the cursor
- // after pressing 'Enter' in the last line.
- bool isLastCharacterNewLineChar = false;
+ // after pressing 'Enter' in the last paragraph.
+ bool isLastCharacterNewParagraphChar = false;
// Stores the height of the last character. This height used to be added to the whole text height if
- // isLastCharacterNewLineChar is true.
+ // isLastCharacterNewParagraphChar is true.
float lastCharHeight = 0.f;
relayoutData.mLines.clear();
std::size_t characterGlobalIndex = 0u;
- for( TextViewProcessor::LineLayoutInfoContainer::iterator lineIt = textLayoutInfo.mLinesLayoutInfo.begin(), lineEndIt = textLayoutInfo.mLinesLayoutInfo.end();
- lineIt != lineEndIt;
- ++lineIt, ++indices.mLineIndex )
+ for( TextViewProcessor::ParagraphLayoutInfoContainer::iterator paragraphIt = textLayoutInfo.mParagraphsLayoutInfo.begin(), paragraphEndIt = textLayoutInfo.mParagraphsLayoutInfo.end();
+ paragraphIt != paragraphEndIt;
+ ++paragraphIt, ++indices.mParagraphIndex )
{
- TextViewProcessor::LineLayoutInfo& lineLayoutInfo( *lineIt );
+ TextViewProcessor::ParagraphLayoutInfo& paragraphLayoutInfo( *paragraphIt );
// The next character is in a new line.
bool isNewLine = true;
// Reset the index of words.
indices.mWordIndex = 0u;
- for( TextViewProcessor::WordLayoutInfoContainer::iterator wordIt = lineLayoutInfo.mWordsLayoutInfo.begin(), wordEndIt = lineLayoutInfo.mWordsLayoutInfo.end();
+ for( TextViewProcessor::WordLayoutInfoContainer::iterator wordIt = paragraphLayoutInfo.mWordsLayoutInfo.begin(), wordEndIt = paragraphLayoutInfo.mWordsLayoutInfo.end();
wordIt != wordEndIt;
++wordIt, ++indices.mWordIndex )
{
bool isFirstCharOfWord = true;
const float wordOffset = previousPosition.x + previousSize.width;
- isLastCharacterNewLineChar = ( TextViewProcessor::LineSeparator == wordLayoutInfo.mType );
+ isLastCharacterNewParagraphChar = ( TextViewProcessor::ParagraphSeparator == wordLayoutInfo.mType );
for( TextViewProcessor::CharacterLayoutInfoContainer::iterator charIt = wordLayoutInfo.mCharactersLayoutInfo.begin(), charEndIt = wordLayoutInfo.mCharactersLayoutInfo.end();
charIt != charEndIt;
isFirstChar = false;
// Calculates the line length and the max character height for the current line.
- TextViewRelayout::SubLineLayoutInfo subLineInfo;
+ TextViewRelayout::LineLayoutInfo subLineInfo;
subLineInfo.mLineLength = 0.f;
subLineInfo.mMaxCharHeight = 0.f;
subLineInfo.mMaxAscender = 0.f;
- TextViewRelayout::CalculateSubLineLayout( parentWidth,
- indices,
- lineLayoutInfo,
- TextViewRelayout::WrapByWord,
- shrinkFactor,
- subLineInfo );
+ TextViewRelayout::CalculateLineLayout( parentWidth,
+ indices,
+ paragraphLayoutInfo,
+ TextViewRelayout::WrapByWord,
+ shrinkFactor,
+ subLineInfo );
characterLayoutInfo.mPosition = Vector3( 0.f, previousPositionY + subLineInfo.mMaxCharHeight + layoutParameters.mLineHeightOffset * shrinkFactor, 0.f );
Toolkit::TextView::LineLayoutInfo lineInfo;
lineInfo.mCharacterGlobalIndex = characterGlobalIndex; // Index to the first character of the next line.
- lineInfo.mSize = Size( subLineInfo.mLineLength, subLineInfo.mMaxCharHeight ); // Size of this piece of line.
- lineInfo.mAscender = subLineInfo.mMaxAscender; // Ascender of this piece of line.
+ lineInfo.mSize = Size( subLineInfo.mLineLength, subLineInfo.mMaxCharHeight ); // Size of this piece of paragraph.
+ lineInfo.mAscender = subLineInfo.mMaxAscender; // Ascender of this piece of paragraph.
relayoutData.mLines.push_back( lineInfo );
-
- // Stores some info to calculate the line justification in a post-process.
- TextView::LineJustificationInfo justificationInfo;
-
- justificationInfo.mIndices = indices;
- justificationInfo.mLineLength = subLineInfo.mLineLength;
-
- relayoutData.mLineJustificationInfo.push_back( justificationInfo );
}
else
{
}
}
- if( isLastCharacterNewLineChar )
+ if( isLastCharacterNewParagraphChar )
{
newTextHeight += lastCharHeight + layoutParameters.mLineHeightOffset * shrinkFactor;
}
relayoutParameters.mPositionOffset = Vector3::ZERO;
relayoutParameters.mIsFirstCharacter = true;
- relayoutParameters.mIndices.mLineIndex = 0u;
+ relayoutParameters.mIndices.mParagraphIndex = 0u;
relayoutParameters.mCharacterGlobalIndex = 0u;
- for( TextViewProcessor::LineLayoutInfoContainer::iterator lineLayoutIt = relayoutData.mTextLayoutInfo.mLinesLayoutInfo.begin(),
- endLineLayoutIt = relayoutData.mTextLayoutInfo.mLinesLayoutInfo.end();
- lineLayoutIt != endLineLayoutIt;
- ++lineLayoutIt, ++relayoutParameters.mIndices.mLineIndex )
+ for( TextViewProcessor::ParagraphLayoutInfoContainer::iterator paragraphLayoutIt = relayoutData.mTextLayoutInfo.mParagraphsLayoutInfo.begin(),
+ endParagraphLayoutIt = relayoutData.mTextLayoutInfo.mParagraphsLayoutInfo.end();
+ paragraphLayoutIt != endParagraphLayoutIt;
+ ++paragraphLayoutIt, ++relayoutParameters.mIndices.mParagraphIndex )
{
- TextViewProcessor::LineLayoutInfo& lineLayoutInfo( *lineLayoutIt );
+ TextViewProcessor::ParagraphLayoutInfo& paragraphLayoutInfo( *paragraphLayoutIt );
relayoutParameters.mIsNewLine = true;
- relayoutParameters.mLineSize = lineLayoutInfo.mSize;
+ relayoutParameters.mParagraphSize = paragraphLayoutInfo.mSize;
relayoutParameters.mIndices.mWordIndex = 0u;
- for( TextViewProcessor::WordLayoutInfoContainer::iterator wordLayoutIt = lineLayoutInfo.mWordsLayoutInfo.begin(),
- endWordLayoutIt = lineLayoutInfo.mWordsLayoutInfo.end();
+ for( TextViewProcessor::WordLayoutInfoContainer::iterator wordLayoutIt = paragraphLayoutInfo.mWordsLayoutInfo.begin(),
+ endWordLayoutIt = paragraphLayoutInfo.mWordsLayoutInfo.end();
wordLayoutIt != endWordLayoutIt;
++wordLayoutIt, ++relayoutParameters.mIndices.mWordIndex )
{
TextViewProcessor::WordLayoutInfo& wordLayoutInfo( *wordLayoutIt );
relayoutParameters.mIsWhiteSpace = TextViewProcessor::WordSeparator == wordLayoutInfo.mType;
- relayoutParameters.mIsNewLineCharacter = TextViewProcessor::LineSeparator == wordLayoutInfo.mType;
+ relayoutParameters.mIsNewParagraphCharacter = TextViewProcessor::ParagraphSeparator == wordLayoutInfo.mType;
relayoutParameters.mIsFirstCharacterOfWord = true;
relayoutParameters.mWordSize = wordLayoutInfo.mSize;
relayoutParameters.mIsNewLine = false;
} // end characters
} // end words
- } // end lines
+ } // end paragraphs
if( relayoutData.mCharacterLayoutInfoTable.empty() )
{
relayoutData.mTextSizeForRelayoutOption.height = minMaxXY.w - minMaxXY.y;
}
- // Check if the last character is a new line character. In that case the height should be added.
- if( !relayoutData.mTextLayoutInfo.mLinesLayoutInfo.empty() )
+ // Check if the last character is a new paragraph character. In that case the height should be added.
+ if( !relayoutData.mTextLayoutInfo.mParagraphsLayoutInfo.empty() )
{
- const TextViewProcessor::LineLayoutInfo& lineLayoutInfo( *( relayoutData.mTextLayoutInfo.mLinesLayoutInfo.end() - 1u ) );
+ const TextViewProcessor::ParagraphLayoutInfo& paragraphLayoutInfo( *( relayoutData.mTextLayoutInfo.mParagraphsLayoutInfo.end() - 1u ) );
- if( lineLayoutInfo.mWordsLayoutInfo.empty() ) // if it's empty, it means the last character is a new line character.
+ if( paragraphLayoutInfo.mWordsLayoutInfo.empty() ) // if it's empty, it means the last character is a new paragraph character.
{
- relayoutData.mTextSizeForRelayoutOption.height += lineLayoutInfo.mSize.height * relayoutData.mShrinkFactor;
+ relayoutData.mTextSizeForRelayoutOption.height += paragraphLayoutInfo.mSize.height * relayoutData.mShrinkFactor;
}
}
}
{
if( relayoutOperationMask & TextView::RELAYOUT_SIZE_POSITION )
{
- relayoutData.mLineJustificationInfo.clear();
CalculateSizeAndPosition( layoutParameters,
relayoutData );
+ TextViewRelayout::ReorderRightToLeftLayout( relayoutData );
+
TextViewRelayout::SetUnderlineInfo( relayoutData );
}