Retrieve the current system font and style 37/35737/1
authordaemyung jang <dm86.jang@samsung.com>
Tue, 24 Feb 2015 06:27:08 +0000 (15:27 +0900)
committerdaemyung jang <dm86.jang@samsung.com>
Tue, 24 Feb 2015 06:27:08 +0000 (15:27 +0900)
Change-Id: I324205cd9638588139e2687f65b691e9d7651c41

platform-abstractions/slp/font-platform/font-controller-impl.cpp
platform-abstractions/slp/font-platform/font-controller-impl.h

index 80a9333..eacb39a 100755 (executable)
@@ -365,7 +365,8 @@ const FontController::StyledFontFamily& FontController::GetFontFamilyForChars( c
 {
   if( 0u == mPreferredFonts.Count() )
   {
-    CreatePreferedFontList();
+    StyledFontFamily tizenFont( DEFAULT_FONT_FAMILY_NAME, DEFAULT_FONT_STYLE );
+    CreatePreferedFontList( tizenFont );
   }
 
   // Cycle through the preferred list of fonts on the system for 'Tizen'.
@@ -455,11 +456,7 @@ bool FontController::AllGlyphsSupported( const StyledFontFamily& styledFontFamil
 
 void FontController::SetDefaultFontFamily( const StyledFontFamily& styledFontFamily )
 {
-  // reload font configuration files
-  const bool ok =  FcInitReinitialize();
-  DALI_ASSERT_ALWAYS( ok && "FcInitReinitialize failed");
-
-  CreatePreferedFontList();
+  CreatePreferedFontList(styledFontFamily);
 }
 
 void FontController::AddCachedFont( const StyledFontFamily& styledFontFamily, const std::string& fontPath, _FcCharSet *characterSet )
@@ -725,16 +722,12 @@ const FontController::StyledFontFamily& FontController::GetMatchedFont( const St
   return NULL_STYLED_FONT_FAMILY;
 }
 
-void FontController::CreatePreferedFontList( )
+void FontController::CreatePreferedFontList( const StyledFontFamily& styledFontFamily )
 {
-  StyledFontFamily tizenFont;
-  tizenFont.first = DEFAULT_FONT_FAMILY_NAME;
-  tizenFont.second = DEFAULT_FONT_STYLE;
-
   // clear the current list
   ClearPreferredFontList();
 
-  FcPattern* searchPattern = CreateFontFamilyPattern( tizenFont );
+  FcPattern* searchPattern = CreateFontFamilyPattern( styledFontFamily );
 
   FcResult result(FcResultMatch);
 
index 0283882..fd09a20 100644 (file)
@@ -210,8 +210,9 @@ private:
 
    /**
     * Create a preferred list of fonts to use for when GetFontFamilyForChars() is called.
+    * @param[in] styledFontFamily The name of the font's family and the font's style.
     */
-  void CreatePreferedFontList();
+  void CreatePreferedFontList( const StyledFontFamily& styleFontFamily );
 
   /**
    * Deletes all preferred fonts.