void SVGAnalyzer::set_cy(double cy) { current_element().attributes.cy = cy; }
+void SVGAnalyzer::set_font_family(std::string_view font_family) {
+ current_element().attributes.font_family = font_family;
+}
+
void SVGAnalyzer::set_fill(std::string_view fill) {
current_element().attributes.fill = fill;
}
void on_exit_element() override;
void set_cx(double cx) override;
void set_cy(double cy) override;
+ void set_font_family(std::string_view font_family) override;
void set_fill(std::string_view fill) override;
void set_height(double height) override;
void set_id(std::string_view id) override;
virtual void set_class(std::string_view) = 0;
virtual void set_cx(double cx) = 0;
virtual void set_cy(double cy) = 0;
+ virtual void set_font_family(std::string_view font_family) = 0;
virtual void set_fill(std::string_view fill) = 0;
virtual void set_height(double height) = 0;
virtual void set_id(std::string_view id) = 0;
break;
case SVG::SVGElementType::Text:
attributes_str +=
- fmt::format(R"(text-anchor="{}" x="{}" y="{}")", attributes.text_anchor,
- attributes.x, attributes.y);
+ fmt::format(R"(text-anchor="{}" x="{}" y="{}" font-family="{}")",
+ attributes.text_anchor, attributes.x, attributes.y,
+ attributes.font_family);
break;
case SVG::SVGElementType::Title:
// Graphviz doesn't generate attributes on 'title' elements
double cx;
double cy;
std::string fill;
+ std::string font_family;
double height;
std::string id;
std::vector<SVGPoint> points;
m_svgAnalyzer->set_class({v.begin(), v.end()});
}
+void SvgppContext::set(svgpp::tag::attribute::font_family,
+ boost::iterator_range<const char *> v) {
+ m_svgAnalyzer->set_font_family({v.begin(), v.end()});
+}
+
void SvgppContext::set(svgpp::tag::attribute::text_anchor,
svgpp::tag::value::start) {
m_svgAnalyzer->set_text_anchor("start");
void set(svgpp::tag::attribute::id a, boost::iterator_range<const char *> v);
void set(svgpp::tag::attribute::class_ a,
boost::iterator_range<const char *> v);
+ void set(svgpp::tag::attribute::font_family a,
+ boost::iterator_range<const char *> v);
void set(svgpp::tag::attribute::text_anchor a, svgpp::tag::value::start v);
void set(svgpp::tag::attribute::text_anchor a, svgpp::tag::value::middle v);
void set(svgpp::tag::attribute::text_anchor a, svgpp::tag::value::end v);
svgpp::tag::attribute::cx, //
svgpp::tag::attribute::cy, //
svgpp::tag::attribute::fill, //
+ svgpp::tag::attribute::font_family, //
svgpp::tag::attribute::height, //
svgpp::tag::attribute::id, //
svgpp::tag::attribute::points, //
CHECK(recreated_svg.find("<text text-anchor=\"middle\" x=\"") !=
std::string::npos);
CHECK(recreated_svg.find("\" y=\"") != std::string::npos);
- CHECK(recreated_svg.find("a</text>") != std::string::npos);
- CHECK(recreated_svg.find("b</text>") != std::string::npos);
+ CHECK(recreated_svg.find(" font-family=\"Times,serif\">a</text>") !=
+ std::string::npos);
+ CHECK(recreated_svg.find(" font-family=\"Times,serif\">b</text>") !=
+ std::string::npos);
}
CHECK(recreated_svg.find("<path fill=\"none\" stroke=\"black\"/>") !=
std::string::npos);