#include "SvgTextElement.h" #include "XmlAttribute.h" #include SvgTextElement::SvgTextElement() :SvgElement("text") { } void SvgTextElement::setLocation(const Point& loc) { auto x = std::make_unique("x"); auto y = std::make_unique("y"); x->setValue(std::to_string(loc.getX())); y->setValue(std::to_string(loc.getY())); addAttribute(std::move(x)); addAttribute(std::move(y)); } void SvgTextElement::setContent(const std::string& content) { setText(content); } void SvgTextElement::setFill(const Color& fill) { auto attr = std::make_unique("fill"); std::stringstream sstr; sstr << "rgb(" << fill.toString() << ")"; attr->setValue(sstr.str()); addAttribute(std::move(attr)); } void SvgTextElement::setFontFamily(const std::string& family) { auto attr = std::make_unique("font-family"); attr->setValue(family); addAttribute(std::move(attr)); } void SvgTextElement::setFontSize(float size) { auto attr = std::make_unique("font-size"); attr->setValue(std::to_string(size)); addAttribute(std::move(attr)); }