diff --git a/src/common/font_loader.cpp b/src/common/font_loader.cpp index 8c587b17..06b16de4 100644 --- a/src/common/font_loader.cpp +++ b/src/common/font_loader.cpp @@ -20,6 +20,7 @@ #include "common/font_loader.h" #include "common/logger.h" +#include "common/stringutils.h" #include "common/resources/inputstream.h" #include "common/resources/outputstream.h" @@ -32,9 +33,6 @@ #include #include #include -#include - -namespace bp = boost::property_tree; CFontLoader::CFontLoader() @@ -56,7 +54,15 @@ bool CFontLoader::Init() if (good) { - bp::ini_parser::read_ini(*stream, m_propertyTree); + std::string line; + + while (std::getline(*stream, line)) + { + auto parts = StrUtils::Split(line, " ="); + + m_fonts[parts[0]] = parts[1]; + } + GetLogger()->Debug("Fonts config file loaded correctly. \n"); } else @@ -74,8 +80,10 @@ bool CFontLoader::Init() std::optional CFontLoader::GetFont(Gfx::FontType type) const { - auto font = m_propertyTree.get_optional(ToString(type)); - if (font) - return std::string("/fonts/") + *font; - return std::nullopt; + auto iterator = m_fonts.find(ToString(type)); + + if (iterator == m_fonts.end()) + return std::nullopt; + else + return std::string("/fonts/") + iterator->second; } diff --git a/src/common/font_loader.h b/src/common/font_loader.h index 3f4e5e36..4df115d5 100644 --- a/src/common/font_loader.h +++ b/src/common/font_loader.h @@ -28,10 +28,9 @@ #include "graphics/engine/text.h" -#include - #include #include +#include /** * \class CFontLoader @@ -57,5 +56,5 @@ public: std::optional GetFont(Gfx::FontType type) const; private: - boost::property_tree::ptree m_propertyTree; + std::unordered_map m_fonts; };