shrhdk / text-to-svg

Convert text to SVG path without native dependence.
Other
978 stars 132 forks source link

Outline text? #43

Open TimotheAlbouy opened 5 years ago

TimotheAlbouy commented 5 years ago

Is it possible to outline the text created with this module? For example, I would like to write text in white and outlined in black. This feature is possible with the vectorize-text module.

shrhdk commented 5 years ago

Will the image look like this?

image

If so, you can use attributes options like this.

textToSVG.getSVG('hello', {attributes: {fill: "white", stroke: "black"}});
TimotheAlbouy commented 5 years ago

Yes that's good, thank you very much! But the strokes are outside the edges of the letters or are they a bit inside?

shrhdk commented 5 years ago

@TimotheAlbouy

They are a bit inside.

If you want the stroke to be outside the edge, try the paint-order property.

https://www.oreilly.com/ideas/elegant-outlines-with-svg-paint-order