merge with master
[apps/osp/Internet.git] / src / IntFontManager.cpp
index 1ed8c5c..81603a6 100644 (file)
-//
-
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-//!Internet
-/*@file:  IntFontManager.cpp
- *@brief: This header file contains the definitions of the FontManager class.
- */
-
-#include "IntFontManager.h"
-
-using namespace Tizen::Base;
-using namespace Tizen::Graphics;
-
-FontTable fontTable[] = {
-               //FONT_GT34
-               {
-                               NULL, L"Global" /*L"GT_Latin"*/, FONT_STYLE_PLAIN, 34
-               },
-               //FONT_GT32
-               {
-                               NULL, L"Global" /*L"GT_Latin"*/, FONT_STYLE_PLAIN | FONT_STYLE_BOLD, 32
-               },
-               //FONT_GT30
-               {
-                               NULL, L"Global" /*L"GT_Latin"*/, FONT_STYLE_PLAIN | FONT_STYLE_BOLD, 30
-               },
-               //FONT_GT26
-               {
-                               NULL, L"Global" /*L"GT_Latin"*/, FONT_STYLE_PLAIN | FONT_STYLE_BOLD, 26
-               },
-               //FONT_GT20
-               {
-                               NULL, L"Global" /*L"GT_Latin"*/, FONT_STYLE_PLAIN | FONT_STYLE_BOLD, 20
-               },
-               //FONT_GT14
-               {
-                               NULL, L"Global" /*L"GT_Latin"*/, FONT_STYLE_PLAIN | FONT_STYLE_BOLD, 14
-               },
-
-               //FONT_GP40
-               {
-                               NULL, L"Global" /*L"GP_Latin"*/, FONT_STYLE_PLAIN, 40
-               },
-               //FONT_GP38
-               {
-                               NULL, L"Global" /*L"GP_Latin"*/, FONT_STYLE_PLAIN, 38
-               },
-               //FONT_GP36
-               {
-                               NULL, L"Global" /*L"GP_Latin"*/, FONT_STYLE_PLAIN, 36
-               },
-               //FONT_GP34
-               {
-                               NULL, L"Global" /*L"GP_Latin"*/, FONT_STYLE_PLAIN, 34
-               },
-               //FONT_GP30
-               {
-                               NULL, L"Global" /*L"GP_Latin"*/, FONT_STYLE_PLAIN, 30
-               },
-               //FONT_GP26
-               {
-                               NULL, L"Global" /*L"GP_Latin"*/, FONT_STYLE_PLAIN, 26
-               },
-               //FONT_GP24
-               {
-                               NULL, L"Global" /*L"GP_Latin"*/, FONT_STYLE_PLAIN, 24
-               },
-               //FONT_GP18
-               {
-                               NULL, L"Global" /*L"GP_Latin"*/, FONT_STYLE_PLAIN, 18
-               },
-
-               //FONT_GS30
-               {
-                               NULL, L"Global" /*L"GS_Latin"*/, FONT_STYLE_PLAIN, 30
-               },
-               //FONT_GS34
-               {
-                               NULL, L"Global" /*L"GS_Latin"*/, FONT_STYLE_PLAIN, 34
-               },
-
-               // end of font table ----------
-               {
-                               NULL, L"", FONT_STYLE_PLAIN, 0
-               }
-};
-
-void
-FontManager::CreateFont(FontId fontValue)
-{
-       Font* pFont = null;
-       if (fontValue < 0 || fontValue >= MAX_FONT)
-       {
-               return;
-       }
-
-       if (fontTable[fontValue].pInstance)
-       {
-               return;
-       }
-
-       if (fontTable[fontValue].fontName.GetLength() <= 0)
-       {
-               return;
-       }
-
-       pFont = new(std::nothrow) Font();
-       // If pFont is null then return
-       if (pFont == NULL)
-       {
-               return;
-       }
-
-       pFont->Construct( /*g_FontTable[fontid].fontName,*/
-                       fontTable[fontValue].fontStyle,
-                       fontTable[fontValue].fontSize);
-
-       fontTable[fontValue].pInstance = pFont;
-       return;
-}
-
-Font*
-FontManager::GetFont(FontId fontValue)
-{
-       if (fontValue < 0 || fontValue >= MAX_FONT)
-       {
-               return NULL;
-       }
-
-       //Check for the existence of fontValue in fontTable and if its not null then call CreateFont(fontValue)
-
-       if (fontTable[fontValue].pInstance == null)
-       {
-               CreateFont(fontValue);
-       }
-
-       return fontTable[fontValue].pInstance;
-
-}
-
-void
-FontManager::ReleaseFonts(void)
-{
-       int maxCount = 0;
-
-       for (maxCount = 0; maxCount < MAX_FONT; maxCount++)
-       {
-               //delete if instance exists in fontTable
-               if (fontTable[maxCount].pInstance)
-               {
-                       delete fontTable[maxCount].pInstance;
-                       fontTable[maxCount].pInstance = NULL;
-               }
-       }
-       return;
-}
+//\r
+\r
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.\r
+//\r
+// Licensed under the Flora License, Version 1.0 (the License);\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+//     http://floralicense.org/license/\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an AS IS BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+\r
+//!Internet\r
+/*@file:  IntFontManager.cpp\r
+ *@brief: This header file contains the definitions of the FontManager class.\r
+ */\r
+\r
+#include "IntFontManager.h"\r
+\r
+using namespace Tizen::Base;\r
+using namespace Tizen::Graphics;\r
+\r
+FontTable fontTable[] = {\r
+               //FONT_GT34\r
+               {\r
+                               NULL, L"Global" /*L"GT_Latin"*/, FONT_STYLE_PLAIN, 34\r
+               },\r
+               //FONT_GT32\r
+               {\r
+                               NULL, L"Global" /*L"GT_Latin"*/, FONT_STYLE_PLAIN | FONT_STYLE_BOLD, 32\r
+               },\r
+               //FONT_GT30\r
+               {\r
+                               NULL, L"Global" /*L"GT_Latin"*/, FONT_STYLE_PLAIN | FONT_STYLE_BOLD, 30\r
+               },\r
+               //FONT_GT26\r
+               {\r
+                               NULL, L"Global" /*L"GT_Latin"*/, FONT_STYLE_PLAIN | FONT_STYLE_BOLD, 26\r
+               },\r
+               //FONT_GT20\r
+               {\r
+                               NULL, L"Global" /*L"GT_Latin"*/, FONT_STYLE_PLAIN | FONT_STYLE_BOLD, 20\r
+               },\r
+               //FONT_GT14\r
+               {\r
+                               NULL, L"Global" /*L"GT_Latin"*/, FONT_STYLE_PLAIN | FONT_STYLE_BOLD, 14\r
+               },\r
+\r
+               //FONT_GP40\r
+               {\r
+                               NULL, L"Global" /*L"GP_Latin"*/, FONT_STYLE_PLAIN, 40\r
+               },\r
+               //FONT_GP38\r
+               {\r
+                               NULL, L"Global" /*L"GP_Latin"*/, FONT_STYLE_PLAIN, 38\r
+               },\r
+               //FONT_GP36\r
+               {\r
+                               NULL, L"Global" /*L"GP_Latin"*/, FONT_STYLE_PLAIN, 36\r
+               },\r
+               //FONT_GP34\r
+               {\r
+                               NULL, L"Global" /*L"GP_Latin"*/, FONT_STYLE_PLAIN, 34\r
+               },\r
+               //FONT_GP30\r
+               {\r
+                               NULL, L"Global" /*L"GP_Latin"*/, FONT_STYLE_PLAIN, 30\r
+               },\r
+               //FONT_GP26\r
+               {\r
+                               NULL, L"Global" /*L"GP_Latin"*/, FONT_STYLE_PLAIN, 26\r
+               },\r
+               //FONT_GP24\r
+               {\r
+                               NULL, L"Global" /*L"GP_Latin"*/, FONT_STYLE_PLAIN, 24\r
+               },\r
+               //FONT_GP18\r
+               {\r
+                               NULL, L"Global" /*L"GP_Latin"*/, FONT_STYLE_PLAIN, 18\r
+               },\r
+\r
+               //FONT_GS30\r
+               {\r
+                               NULL, L"Global" /*L"GS_Latin"*/, FONT_STYLE_PLAIN, 30\r
+               },\r
+               //FONT_GS34\r
+               {\r
+                               NULL, L"Global" /*L"GS_Latin"*/, FONT_STYLE_PLAIN, 34\r
+               },\r
+\r
+               // end of font table ----------\r
+               {\r
+                               NULL, L"", FONT_STYLE_PLAIN, 0\r
+               }\r
+};\r
+\r
+void\r
+FontManager::CreateFont(FontId fontValue)\r
+{\r
+       Font* pFont = null;\r
+       if (fontValue < 0 || fontValue >= MAX_FONT)\r
+       {\r
+               return;\r
+       }\r
+\r
+       if (fontTable[fontValue].pInstance)\r
+       {\r
+               return;\r
+       }\r
+\r
+       if (fontTable[fontValue].fontName.GetLength() <= 0)\r
+       {\r
+               return;\r
+       }\r
+\r
+       pFont = new(std::nothrow) Font();\r
+       // If pFont is null then return\r
+       if (pFont == NULL)\r
+       {\r
+               return;\r
+       }\r
+\r
+       pFont->Construct( /*g_FontTable[fontid].fontName,*/\r
+                       fontTable[fontValue].fontStyle,\r
+                       fontTable[fontValue].fontSize);\r
+\r
+       fontTable[fontValue].pInstance = pFont;\r
+       return;\r
+}\r
+\r
+Font*\r
+FontManager::GetFont(FontId fontValue)\r
+{\r
+       if (fontValue < 0 || fontValue >= MAX_FONT)\r
+       {\r
+               return NULL;\r
+       }\r
+\r
+       //Check for the existence of fontValue in fontTable and if its not null then call CreateFont(fontValue)\r
+\r
+       if (fontTable[fontValue].pInstance == null)\r
+       {\r
+               CreateFont(fontValue);\r
+       }\r
+\r
+       return fontTable[fontValue].pInstance;\r
+\r
+}\r
+\r
+void\r
+FontManager::ReleaseFonts(void)\r
+{\r
+       int maxCount = 0;\r
+\r
+       for (maxCount = 0; maxCount < MAX_FONT; maxCount++)\r
+       {\r
+               //delete if instance exists in fontTable\r
+               if (fontTable[maxCount].pInstance)\r
+               {\r
+                       delete fontTable[maxCount].pInstance;\r
+                       fontTable[maxCount].pInstance = NULL;\r
+               }\r
+       }\r
+       return;\r
+}\r