[Tizen] Support custom fonts registration
authorminho.sun <minho.sun@samsung.com>
Thu, 2 Aug 2018 01:21:16 +0000 (10:21 +0900)
committerminho.sun <minho.sun@samsung.com>
Thu, 2 Aug 2018 01:21:21 +0000 (10:21 +0900)
This reverts commit 5a81079170460ac882570328b9daf0208deda1b1.

Change-Id: I77255d4d1ab76a32f34a5dfe40011949f2f2e633

dali/devel-api/text-abstraction/font-client.cpp
dali/devel-api/text-abstraction/font-client.h
dali/internal/text/text-abstraction/font-client-impl.cpp
dali/internal/text/text-abstraction/font-client-impl.h
dali/internal/text/text-abstraction/font-client-plugin-impl.cpp
dali/internal/text/text-abstraction/font-client-plugin-impl.h

index e49410a..77223f9 100644 (file)
@@ -207,6 +207,11 @@ bool FontClient::IsColorGlyph( FontId fontId, GlyphIndex glyphIndex )
   return GetImplementation(*this).IsColorGlyph( fontId, glyphIndex );
 }
 
+bool FontClient::AddCustomFontDirectory( const FontPath& path )
+{
+  return GetImplementation(*this).AddCustomFontDirectory( path );
+}
+
 FontClient::FontClient( Internal::FontClient* internal )
 : BaseHandle( internal )
 {
index 6411b16..5cfe938 100755 (executable)
@@ -406,6 +406,15 @@ public:
    */
   bool IsColorGlyph( FontId fontId, GlyphIndex glyphIndex );
 
+  /**
+   * @brief  Add custom fonts directory
+   *
+   * @param[in] path to the fonts directory
+   *
+   * @return true if the fonts can be added.
+   */
+  bool AddCustomFontDirectory( const FontPath& path );
+
 public: // Not intended for application developers
   /**
    * @brief This constructor is used by FontClient::Get().
index 6e081af..ee3d651 100644 (file)
@@ -281,6 +281,13 @@ bool FontClient::IsColorGlyph( FontId fontId, GlyphIndex glyphIndex )
   return mPlugin->IsColorGlyph( fontId, glyphIndex );
 }
 
+bool FontClient::AddCustomFontDirectory( const FontPath& path )
+{
+  CreatePlugin();
+
+  return mPlugin->AddCustomFontDirectory( path );
+}
+
 void FontClient::CreatePlugin()
 {
   if( !mPlugin )
index cfa3a20..13d847b 100644 (file)
@@ -193,6 +193,11 @@ public:
    */
   bool IsColorGlyph( FontId fontId, GlyphIndex glyphIndex );
 
+  /**
+   * @copydoc Dali::TextAbstraction::FontClient::AddCustomFontDirectory()
+   */
+  bool AddCustomFontDirectory( const FontPath& path );
+
 private:
 
   /**
index fc85a4b..30ee4e8 100644 (file)
@@ -1256,6 +1256,12 @@ bool FontClient::Plugin::IsColorGlyph( FontId fontId, GlyphIndex glyphIndex )
   return FT_Err_Ok == error;
 }
 
+bool FontClient::Plugin::AddCustomFontDirectory( const FontPath& path )
+{
+  // NULL as first parameter means the current configuration is used.
+  return FcConfigAppFontAddDir( NULL, reinterpret_cast<const FcChar8 *>( path.c_str() ) );
+}
+
 void FontClient::Plugin::InitSystemFonts()
 {
   DALI_LOG_INFO( gLogFilter, Debug::General, "-->FontClient::Plugin::InitSystemFonts\n" );
index 4de27b7..8a62eb6 100644 (file)
@@ -323,6 +323,11 @@ struct FontClient::Plugin
    */
   bool IsColorGlyph( FontId fontId, GlyphIndex glyphIndex );
 
+  /**
+   * @copydoc Dali::TextAbstraction::FontClient::AddCustomFontDirectory()
+   */
+  bool AddCustomFontDirectory( const FontPath& path );
+
 private:
 
   /**