diff options
Diffstat (limited to 'src/ui/mapper/style')
-rw-r--r-- | src/ui/mapper/style/FontStylerMapper.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/ui/mapper/style/FontStylerMapper.cpp b/src/ui/mapper/style/FontStylerMapper.cpp new file mode 100644 index 00000000..884832ee --- /dev/null +++ b/src/ui/mapper/style/FontStylerMapper.cpp @@ -0,0 +1,25 @@ +#include "cru/ui/mapper/style/FontStylerMapper.h" +#include "cru/common/ClonablePtr.h" +#include "cru/ui/mapper/MapperRegistry.h" + +namespace cru::ui::mapper::style { +FontStylerMapper::FontStylerMapper() { SetAllowedTags({u"FontStyler"}); } + +FontStylerMapper::~FontStylerMapper() {} + +ClonablePtr<ui::style::FontStyler> FontStylerMapper::DoMapFromXml( + xml::XmlElementNode* node) { + auto font_mapper = MapperRegistry::GetInstance() + ->GetSharedPtrMapper<platform::graphics::IFont>(); + + std::shared_ptr<platform::graphics::IFont> font; + + for (auto child_node : node->GetChildren()) { + if (child_node->IsElementNode()) { + font = font_mapper->MapFromXml(child_node->AsElement()); + } + } + + return ui::style::FontStyler::Create(std::move(font)); +} +} // namespace cru::ui::mapper::style |