diff --git a/src/app/app.h b/src/app/app.h index 3835b418..20721e24 100644 --- a/src/app/app.h +++ b/src/app/app.h @@ -44,7 +44,6 @@ class CSoundInterface; class CInput; class CPathManager; class CConfigFile; -class CFontConfigFile; class CSystemUtils; struct SystemTimeStamp; diff --git a/src/common/font_config.cpp b/src/common/font_config.cpp index 16017d8e..b4487f1a 100644 --- a/src/common/font_config.cpp +++ b/src/common/font_config.cpp @@ -37,17 +37,17 @@ namespace bp = boost::property_tree; -CFontConfigFile::CFontConfigFile() +CFontConfig::CFontConfig() : m_needsSave(false) , m_loaded(false) { } -CFontConfigFile::~CFontConfigFile() +CFontConfig::~CFontConfig() { } -bool CFontConfigFile::Init() +bool CFontConfig::Init() { try { @@ -76,7 +76,7 @@ bool CFontConfigFile::Init() return true; } -std::string CFontConfigFile::GetFont(Gfx::FontType type) +std::string CFontConfig::GetFont(Gfx::FontType type) { switch(type) { diff --git a/src/common/font_config.h b/src/common/font_config.h index 892f9db3..594b4ce8 100644 --- a/src/common/font_config.h +++ b/src/common/font_config.h @@ -33,17 +33,17 @@ #include /** -* \class CFontConfigFile +* \class CFontConfig * * \brief Class for loading config file * */ -class CFontConfigFile : public CSingleton +class CFontConfig { public: - CFontConfigFile(); - virtual ~CFontConfigFile(); + CFontConfig(); + virtual ~CFontConfig(); /** Loads fonts.ini * \return return true on success @@ -60,9 +60,3 @@ private: bool m_needsSave; bool m_loaded; }; - -//! Global function to get config file instance -inline CFontConfigFile & GetFontConfigFile() -{ - return CFontConfigFile::GetInstance(); -} \ No newline at end of file diff --git a/src/graphics/engine/text.cpp b/src/graphics/engine/text.cpp index 016b1d22..8a023d67 100644 --- a/src/graphics/engine/text.cpp +++ b/src/graphics/engine/text.cpp @@ -117,8 +117,8 @@ CText::~CText() bool CText::Create() { - CFontConfigFile fontconfig; - if (!GetFontConfigFile().Init()) + CFontConfig fontConfig; + if (!fontConfig.Init()) { GetLogger()->Warn("Error on parsing fonts config file: failed to open file\n"); } @@ -128,14 +128,14 @@ bool CText::Create() return false; } - m_fonts[FONT_COMMON] = MakeUnique(GetFontConfigFile().GetFont(FONT_COMMON)); - m_fonts[FONT_COMMON_BOLD] = MakeUnique(GetFontConfigFile().GetFont(FONT_COMMON_BOLD)); - m_fonts[FONT_COMMON_ITALIC] = MakeUnique(GetFontConfigFile().GetFont(FONT_COMMON_ITALIC)); + m_fonts[FONT_COMMON] = MakeUnique(fontConfig.GetFont(FONT_COMMON)); + m_fonts[FONT_COMMON_BOLD] = MakeUnique(fontConfig.GetFont(FONT_COMMON_BOLD)); + m_fonts[FONT_COMMON_ITALIC] = MakeUnique(fontConfig.GetFont(FONT_COMMON_ITALIC)); - m_fonts[FONT_SATCOM] = MakeUnique(GetFontConfigFile().GetFont(FONT_SATCOM)); + m_fonts[FONT_SATCOM] = MakeUnique(fontConfig.GetFont(FONT_SATCOM)); - m_fonts[FONT_STUDIO] = MakeUnique(GetFontConfigFile().GetFont(FONT_STUDIO)); - m_fonts[FONT_STUDIO_BOLD] = MakeUnique(GetFontConfigFile().GetFont(FONT_STUDIO_BOLD)); + m_fonts[FONT_STUDIO] = MakeUnique(fontConfig.GetFont(FONT_STUDIO)); + m_fonts[FONT_STUDIO_BOLD] = MakeUnique(fontConfig.GetFont(FONT_STUDIO_BOLD)); for (auto it = m_fonts.begin(); it != m_fonts.end(); ++it) {