3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.1 (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: IntFontManager.cpp
20 *@brief: This header file contains the definitions of the FontManager class.
23 #include "IntFontManager.h"
25 using namespace Tizen::Base;
26 using namespace Tizen::Graphics;
28 FontTable fontTable[] = {
31 NULL, L"Global" /*L"GT_Latin"*/, FONT_STYLE_PLAIN, 34
35 NULL, L"Global" /*L"GT_Latin"*/, FONT_STYLE_PLAIN | FONT_STYLE_BOLD, 32
39 NULL, L"Global" /*L"GT_Latin"*/, FONT_STYLE_PLAIN | FONT_STYLE_BOLD, 30
43 NULL, L"Global" /*L"GT_Latin"*/, FONT_STYLE_PLAIN | FONT_STYLE_BOLD, 26
47 NULL, L"Global" /*L"GT_Latin"*/, FONT_STYLE_PLAIN | FONT_STYLE_BOLD, 20
51 NULL, L"Global" /*L"GT_Latin"*/, FONT_STYLE_PLAIN | FONT_STYLE_BOLD, 14
56 NULL, L"Global" /*L"GP_Latin"*/, FONT_STYLE_PLAIN, 40
60 NULL, L"Global" /*L"GP_Latin"*/, FONT_STYLE_PLAIN, 38
64 NULL, L"Global" /*L"GP_Latin"*/, FONT_STYLE_PLAIN, 36
68 NULL, L"Global" /*L"GP_Latin"*/, FONT_STYLE_PLAIN, 34
72 NULL, L"Global" /*L"GP_Latin"*/, FONT_STYLE_PLAIN, 30
76 NULL, L"Global" /*L"GP_Latin"*/, FONT_STYLE_PLAIN, 26
80 NULL, L"Global" /*L"GP_Latin"*/, FONT_STYLE_PLAIN, 24
84 NULL, L"Global" /*L"GP_Latin"*/, FONT_STYLE_PLAIN, 18
89 NULL, L"Global" /*L"GS_Latin"*/, FONT_STYLE_PLAIN, 30
93 NULL, L"Global" /*L"GS_Latin"*/, FONT_STYLE_PLAIN, 34
96 // end of font table ----------
98 NULL, L"", FONT_STYLE_PLAIN, 0
103 FontManager::CreateFont(FontId fontValue)
106 if (fontValue < 0 || fontValue >= MAX_FONT)
111 if (fontTable[fontValue].pInstance)
116 if (fontTable[fontValue].fontName.GetLength() <= 0)
121 pFont = new(std::nothrow) Font();
122 // If pFont is null then return
128 pFont->Construct( /*g_FontTable[fontid].fontName,*/
129 fontTable[fontValue].fontStyle,
130 fontTable[fontValue].fontSize);
132 fontTable[fontValue].pInstance = pFont;
137 FontManager::GetFont(FontId fontValue)
139 if (fontValue < 0 || fontValue >= MAX_FONT)
144 //Check for the existence of fontValue in fontTable and if its not null then call CreateFont(fontValue)
146 if (fontTable[fontValue].pInstance == null)
148 CreateFont(fontValue);
151 return fontTable[fontValue].pInstance;
156 FontManager::ReleaseFonts(void)
160 for (maxCount = 0; maxCount < MAX_FONT; maxCount++)
162 //delete if instance exists in fontTable
163 if (fontTable[maxCount].pInstance)
165 delete fontTable[maxCount].pInstance;
166 fontTable[maxCount].pInstance = NULL;