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
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;
}
}; // _FontNull
+#ifdef USE_HASHMAP_FOR_FONT
template<class T>
class _FontHashCodeProvider
: public IHashCodeProviderT <T>
}
}; // _FontComparer
-#ifdef USE_HASHMAP_FOR_FONT
template<class T>
class _FontHashCodeProviderEx
: public IHashCodeProviderT <T>
_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();
{
#ifdef USE_HASHMAP_FOR_FONT
__fontRsrcMap.RemoveAll();
+ __appFontMap.RemoveAll();
#else
__fontRsrcMap.clear();
+ __appFontMap.clear();
#endif
- __appFontMap.RemoveAll();
-
delete __pDefaultSystemFont;
delete __pFontMemoryManager;
#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;
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
}
}
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
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);
_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);
private:
FontMapT __fontRsrcMap;
- Tizen::Base::Collection::HashMapT <Tizen::Base::String, Tizen::Base::String> __appFontMap;
+ AppFontMapT __appFontMap;
Tizen::Base::String __defaultSystemFontPath;
Tizen::Base::String __defaultSystemBoldFontPath;