TextFit : modified it work even if you change the size 34/222234/1
authorJoogab Yun <joogab.yun@samsung.com>
Sat, 11 Jan 2020 22:37:02 +0000 (07:37 +0900)
committerJoogab Yun <joogab.yun@samsung.com>
Sat, 11 Jan 2020 22:37:02 +0000 (07:37 +0900)
 // text fit test
   Property::Map backgroundMap;
   backgroundMap["color"] = Color::RED;
   backgroundMap["enable"] = true;

   Property::Map textFitMap;
   textFitMap["enable"] = true;
   textFitMap["minSize"] = 10.f;
   textFitMap["maxSize"] = 60.f;
   textFitMap["stepSize"] = 4.f;
   textFitMap["fontSizeType"] = "pointSize";

   width = 700;
   height = 100;
   textFit = TextLabel::New(  "Long enough message for TextLabel!! This is a Text Fit sample text " );
   textFit.SetSize( width, height );
   textFit.SetParentOrigin(ParentOrigin::TOP_LEFT);
   textFit.SetAnchorPoint(AnchorPoint::TOP_LEFT);
   textFit.SetPosition( 100.f, 300.f);
   textFit.SetProperty( Toolkit::DevelTextLabel::Property::TEXT_FIT, textFitMap );
   textFit.SetProperty( Toolkit::DevelTextLabel::Property::BACKGROUND, backgroundMap );
   stage.Add( textFit );

   stage.KeyEventSignal().Connect( this, &HelloWorldController::OnKeyEvent );
  }

  void OnKeyEvent( const KeyEvent& event )
  {
    if( event.state == KeyEvent::Down )
    {
      width -= 40;
      textFit.SetSize( width, height );
    }
  }

Change-Id: Ie7f3cd5cc5e0fa581f8e4912ccb5e88049499f31

dali-toolkit/internal/text/text-controller.cpp

index 9d56a0e..0b0e9cf 100755 (executable)
@@ -2143,7 +2143,7 @@ bool Controller::CheckForTextFit( float pointSize, Size& layoutSize )
 void Controller::FitPointSizeforLayout( Size layoutSize )
 {
   const OperationsMask operations  = mImpl->mOperationsPending;
-  if( NO_OPERATION != ( UPDATE_LAYOUT_SIZE & operations ) )
+  if( NO_OPERATION != ( UPDATE_LAYOUT_SIZE & operations ) || mImpl->mTextFitContentSize != layoutSize )
   {
     bool actualellipsis = mImpl->mModel->mElideEnabled;
     float minPointSize = mImpl->mTextFitMinSize;