[dali_2.3.22] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / text-effects-style.cpp
index 1428b95..60f45d2 100644 (file)
@@ -35,17 +35,16 @@ namespace Text
 {
 namespace
 {
-const std::string COLOR_KEY("color");
-const std::string OFFSET_KEY("offset");
-const std::string BLUR_RADIUS_KEY("blurRadius");
-const std::string WIDTH_KEY("width");
-const std::string HEIGHT_KEY("height");
-const std::string ENABLE_KEY("enable");
-const std::string TYPE_KEY("type");
-const std::string DASH_WIDTH_KEY("dashWidth");
-const std::string DASH_GAP_KEY("dashGap");
-const std::string TRUE_TOKEN("true");
-const std::string FALSE_TOKEN("false");
+const char* COLOR_KEY = "color";
+const char* OFFSET_KEY = "offset";
+const char* BLUR_RADIUS_KEY = "blurRadius";
+const char* WIDTH_KEY = "width";
+const char* HEIGHT_KEY = "height";
+const char* ENABLE_KEY = "enable";
+const char* TYPE_KEY = "type";
+const char* DASH_WIDTH_KEY = "dashWidth";
+const char* DASH_GAP_KEY = "dashGap";
+const char* TRUE_TOKEN = "true";
 } // namespace
 
 bool ParseShadowProperties(const Property::Map& shadowPropertiesMap,
@@ -230,7 +229,9 @@ bool ParseOutlineProperties(const Property::Map& underlinePropertiesMap,
                             bool&                colorDefined,
                             Vector4&             color,
                             bool&                widthDefined,
-                            uint16_t&            width)
+                            uint16_t&            width,
+                            bool&                offsetDefined,
+                            Vector2&             offset)
 {
   const unsigned int numberOfItems = underlinePropertiesMap.Count();
 
@@ -251,6 +252,21 @@ bool ParseOutlineProperties(const Property::Map& underlinePropertiesMap,
       widthDefined = true;
       width        = static_cast<uint16_t>(valueGet.second.Get<float>());
     }
+    else if((DevelText::Outline::Property::OFFSET == valueGet.first.indexKey) || (OFFSET_KEY == valueGet.first.stringKey))
+    {
+      /// Offset key.
+      offsetDefined = true;
+
+      if(valueGet.second.GetType() == Dali::Property::STRING)
+      {
+        const std::string offsetStr = valueGet.second.Get<std::string>();
+        StringToVector2(offsetStr.c_str(), offsetStr.size(), offset);
+      }
+      else
+      {
+        offset = valueGet.second.Get<Vector2>();
+      }
+    }
   }
 
   return 0u == numberOfItems;
@@ -753,10 +769,12 @@ bool SetOutlineProperties(ControllerPtr controller, const Property::Value& value
       {
         const Property::Map& propertiesMap = value.Get<Property::Map>();
 
-        bool     colorDefined = false;
+        bool     colorDefined  = false;
         Vector4  color;
-        bool     widthDefined = false;
-        uint16_t width        = 0u;
+        bool     widthDefined  = false;
+        uint16_t width         = 0u;
+        bool     offsetDefined = false;
+        Vector2  offset;
 
         bool empty = true;
 
@@ -777,7 +795,9 @@ bool SetOutlineProperties(ControllerPtr controller, const Property::Value& value
                                          colorDefined,
                                          color,
                                          widthDefined,
-                                         width);
+                                         width,
+                                         offsetDefined,
+                                         offset);
 
           controller->OutlineSetByString(false);
         }
@@ -796,6 +816,12 @@ bool SetOutlineProperties(ControllerPtr controller, const Property::Value& value
             controller->SetOutlineWidth(width);
             update = true;
           }
+
+          if(offsetDefined && (controller->GetOutlineOffset() != offset))
+          {
+            controller->SetOutlineOffset(offset);
+            update = true;
+          }
         }
         else
         {
@@ -836,12 +862,15 @@ void GetOutlineProperties(ControllerPtr controller, Property::Value& value, Effe
         }
         else
         {
-          const Vector4& color = controller->GetOutlineColor();
-          const uint16_t width = controller->GetOutlineWidth();
+          const Vector4& color  = controller->GetOutlineColor();
+          const uint16_t width  = controller->GetOutlineWidth();
+          const Vector2& offset = controller->GetOutlineOffset();
+
 
           Property::Map map;
           map.Insert(COLOR_KEY, color);
           map.Insert(WIDTH_KEY, static_cast<int>(width));
+          map.Insert(OFFSET_KEY, offset);
 
           value = map;