Cache the GetDefaultPlatformFontDescription results
[platform/core/uifw/dali-adaptor.git] / text / dali / internal / text-abstraction / font-client-plugin-impl.h
index 338c503..bcfaec1 100644 (file)
@@ -147,6 +147,11 @@ struct FontClient::Plugin
   void SetDpi( unsigned int horizontalDpi, unsigned int verticalDpi );
 
   /**
+   * @copydoc Dali::FontClient::ResetSystemDefaults()
+   */
+  void ResetSystemDefaults();
+
+  /**
    * @copydoc Dali::FontClient::SetDefaultFont()
    */
   void SetDefaultFont( const FontDescription& fontDescription );
@@ -264,6 +269,14 @@ private:
   void InitSystemFonts();
 
   /**
+   * Gets the FontDescription which matches the given pattern
+   * @param[in] pattern pattern to match against
+   * @param[out] fontDescription the resultant fontDescription that matched
+   * @return true if match found
+   */
+  bool MatchFontDescriptionToPattern( _FcPattern* pattern, Dali::TextAbstraction::FontDescription& fontDescription );
+
+  /**
    * @brief Creates a font family pattern used to match fonts.
    *
    * @param[in] fontDescription The font to cache.
@@ -390,7 +403,7 @@ private:
                      FontDescriptionId& validatedFontId );
 
   /**
-   * Helper for SetDefaultFont etc.
+   * Helper for GetDefaultFonts etc.
    *
    * @param[in] fontDescription A font description.
    * @param[out] fontList A list of the fonts which are a close match for fontDescription.
@@ -402,6 +415,8 @@ private:
   unsigned int mDpiHorizontal; ///< Horizontal dpi.
   unsigned int mDpiVertical;   ///< Vertical dpi.
 
+  FontDescription mDefaultFontDescription; ///< The cached default font from the system
+
   FontList mSystemFonts;       ///< Cached system fonts.
   FontList mDefaultFonts;      ///< Cached default fonts.
 
@@ -413,6 +428,8 @@ private:
   std::vector<FontIdCacheItem>          mFontIdCache;          ///< Caches font ids for the pairs of font point size and the index to the vector with font descriptions of the validated fonts.
 
   Vector<EllipsisItem> mEllipsisCache;      ///< Caches ellipsis glyphs for a particular point size.
+
+  bool mDefaultFontDescriptionCached : 1; ///< Whether the default font is cached or not
 };
 
 } // namespace Internal