change type AppFontMap
authorSungyeon Woo <s.woo@samsung.com>
Tue, 2 Apr 2013 02:24:40 +0000 (11:24 +0900)
committerSungyeon Woo <s.woo@samsung.com>
Tue, 2 Apr 2013 03:06:51 +0000 (12:06 +0900)
Change-Id: I4bc78f17718a670d3b1ae3de9c0417519e61c1ac
Signed-off-by: Sungyeon Woo <s.woo@samsung.com>
src/graphics/FGrp_Font.cpp
src/graphics/FGrp_FontFt2.cpp
src/graphics/FGrp_FontRsrcManager.cpp
src/graphics/FGrp_FontRsrcManager.h
src/graphics/FGrp_IFont.h
src/graphics/inc/FGrp_FontImpl.h [changed mode: 0755->0644]

index bfdbdfa..a350cb2 100644 (file)
@@ -592,7 +592,9 @@ _Font::Construct(const Tizen::Base::String& fontName, int style, _Util::FixedPoi
 
        if (!Tizen::App::_AppInfo::IsOspCompat())
        {
-               appFontPath = mgr.FindAppFontName(fontName);
+               _Util::WString fontNameTemp(fontName.GetPointer());
+               _Util::WString appFontPathTemp(mgr.FindAppFontName(fontNameTemp));
+               appFontPath.Append(appFontPathTemp.c_str());
        }
 
        // check if user want to use a app font
@@ -1242,7 +1244,7 @@ _Font::__GetTextExtentList(const _Util::String& text, _Util::AccumList<_Util::Pa
 
                        if (pFont->LoadGlyph(*pText, &pFontGlyphData))
                        {
-                               // ¿ø·¡ Äڵ忡¼­´Â ¿¬¼ÓÀ¸·Î LoadGlyphÀÌ ½ÇÆÐÇÒ ¶§ ÀÌÀü °á°úÀÇ prevChar·Î kerningÀ» Ã¼Å©Çϴ ¹®Á¦°¡ ÀÖÀ½
+                               // When LoadGlyph fails continuously in the original code, there is a problem to check the kerning on the results of the previous prevChar
                                if (prevChar > 0)
                                {
                                        long xVec = 0;
index 821647d..3ff62ce 100644 (file)
@@ -84,6 +84,7 @@ _CompareFamilyForTitling(const char* pFamilyName)
        return false;
 }
 
+#ifdef USE_HASHMAP_FOR_FONT
 template<class T>
 class _FontHashCodeProvider
        : public IHashCodeProviderT <T>
@@ -111,8 +112,6 @@ public:
        }
 }; // _FontComparer
 
-
-#ifdef USE_HASHMAP_FOR_FONT
 template<class T>
 class _FontHashCodeProviderEx
        : public IHashCodeProviderT <T>
index faa0849..c8235aa 100644 (file)
@@ -176,6 +176,7 @@ protected:
        }
 }; // _FontNull
 
+#ifdef USE_HASHMAP_FOR_FONT
 template<class T>
 class _FontHashCodeProvider
        : public IHashCodeProviderT <T>
@@ -203,7 +204,6 @@ public:
        }
 }; // _FontComparer
 
-#ifdef USE_HASHMAP_FOR_FONT
 template<class T>
 class _FontHashCodeProviderEx
        : public IHashCodeProviderT <T>
