- Howtos
- Common code challenges
- Adding text
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.
mjs
design/src/part
function draftPart = ({
Point,
points,
Path,
paths,
part
}) {
points.demo = new Point(70,10)
.addText('Text on a point', 'center')
paths.demo = new Path()
.move(new Point(0,0))
.line(new Point(100, 40))
.addClass('note dotted stroke-sm')
.addText('Text on a path', 'center')
return part
}