float lastCharHeight = 0.f;
relayoutData.mLines.clear();
- std::size_t characterGlobalIndex = 0;
+ std::size_t characterGlobalIndex = 0u;
for( TextViewProcessor::LineLayoutInfoContainer::iterator lineIt = textLayoutInfo.mLinesLayoutInfo.begin(), lineEndIt = textLayoutInfo.mLinesLayoutInfo.end();
lineIt != lineEndIt;
// The next character is in a new line.
bool isNewLine = true;
-
// Reset the index of words.
- indices.mWordIndex = 0;
+ indices.mWordIndex = 0u;
for( TextViewProcessor::WordLayoutInfoContainer::iterator wordIt = lineLayoutInfo.mWordsLayoutInfo.begin(), wordEndIt = lineLayoutInfo.mWordsLayoutInfo.end();
wordIt != wordEndIt;
TextViewProcessor::WordLayoutInfo& wordLayoutInfo( *wordIt );
// Reset the index of the character.
- indices.mCharacterIndex = 0;
+ indices.mCharacterIndex = 0u;
// Whether current character is the first of the word.
bool isFirstCharOfWord = true;
lineInfo.mAscender = subLineInfo.mMaxAscender; // Ascender of this piece of line.
relayoutData.mLines.push_back( lineInfo );
-
// Stores some info to calculate the line justification in a post-process.
TextView::LineJustificationInfo justificationInfo;
}
// Get last line info and calculate the bearing.
- const Toolkit::TextView::LineLayoutInfo& lineInfo( *( relayoutData.mLines.end() - 1 ) );
+ const Toolkit::TextView::LineLayoutInfo& lineInfo( *( relayoutData.mLines.end() - 1u ) );
const float bearingOffset = ( ( lineInfo.mSize.height - lineInfo.mAscender ) - ( characterLayoutInfo.mSize.height - characterLayoutInfo.mAscender ) ) * shrinkFactor;
previousSize = characterLayoutInfo.mSize * shrinkFactor;
const float MIN_RATIO( 0.90f ); // The algorithm finishes if the ratio
const float MAX_RATIO( 1.00f ); // new_text_height / text_view_height is between this two values
- const unsigned int MAX_ITERATIONS( 8 ); // or max_iteration is reached.
+ const unsigned int MAX_ITERATIONS( 8u ); // or max_iteration is reached.
float ratio = newTextHeight / textViewSize.height;
float maxScaleFactor = shrinkFactor; // bigger scale factors than maxScaleFactor will produce a too big text.
float minScaleFactor = shrinkFactor * ( textViewSize.height / newTextHeight ); // smaller scale factors than minScaleFactor will produce a too small text.
- for( unsigned int iterations = 0; ( ( MIN_RATIO > ratio ) || ( ratio > MAX_RATIO ) ) && ( iterations < MAX_ITERATIONS ); ++iterations )
+ for( unsigned int iterations = 0u; ( ( MIN_RATIO > ratio ) || ( ratio > MAX_RATIO ) ) && ( iterations < MAX_ITERATIONS ); ++iterations )
{
// Calculates the new scale factor.
// The new scale factor is always between the min and max scale factors.
relayoutData.mShrinkFactor = 1.f; // Shrink factor used when the exceed policy contains ShrinkToFit
- if( TextView::Shrink== layoutParameters.mExceedPolicy )
+ if( TextView::Shrink == layoutParameters.mExceedPolicy )
{
// Relays-out the text for the shrink to fit policy.
relayoutData.mShrinkFactor = RelayoutForShrinkToFit( relayoutData, layoutParameters );
relayoutParameters.mPositionOffset = Vector3::ZERO;
relayoutParameters.mIsFirstCharacter = true;
- relayoutParameters.mIndices.mLineIndex = 0;
- relayoutParameters.mCharacterGlobalIndex = 0;
+ relayoutParameters.mIndices.mLineIndex = 0u;
+ relayoutParameters.mCharacterGlobalIndex = 0u;
for( TextViewProcessor::LineLayoutInfoContainer::iterator lineLayoutIt = relayoutData.mTextLayoutInfo.mLinesLayoutInfo.begin(),
endLineLayoutIt = relayoutData.mTextLayoutInfo.mLinesLayoutInfo.end();
relayoutParameters.mIsNewLine = true;
relayoutParameters.mLineSize = lineLayoutInfo.mSize;
- relayoutParameters.mIndices.mWordIndex = 0;
+ relayoutParameters.mIndices.mWordIndex = 0u;
for( TextViewProcessor::WordLayoutInfoContainer::iterator wordLayoutIt = lineLayoutInfo.mWordsLayoutInfo.begin(),
endWordLayoutIt = lineLayoutInfo.mWordsLayoutInfo.end();
relayoutParameters.mIsFirstCharacterOfWord = true;
relayoutParameters.mWordSize = wordLayoutInfo.mSize;
- relayoutParameters.mIndices.mCharacterIndex = 0;
+ relayoutParameters.mIndices.mCharacterIndex = 0u;
for( TextViewProcessor::CharacterLayoutInfoContainer::iterator characterLayoutIt = wordLayoutInfo.mCharactersLayoutInfo.begin(),
endCharacterLayoutIt = wordLayoutInfo.mCharactersLayoutInfo.end();
// Check if the last character is a new line character. In that case the height should be added.
if( !relayoutData.mTextLayoutInfo.mLinesLayoutInfo.empty() )
{
- const TextViewProcessor::LineLayoutInfo& lineLayoutInfo( *( relayoutData.mTextLayoutInfo.mLinesLayoutInfo.end() - 1 ) );
+ const TextViewProcessor::LineLayoutInfo& lineLayoutInfo( *( relayoutData.mTextLayoutInfo.mLinesLayoutInfo.end() - 1u ) );
if( lineLayoutInfo.mWordsLayoutInfo.empty() ) // if it's empty, it means the last character is a new line character.
{
visualParameters,
relayoutData );
}
-
- if( relayoutOperationMask & TextView::RELAYOUT_INITIALIZE_TEXT_ACTORS )
- {
- TextViewProcessor::InitializeTextActorInfo( relayoutData );
- }
-
- if( relayoutOperationMask & TextView::RELAYOUT_TEXT_ACTOR_UPDATE )
+ const bool initializeTextActors = relayoutOperationMask & TextView::RELAYOUT_INITIALIZE_TEXT_ACTORS;
+ const bool updateTextActors = relayoutOperationMask & TextView::RELAYOUT_TEXT_ACTOR_UPDATE;
+ if( initializeTextActors || updateTextActors )
{
TextViewRelayout::UpdateTextActorInfo( visualParameters,
- relayoutData );
+ relayoutData,
+ initializeTextActors );
}
- if( ( relayoutOperationMask & TextView::RELAYOUT_INSERT_TO_TEXT_VIEW ) ||
- ( relayoutOperationMask & TextView::RELAYOUT_INSERT_TO_TEXT_ACTOR_LIST ) )
+ if( relayoutOperationMask & TextView::RELAYOUT_INSERT_TO_TEXT_VIEW )
{
- TextViewRelayout::InsertToTextView( relayoutOperationMask,
- textView,
+ TextViewRelayout::InsertToTextView( textView,
relayoutData );
}
}