1
0
Fork 0
freesewing/sites/dev/docs/howtos/code/adding-text
Joost De Cock ab3204f9f1 chore: Port FreeSewing.dev to docusaurus
The replaces the NextJS site powering FreeSewing.dev with a Docusaurus
setup. It's part of my efforts to simplify FreeSewing's setup so we can
focus on our core value proposition.
2024-09-28 13:13:48 +02:00
..
readme.mdx chore: Port FreeSewing.dev to docusaurus 2024-09-28 13:13:48 +02:00

---
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()](/reference/api/point/addtext) and
[Path.addText()](/reference/api/path/addtext) methods to let you add text to
points and paths.

In addition, [the `title` macro](/reference/macros/title) not only lets you add a
title to your part, it also allows you to add notes.

## Wrapping lines

SVG does not provide any line-wrapping, so you will need to be mindful of that when you add longer text.

To facilitate this, FreeSewing will enforce a line break when you use `\n` in your text.

## Translation

Text that is added to a pattern typically requires translation.
You should break up your text in such a way that it remains possible to translate it.

You can do that either via repeated calls to `addText()` or you can pass an array of strings, or even a nested array of strings, and FreeSewing will translate all individual pieces prior to concatenating them.

:::note

Refer to [the `insertText` hook](/reference/hooks/inserttext#notes) for details.
:::