aboutsummaryrefslogtreecommitdiff
path: root/src/ui/mapper/style/FontStylerMapper.cpp
blob: 3b1817acb15a383d2d87bfae95cf4c3ccee94992 (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({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