1
0
Fork 0
freesewing/markdown/dev/howtos/code/adding-text/en.md

844 B

title
Adding text

SVG is pretty great, but its text handling leaves much to be desired.

To abstract away the intricacies of adding text to an SVG document, FreeSewing provides the Point.addText() and Path.addText() methods to let you add text to points and paths.

```design/src/part.mjs function draftPart = ({ Point, points, Path, paths, part }) {

points.demo = new Point(70,10) // highlight-start .addText('Text on a point', 'center') // highlight-end

paths.demo = new Path() .move(new Point(0,0)) .line(new Point(100, 40)) .addClass('note dotted stroke-sm') // highlight-start .addText('Text on a path', 'center') // highlight-end

return part }

</Example>