X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Ftext-controller.cpp;h=f1bb9939300ac2be60639298e9931cf9207530fd;hb=6c530aadfb2cc0086d73a937d926846db5754e90;hp=24dd89c78f41fd155cb64d0eabca88a1c39261c6;hpb=eadad64e7aac34fca21556027feb9d8a6c3d0264;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/text/text-controller.cpp b/dali-toolkit/internal/text/text-controller.cpp index 24dd89c..f1bb993 100644 --- a/dali-toolkit/internal/text/text-controller.cpp +++ b/dali-toolkit/internal/text/text-controller.cpp @@ -1371,16 +1371,17 @@ Vector3 Controller::GetNaturalSize() BIDI_INFO | SHAPE_TEXT | GET_GLYPH_METRICS ); + + // Set the update info to relayout the whole text. + mImpl->mTextUpdateInfo.mParagraphCharacterIndex = 0u; + mImpl->mTextUpdateInfo.mRequestedNumberOfCharacters = mImpl->mLogicalModel->mText.Count(); + // Make sure the model is up-to-date before layouting mImpl->UpdateModel( onlyOnceOperations ); // Layout the text for the new width. mImpl->mOperationsPending = static_cast( mImpl->mOperationsPending | LAYOUT ); - // Set the update info to relayout the whole text. - mImpl->mTextUpdateInfo.mParagraphCharacterIndex = 0u; - mImpl->mTextUpdateInfo.mRequestedNumberOfCharacters = mImpl->mLogicalModel->mText.Count(); - // Store the actual control's size to restore later. const Size actualControlSize = mImpl->mVisualModel->mControlSize; @@ -1443,6 +1444,11 @@ float Controller::GetHeightForWidth( float width ) BIDI_INFO | SHAPE_TEXT | GET_GLYPH_METRICS ); + + // Set the update info to relayout the whole text. + mImpl->mTextUpdateInfo.mParagraphCharacterIndex = 0u; + mImpl->mTextUpdateInfo.mRequestedNumberOfCharacters = mImpl->mLogicalModel->mText.Count(); + // Make sure the model is up-to-date before layouting mImpl->UpdateModel( onlyOnceOperations ); @@ -1450,10 +1456,6 @@ float Controller::GetHeightForWidth( float width ) // Layout the text for the new width. mImpl->mOperationsPending = static_cast( mImpl->mOperationsPending | LAYOUT ); - // Set the update info to relayout the whole text. - mImpl->mTextUpdateInfo.mParagraphCharacterIndex = 0u; - mImpl->mTextUpdateInfo.mRequestedNumberOfCharacters = mImpl->mLogicalModel->mText.Count(); - // Store the actual control's width. const float actualControlWidth = mImpl->mVisualModel->mControlSize.width; @@ -1530,6 +1532,9 @@ Controller::UpdateTextType Controller::Relayout( const Size& size ) // Set the update info to relayout the whole text. mImpl->mTextUpdateInfo.mFullRelayoutNeeded = true; mImpl->mTextUpdateInfo.mCharacterIndex = 0u; + + // Store the size used to layout the text. + mImpl->mVisualModel->mControlSize = size; } // Whether there are modify events. @@ -2458,7 +2463,8 @@ bool Controller::RemoveText( int cursorOffset, numberOfCharacters = currentText.Count() - cursorIndex; } - if( ( cursorIndex + numberOfCharacters ) <= mImpl->mTextUpdateInfo.mPreviousNumberOfCharacters ) + if( mImpl->mEventData->mPreEditFlag || // If the preedit flag is enabled, it means two (or more) of them came together i.e. when two keys have been pressed at the same time. + ( ( cursorIndex + numberOfCharacters ) <= mImpl->mTextUpdateInfo.mPreviousNumberOfCharacters ) ) { // Mark the paragraphs to be updated. mImpl->mTextUpdateInfo.mCharacterIndex = std::min( cursorIndex, mImpl->mTextUpdateInfo.mCharacterIndex ); @@ -2679,9 +2685,6 @@ bool Controller::DoRelayout( const Size& size, mImpl->mVisualModel->SetLayoutSize( layoutSize ); } } // view updated - - // Store the size used to layout the text. - mImpl->mVisualModel->mControlSize = size; } if( NO_OPERATION != ( ALIGN & operations ) ) @@ -2689,10 +2692,13 @@ bool Controller::DoRelayout( const Size& size, // The laid-out lines. Vector& lines = mImpl->mVisualModel->mLines; + // Need to align with the control's size as the text may contain lines + // starting either with left to right text or right to left. mImpl->mLayoutEngine.Align( size, startIndex, requestedNumberOfCharacters, - lines ); + lines, + mImpl->mAlignmentOffset ); viewUpdated = true; }