Disable pixel alignment while scrolling the text
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / text-effects-style.cpp
index 7c08ebe..d8d35de 100755 (executable)
@@ -125,26 +125,45 @@ bool ParseUnderlineProperties( const Property::Map& underlinePropertiesMap,
     if( ENABLE_KEY == valueGet.first.stringKey )
     {
       /// Enable key.
-      const std::string enableStr = valueGet.second.Get<std::string>();
-      enabled = Text::TokenComparison( TRUE_TOKEN, enableStr.c_str(), enableStr.size() );
+      if( valueGet.second.GetType() == Dali::Property::STRING )
+      {
+        const std::string enableStr = valueGet.second.Get<std::string>();
+        enabled = Text::TokenComparison( TRUE_TOKEN, enableStr.c_str(), enableStr.size() );
+      }
+      else
+      {
+        enabled = valueGet.second.Get<bool>();
+      }
     }
     else if( COLOR_KEY == valueGet.first.stringKey )
     {
       /// Color key.
       colorDefined = true;
 
-      const std::string colorStr = valueGet.second.Get<std::string>();
-
-      Text::ColorStringToVector4( colorStr.c_str(), colorStr.size(), color );
+      if( valueGet.second.GetType() == Dali::Property::STRING )
+      {
+        const std::string colorStr = valueGet.second.Get<std::string>();
+        Text::ColorStringToVector4( colorStr.c_str(), colorStr.size(), color );
+      }
+      else
+      {
+        color = valueGet.second.Get<Vector4>();
+      }
     }
     else if( HEIGHT_KEY == valueGet.first.stringKey )
     {
       /// Height key.
       heightDefined = true;
 
-      const std::string heightStr = valueGet.second.Get<std::string>();
-
-      height = StringToFloat( heightStr.c_str() );
+      if( valueGet.second.GetType() == Dali::Property::STRING )
+      {
+        const std::string heightStr = valueGet.second.Get<std::string>();
+        height = StringToFloat( heightStr.c_str() );
+      }
+      else
+      {
+        height = valueGet.second.Get<float>();
+      }
     }
   }
 
@@ -155,7 +174,7 @@ bool ParseOutlineProperties( const Property::Map& underlinePropertiesMap,
                                bool& colorDefined,
                                Vector4& color,
                                bool& widthDefined,
-                               float& width )
+                               unsigned int& width )
 {
   const unsigned int numberOfItems = underlinePropertiesMap.Count();
 
@@ -174,7 +193,7 @@ bool ParseOutlineProperties( const Property::Map& underlinePropertiesMap,
     {
       /// Width key.
       widthDefined = true;
-      width = valueGet.second.Get<float>();
+      width = static_cast<unsigned int>( valueGet.second.Get<float>() );
     }
   }
 
@@ -218,7 +237,7 @@ bool SetUnderlineProperties( ControllerPtr controller, const Property::Value& va
                                               heightDefined,
                                               height );
 
-            controller->UnderlineSetByString( !empty);
+            controller->UnderlineSetByString( !empty );
           }
         }
         else
@@ -546,7 +565,7 @@ bool SetOutlineProperties( ControllerPtr controller, const Property::Value& valu
         bool colorDefined = false;
         Vector4 color;
         bool widthDefined = false;
-        float width = 0.f;
+        unsigned int width = 0u;
 
         bool empty = true;
 
@@ -581,7 +600,7 @@ bool SetOutlineProperties( ControllerPtr controller, const Property::Value& valu
             update = true;
           }
 
-          if( widthDefined && ( fabsf( controller->GetOutlineWidth() - width ) > Math::MACHINE_EPSILON_1000 ) )
+          if( widthDefined && ( controller->GetOutlineWidth() != width ) )
           {
             controller->SetOutlineWidth( width );
             update = true;
@@ -590,9 +609,9 @@ bool SetOutlineProperties( ControllerPtr controller, const Property::Value& valu
         else
         {
           // Disable outline
-          if( fabsf( controller->GetOutlineWidth() ) > Math::MACHINE_EPSILON_1000 )
+          if( 0u != controller->GetOutlineWidth() )
           {
-            controller->SetOutlineWidth( 0.0f );
+            controller->SetOutlineWidth( 0u );
             update = true;
           }
         }
@@ -627,17 +646,11 @@ void GetOutlineProperties( ControllerPtr controller, Property::Value& value, Eff
         else
         {
           const Vector4& color = controller->GetOutlineColor();
-          const float width = controller->GetOutlineWidth();
+          const unsigned int width = controller->GetOutlineWidth();
 
           Property::Map map;
-
-          std::string colorStr;
-          Vector4ToColorString( color, colorStr );
-          map.Insert( COLOR_KEY, colorStr );
-
-          std::string widthStr;
-          FloatToString( width, widthStr );
-          map.Insert( WIDTH_KEY, widthStr );
+          map.Insert( COLOR_KEY, color );
+          map.Insert( WIDTH_KEY, static_cast<int>( width ) );
 
           value = map;