Skip to content

Commit

Permalink
SvgTextBuilderでanchorを設定できるように
Browse files Browse the repository at this point in the history
  • Loading branch information
HansRobo committed Jan 27, 2025
1 parent a3c2860 commit f168162
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,8 @@ struct SvgTextBuilder

bool view_box_position = false;

std::string anchor = "start";

SvgTextBuilder() {}

std::string getSvgString() const
Expand All @@ -242,7 +244,7 @@ struct SvgTextBuilder
oss << "x=\"" << text_position.x() * 1000. << "\" y=\"" << text_position.y() * 1000. << "\" ";
}
oss << "\" fill=\"" << fill_color << "\" fill-opacity=\"" << fill_opacity << "\" font-size=\""
<< font_size << "\">" << text_string << "</text>";
<< font_size << "\" text-anchor=\"" << anchor << "\">" << text_string << "</text>";
return oss.str();
}

Expand Down Expand Up @@ -282,6 +284,12 @@ struct SvgTextBuilder
font_size = size;
return *this;
}

SvgTextBuilder & textAnchor(const std::string & anchor)
{
this->anchor = anchor;
return *this;
}
};

struct SvgPolyLineBuilder
Expand Down

0 comments on commit f168162

Please sign in to comment.