diff options
author | crupest <crupest@outlook.com> | 2022-03-06 16:38:51 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2022-03-06 16:38:51 +0800 |
commit | 62a0c3f1785e789357c892d94b3ea0bc3ea6833e (patch) | |
tree | ebf1436b728ba62ed1251f04021da8ce839028eb /src/ui/mapper/style | |
parent | afc40737f2dc990f4805342e52e2be128f161808 (diff) | |
download | cru-62a0c3f1785e789357c892d94b3ea0bc3ea6833e.tar.gz cru-62a0c3f1785e789357c892d94b3ea0bc3ea6833e.tar.bz2 cru-62a0c3f1785e789357c892d94b3ea0bc3ea6833e.zip |
...
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 |