I have a path I've created in svgwrite and I want to have my text to be centered along that path.
It's confusing since the svgwrite API doesn't appear to offer any mechanism for doing so
I have a path I've created in svgwrite and I want to have my text to be centered along that path.
It's confusing since the svgwrite API doesn't appear to offer any mechanism for doing so
This leverages two passthrough parameters of the
TextPathYou need to set two parameters on the
TextPathconstructor:text_anchor="middle"to say that the text should be centered over the anchor pointstartOffset="50%"to use the halfway mark of the path as the text's anchor point. (Without this, it'll look like your text is still left-aligned and that the first half of it has been chopped off)Sample code:
Which creates