aboutsummaryrefslogtreecommitdiff
path: root/src/ui/mapper/style/FontStylerMapper.cpp
blob: 1555c07102ef4143260a8350dc245089e6efcc3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include "cru/ui/mapper/style/FontStylerMapper.h"
#include "cru/base/ClonablePtr.h"
#include "cru/ui/mapper/MapperRegistry.h"

namespace cru::ui::mapper::style {
FontStylerMapper::FontStylerMapper() { SetAllowedTags({"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