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_
30 #include <FBaseString.h>
31 #include <FBaseDataType.h>
32 #include <FBaseColHashMapT.h>
34 #include "FGrp_FontMemoryManager.h"
35 #include "util/FGrp_UtilTemplate.h"
38 namespace Tizen { namespace Graphics
44 class _FontRsrcManager
45 : public Tizen::Base::Object
48 typedef std::tr1::shared_ptr<_IFont> SharedFontResource;
50 virtual ~_FontRsrcManager(void);
52 result GetFont(const Tizen::Base::String& fontPath, int style, int size, SharedFontResource& out);
53 result GetFont(const byte* pFontData, int fontDataSize, int style, int size, SharedFontResource& out);
54 result GetFont(int style, int size, SharedFontResource& out);
56 result GetSystemFont(const Tizen::Base::String& fontName, int style, int size, SharedFontResource& out);
58 result GetTempFont(const Tizen::Base::String& fontPath, int style, int size, SharedFontResource& out);
59 result AddFont(const Tizen::Base::String& fontPath, SharedFontResource& out);
60 bool SearchFont(const Tizen::Base::String& fontName);
62 bool ReloadDefaultSystemFont(void);
63 _FontMemoryManager& GetMemoryManager(void);
64 _Font& GetDefaultSystemFont(void);
65 bool RemoveMemory(unsigned long requestedSize);
67 Tizen::Base::String FindAppFontName(const Tizen::Base::String& fontName);
69 static _FontRsrcManager& GetInstance(void);
72 _FontRsrcManager(void);
73 _FontRsrcManager(const _FontRsrcManager& obj);
74 _FontRsrcManager& operator =(const _FontRsrcManager& rhs);
76 bool __CreateFont(int fontEngine, const void* pBuffer, long bufSize, long face, _IFont** pOut);
77 bool __CreateFont(int fontEngine, const char* filePath, long face, _IFont** pOut);
78 bool __CreateStaticFont(int fontEngine, const void* pBuffer, long bufSize, long face, _IFont** pOut);
79 bool __SearchFont(const Tizen::Base::String& fontName, SharedFontResource& out) const;
80 bool __AddFont(const Tizen::Base::String& key, const SharedFontResource& font);
81 void __RemoveUnusedFont(void);
82 long __GetMaxFontEngine(void) const;
83 const Tizen::Base::String& __GetDefaultSystemFontPath(bool isBold);
84 Tizen::Base::String __GetFontPath(bool isBold);
85 bool __ReloadFont(Tizen::Base::String fontName, bool isBold);
87 static void __InitFontRsrcManager(void);
90 Tizen::Base::Collection::HashMapT <Tizen::Base::String, SharedFontResource> __fontRsrcMap;
91 Tizen::Base::Collection::HashMapT <Tizen::Base::String, Tizen::Base::String> __appFontMap;
93 Tizen::Base::String __defaultSystemFontPath;
94 Tizen::Base::String __defaultSystemBoldFontPath;
96 _FontMemoryManager* __pFontMemoryManager;
97 _Font* __pDefaultSystemFont;
99 static _FontRsrcManager* __pTheInstance;
100 bool __isAppFontListInitialized;
101 }; // _FontRsrcManager
103 }} // Tizen::Graphics
105 #endif // _FGRP_INTERNAL_FONT_RSRC_MANAGER_H_