2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://floralicense.org/license/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FGrp_FontRsrcManager.h
20 * @brief This is the header file for FGrp_FontRsrcManager class.
24 #ifndef _FGRP_INTERNAL_FONT_RSRC_MANAGER_H_
25 #define _FGRP_INTERNAL_FONT_RSRC_MANAGER_H_
31 #ifdef USE_HASHMAP_FOR_FONT
32 #include <FBaseColHashMapT.h>
38 #include <FBaseString.h>
39 #include <FBaseDataType.h>
40 #include <FBaseColArrayListT.h>
42 #include "FGrp_FontMemoryManager.h"
43 #include "util/FGrp_UtilTemplate.h"
45 namespace Tizen { namespace Graphics
51 class _FontRsrcManager
52 : public Tizen::Base::Object
55 typedef std::tr1::shared_ptr<_IFont> SharedFontResource;
56 #ifdef USE_HASHMAP_FOR_FONT
57 typedef Tizen::Base::Collection::HashMapT <_Util::WString, SharedFontResource> FontMapT;
58 typedef Tizen::Base::Collection::HashMapT <_Util::WString, _Util::WString> AppFontMapT;
60 typedef std::list<std::pair<_Util::WString, SharedFontResource> > FontMapT;
61 typedef std::list<std::pair<_Util::WString, _Util::WString> > AppFontMapT;
64 virtual ~_FontRsrcManager(void);
66 result GetFont(const Tizen::Base::String& fontPath, int style, _Util::FixedPoint26_6 size, SharedFontResource& out);
67 result GetFont(const byte* pFontData, int fontDataSize, int style, _Util::FixedPoint26_6 size, SharedFontResource& out);
68 result GetFont(int style, _Util::FixedPoint26_6 size, SharedFontResource& out);
70 result GetSystemFont(const Tizen::Base::String& fontName, int style, _Util::FixedPoint26_6 size, SharedFontResource& out);
72 result GetTempFont(const Tizen::Base::String& fontPath, int style, _Util::FixedPoint26_6 size, SharedFontResource& out);
73 result AddFont(const _Util::WString& fontPath, SharedFontResource& out);
74 bool SearchFont(const _Util::WString& fontName);
76 bool ReloadDefaultSystemFont(void);
77 _FontMemoryManager& GetMemoryManager(void);
78 _Font& GetDefaultSystemFont(void);
79 bool RemoveMemory(unsigned long requestedSize);
81 _Util::WString FindAppFontName(const _Util::WString& fontName);
83 static _FontRsrcManager& GetInstance(void);
86 _FontRsrcManager(void);
87 _FontRsrcManager(const _FontRsrcManager& obj);
88 _FontRsrcManager& operator =(const _FontRsrcManager& rhs);
90 bool __CreateFont(int fontEngine, const void* pBuffer, long bufSize, long face, _IFont** pOut);
91 bool __CreateFont(int fontEngine, const char* filePath, long face, _IFont** pOut);
92 bool __CreateStaticFont(int fontEngine, const void* pBuffer, long bufSize, long face, _IFont** pOut);
93 bool __SearchFont(const _Util::WString& fontName, SharedFontResource& out) const;
94 bool __AddFont(const _Util::WString& key, const SharedFontResource& font);
95 void __RemoveUnusedFont(void);
96 long __GetMaxFontEngine(void) const;
97 const Tizen::Base::String& __GetDefaultSystemFontPath(bool isBold);
98 Tizen::Base::String __GetFontPath(bool isBold);
99 bool __ReloadFont(Tizen::Base::String fontName, bool isBold);
101 static void __InitFontRsrcManager(void);
104 FontMapT __fontRsrcMap;
105 AppFontMapT __appFontMap;
107 Tizen::Base::String __defaultSystemFontPath;
108 Tizen::Base::String __defaultSystemBoldFontPath;
110 _FontMemoryManager* __pFontMemoryManager;
111 _Font* __pDefaultSystemFont;
113 static _FontRsrcManager* __pTheInstance;
114 bool __isAppFontListInitialized;
115 }; // _FontRsrcManager
117 }} // Tizen::Graphics
119 #endif // _FGRP_INTERNAL_FONT_RSRC_MANAGER_H_