[4.0] Support custom fonts registration 30/154830/1
authortaeyoon0.lee <taeyoon0.lee@samsung.com>
Wed, 11 Oct 2017 09:15:25 +0000 (18:15 +0900)
committertaeyoon0.lee <taeyoon0.lee@samsung.com>
Wed, 11 Oct 2017 09:15:36 +0000 (18:15 +0900)
This reverts commit 1ccb7aaa44a36b39f4591fc4cd9673637c91a675.

Change-Id: I4bbda02028e9f97050f01cba68b378e8a40c26d2

automated-tests/src/dali-toolkit-styling/utc-Dali-StyleManager.cpp
dali-toolkit/internal/text/multi-language-support-impl.cpp

index 07d657f0f2bec04b65c4c68fed9544607b628fdf..8fe28123131670f924fa4d443baa2ba17af63206 100644 (file)
@@ -1309,7 +1309,8 @@ int UtcDaliStyleManagerConfigSectionTest(void)
     "  \"config\":\n"
     "  {\n"
     "    \"alwaysShowFocus\":false,\n"
-    "    \"clearFocusOnEscape\":false\n"
+    "    \"clearFocusOnEscape\":false,\n"
+    "    \"customFontDirectory\":\"" DALI_STYLE_DIR "\"\n"
     "  },\n"
     "  \"styles\":\n"
     "  {\n"
@@ -1327,9 +1328,12 @@ int UtcDaliStyleManagerConfigSectionTest(void)
   DALI_TEST_CHECK( !alwaysShowFocus );
   bool clearFocusOnEscape = config["clearFocusOnEscape"].Get<bool>();
   DALI_TEST_CHECK( !clearFocusOnEscape );
+  std::string customFontDirectory = config["customFontDirectory"].Get<std::string>();
+  DALI_TEST_EQUALS( customFontDirectory, DALI_STYLE_DIR, TEST_LOCATION );
 
   // For coverage
   Toolkit::TextEditor editor = Toolkit::TextEditor::New();
+  editor.SetProperty( TextEditor::Property::TEXT, "Test" );
   editor.SetKeyboardFocusable( true );
   Stage::GetCurrent().Add( editor );
 
index e88a28617efb61a2bc88be28cd0440695eb0040b..d32809c16f8711d2c1c8528ffd70dc53fee7865c 100644 (file)
@@ -25,6 +25,7 @@
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/internal/text/multi-language-helper-functions.h>
+#include <dali-toolkit/devel-api/styling/style-manager-devel.h>
 
 namespace Dali
 {
@@ -106,6 +107,20 @@ MultilanguageSupport::MultilanguageSupport()
   // Initializes the valid fonts cache to NULL (no valid fonts).
   // Reserves space to cache the valid fonts and access them with the script as an index.
   mValidFontsPerScriptCache.Resize( TextAbstraction::UNKNOWN, NULL );
+
+  // Add custom font directory
+  Toolkit::StyleManager styleManager = Toolkit::StyleManager::Get();
+  if( styleManager )
+  {
+    std::string path;
+    Property::Map config = Toolkit::DevelStyleManager::GetConfigurations( styleManager );
+    if( config["customFontDirectory"].Get( path ) )
+    {
+      TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
+      fontClient.AddCustomFontDirectory( path.c_str() );
+    }
+  }
+
 }
 
 MultilanguageSupport::~MultilanguageSupport()