@@ -238,20 +238,19 @@ _FontRsrcManager* _FontRsrcManager::__pTheInstance = null;
 _FontRsrcManager::_FontRsrcManager()
        : __isAppFontListInitialized(false)
 {
-       static _FontHashCodeProvider<String> fontHashCodeProvider;
-       static _FontComparer<String> fontComparer;
-
+#ifdef USE_HASHMAP_FOR_FONT
        // are you worry about failing to construct?
        // but, HashMapT only can give E_SUCCESS/E_INVALID_ARG/E_OUT_OF_MEMORY.
        // it means, if you ha2ve already verified input param, don't need to concern yourself.
        // even though you have E_OUT_OF_MEMORY, it's already out of our control,
        // and surely the other member function can give a error message.
-#ifdef USE_HASHMAP_FOR_FONT
+
        static _FontHashCodeProviderEx<_Util::WString> fontHashCodeProviderEx;
        static _FontComparerEx<_Util::WString> fontComparerEx;
        __fontRsrcMap.Construct(0, 0, fontHashCodeProviderEx, fontComparerEx);
+       __appFontMap.Construct(0, 0, fontHashCodeProviderEx, fontComparerEx);
 #endif
-       __appFontMap.Construct(0, 0, fontHashCodeProvider, fontComparer);
+
 
        __defaultSystemFontPath.Clear();
        __defaultSystemBoldFontPath.Clear();
@@ -274,12 +273,12 @@ _FontRsrcManager::~_FontRsrcManager()
 {
 #ifdef USE_HASHMAP_FOR_FONT
        __fontRsrcMap.RemoveAll();
+       __appFontMap.RemoveAll();
 #else
        __fontRsrcMap.clear();
+       __appFontMap.clear();
 #endif
 
-       __appFontMap.RemoveAll();
-
        delete __pDefaultSystemFont;
        delete __pFontMemoryManager;
 
@@ -1266,18 +1265,12 @@ _FontRsrcManager::RemoveMemory(unsigned long requestedSize)
 #endif
 }
 
-Tizen::Base::String
-_FontRsrcManager::FindAppFontName(const Tizen::Base::String& fontName)
+_Util::WString
+_FontRsrcManager::FindAppFontName(const _Util::WString& fontName)
 {
-       String fontPath(L"");
+       _Util::WString fontPath(L"");
 
-       if (__isAppFontListInitialized)
-       {
-               __appFontMap.GetValue(fontName, fontPath);
-
-               return fontPath;
-       }
-       else
+       if (!__isAppFontListInitialized)
        {
                String dirName;
                Directory dir;
@@ -1323,7 +1316,13 @@ _FontRsrcManager::FindAppFontName(const Tizen::Base::String& fontName)
 
                                faceName = _Font::GetFaceName(name);
 
-                               __appFontMap.Add(faceName, name);
+                               _Util::WString faceNameTemp(faceName.GetPointer());
+                               _Util::WString nameTemp(name.GetPointer());
+#ifdef USE_HASHMAP_FOR_FONT
+                               __appFontMap.Add(faceNameTemp, nameTemp);
+#else
+                               __appFontMap[faceNameTemp] = nameTemp;
+#endif
                        }
                }
 
@@ -1331,11 +1330,20 @@ _FontRsrcManager::FindAppFontName(const Tizen::Base::String& fontName)
                pDirEnum = null;
 
                __isAppFontListInitialized = true;
+       }
 
-               __appFontMap.GetValue(fontName, fontPath);
+#ifdef USE_HASHMAP_FOR_FONT
+       __appFontMap.GetValue(fontName, fontPath);
+#else
+       AppFontMapT::const_iterator appFontIterator = __appFontMap.find(fontName);
 
-               return fontPath;
+       if (appFontIterator != __appFontMap.end())
+       {
+               fontPath = appFontIterator->second;
        }
+#endif
+
+       return fontPath;
 }
 
 }} // Tizen::Graphics
index 4099e65..7adfbd8 100644 (file)
@@ -54,8 +54,10 @@ public:
        typedef std::tr1::shared_ptr<_IFont> SharedFontResource;
 #ifdef USE_HASHMAP_FOR_FONT
        typedef Tizen::Base::Collection::HashMapT <_Util::WString, SharedFontResource> FontMapT;
+       typedef Tizen::Base::Collection::HashMapT <_Util::WString, _Util::WString> AppFontMapT;
 #else
        typedef std::tr1::unordered_map<_Util::WString, SharedFontResource> FontMapT;
+       typedef std::tr1::unordered_map<_Util::WString, _Util::WString> AppFontMapT;
 #endif
 
        virtual ~_FontRsrcManager(void);
@@ -75,7 +77,7 @@ public:
        _Font& GetDefaultSystemFont(void);
        bool RemoveMemory(unsigned long requestedSize);
 
-       Tizen::Base::String FindAppFontName(const Tizen::Base::String& fontName);
+       _Util::WString FindAppFontName(const _Util::WString& fontName);
 
        static _FontRsrcManager& GetInstance(void);
 
@@ -99,7 +101,7 @@ private:
 
 private:
        FontMapT __fontRsrcMap;
-       Tizen::Base::Collection::HashMapT <Tizen::Base::String, Tizen::Base::String> __appFontMap;
+       AppFontMapT __appFontMap;
 
        Tizen::Base::String __defaultSystemFontPath;
        Tizen::Base::String __defaultSystemBoldFontPath;
index 5294541..3e74751 100644 (file)
 
 
 #ifdef USE_HASHMAP_FOR_FONT
-// nothing
+#include <FBaseColHashMapT.h>
 #else
 #include <tr1/unordered_map>
+#include <FBaseColIListT.h>
 #endif
 
-#include <FBaseColHashMapT.h>
-
 #include "util/FGrp_UtilType.h"
 
 namespace Tizen { namespace Graphics
old mode 100755 (executable)
new mode 100644 (file)
index f25e2bc..9b07a3c
@@ -29,6 +29,7 @@
 
 #include <FBaseObject.h>
 #include <FBaseString.h>
+#include <FBaseColArrayListT.h>
 
 namespace Tizen { namespace Base
 {