[Tizen] Support custom fonts registration
authorWonSik Jung <sidein@samsung.com>
Mon, 13 Aug 2018 02:18:55 +0000 (11:18 +0900)
committerWonSik Jung <sidein@samsung.com>
Mon, 13 Aug 2018 02:19:04 +0000 (11:19 +0900)
This reverts commit c9dabddc443f05598aa56f427dc27b269fa27ee5.

Change-Id: I445b777c80a451081b1e503bfe96f2364fb2be7f

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 2dcb128..00b7528 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 167607d..c444eb8 100755 (executable)
@@ -408,6 +408,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 ad125fd..3d0f72b 100644 (file)
@@ -288,6 +288,13 @@ FT_FaceRec_* FontClient::GetFreetypeFace( FontId fontId )
   return mPlugin->GetFreetypeFace( fontId );
 }
 
+bool FontClient::AddCustomFontDirectory( const FontPath& path )
+{
+  CreatePlugin();
+
+  return mPlugin->AddCustomFontDirectory( path );
+}
+
 void FontClient::CreatePlugin()
 {
   if( !mPlugin )
index e957187..0d9cf71 100644 (file)
@@ -205,6 +205,11 @@ public:
    */
   FT_FaceRec_* GetFreetypeFace( FontId fontId );
 
+  /**
+   * @copydoc Dali::TextAbstraction::FontClient::AddCustomFontDirectory()
+   */
+  bool AddCustomFontDirectory( const FontPath& path );
+
 private:
 
   /**
index 8047822..9b866ef 100644 (file)
@@ -1283,6 +1283,12 @@ FT_FaceRec_* FontClient::Plugin::GetFreetypeFace( FontId fontId )
   return fontFace;
 }
 
+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 da207d5..9bbc70c 100644 (file)
@@ -329,6 +329,11 @@ struct FontClient::Plugin
    */
   FT_FaceRec_* GetFreetypeFace( FontId fontId );
 
+  /**
+   * @copydoc Dali::TextAbstraction::FontClient::AddCustomFontDirectory()
+   */
+  bool AddCustomFontDirectory( const FontPath& path );
+
 private:
 
   /**