diff --git a/src/libslic3r/SVG.cpp b/src/libslic3r/SVG.cpp index 6a743b1eb..4928d5433 100644 --- a/src/libslic3r/SVG.cpp +++ b/src/libslic3r/SVG.cpp @@ -274,26 +274,28 @@ std::string SVG::get_path_d(const ClipperLib::Path &path, double scale, bool clo return d.str(); } -void SVG::draw_text(const Point &pt, const char *text, const char *color) +void SVG::draw_text(const Point &pt, const char *text, const char *color, const coordf_t font_size) { fprintf(this->f, - "%s", - to_svg_x(pt(0)-origin(0)), - to_svg_y(pt(1)-origin(1)), + R"(%s)", + to_svg_x(float(pt.x() - origin.x())), + to_svg_y(float(pt.y() - origin.y())), + font_size, color, text); } -void SVG::draw_legend(const Point &pt, const char *text, const char *color) +void SVG::draw_legend(const Point &pt, const char *text, const char *color, const coordf_t font_size) { fprintf(this->f, - "", - to_svg_x(pt(0)-origin(0)), - to_svg_y(pt(1)-origin(1)), + R"()", + to_svg_x(float(pt.x() - origin.x())), + to_svg_y(float(pt.y() - origin.y())), color); fprintf(this->f, - "%s", - to_svg_x(pt(0)-origin(0)) + 20.f, - to_svg_y(pt(1)-origin(1)), + R"(%s)", + to_svg_x(float(pt.x() - origin.x())) + 20.f, + to_svg_y(float(pt.y() - origin.y())), + font_size, "black", text); } diff --git a/src/libslic3r/SVG.hpp b/src/libslic3r/SVG.hpp index 314fae9b9..3ff2213d8 100644 --- a/src/libslic3r/SVG.hpp +++ b/src/libslic3r/SVG.hpp @@ -72,8 +72,8 @@ public: void draw(const ClipperLib::Path &polygon, double scale, std::string fill = "grey", coordf_t stroke_width = 0); void draw(const ClipperLib::Paths &polygons, double scale, std::string fill = "grey", coordf_t stroke_width = 0); - void draw_text(const Point &pt, const char *text, const char *color); - void draw_legend(const Point &pt, const char *text, const char *color); + void draw_text(const Point &pt, const char *text, const char *color, coordf_t font_size = 20.f); + void draw_legend(const Point &pt, const char *text, const char *color, coordf_t font_size = 10.f); void Close();