1 ////////////////////////////////////////////////////////////////////////////////
2 //    Scorched3D (c) 2000-2011
3 //
4 //    This file is part of Scorched3D.
5 //
6 //    Scorched3D is free software; you can redistribute it and/or modify
7 //    it under the terms of the GNU General Public License as published by
8 //    the Free Software Foundation; either version 2 of the License, or
9 //    (at your option) any later version.
10 //
11 //    Scorched3D is distributed in the hope that it will be useful,
12 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 //    GNU General Public License for more details.
15 //
16 //    You should have received a copy of the GNU General Public License along
17 //    with this program; if not, write to the Free Software Foundation, Inc.,
18 //    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 ////////////////////////////////////////////////////////////////////////////////
20 
21 #include <GLW/GLWFont.h>
22 #include <common/Defines.h>
23 #include <console/ConsoleRuleMethodIAdapter.h>
24 #include <common/Logger.h>
25 
26 Vector GLWFont::widgetFontColor = Vector(0.2f, 0.2f, 0.2f);
27 Vector GLWFont::disabledWidgetFontColor = Vector(0.4f, 0.4f, 0.4f);
28 
29 GLWFont *GLWFont::instance_ = 0;
30 
instance()31 GLWFont *GLWFont::instance()
32 {
33 	if (!instance_)
34 	{
35 		instance_ = new GLWFont;
36 	}
37 
38 	return instance_;
39 }
40 
GLWFont()41 GLWFont::GLWFont()
42 {
43 	gameFont_ = new GLFont2d;
44 	gameFont_->createFont(
45 		S3D::getDataFile("data/fonts/dejavusconbd.ttf"),
46 		16);
47 	gameShadowFont_ = new GLFont2d;
48 	gameShadowFont_->createFont(
49 		S3D::getDataFile("data/fonts/dejavusconbd.ttf"),
50 		16,
51 		true);
52 	courierFont_ = new GLFont2d;
53 	courierFont_->createFont(
54 		S3D::getDataFile("data/fonts/dejavusmobd.ttf"),
55 		16);
56 	normalFont_ = new GLFont2d;
57 	normalFont_->createFont(
58 		S3D::getDataFile("data/fonts/dejavusans.ttf"),
59 		16);
60 	normalShadowFont_ = new GLFont2d;
61 	normalShadowFont_->createFont(
62 		S3D::getDataFile("data/fonts/dejavusans.ttf"),
63 		16,
64 		true);
65 
66 	new ConsoleRuleMethodIAdapter<GLWFont>(
67 		this, &GLWFont::displayCharacterInfo, "CharacterInfo");
68 }
69 
~GLWFont()70 GLWFont::~GLWFont()
71 {
72 
73 }
74 
displayCharacterInfo()75 void GLWFont::displayCharacterInfo()
76 {
77 	Logger::log(S3D::formatStringBuffer("Characters : %u\nCharacter Blocks : %u\n",
78 		GLFont2d::getTotalCharacters(),
79 		GLFont2dStorage::getTotalCharacterBlocks()));
80 }
81