2021-10-17 18:26:00 +02:00
---
2021-08-25 16:09:31 +02:00
title: Adding text
2021-10-17 18:26:00 +02:00
---
2021-08-25 16:09:31 +02:00
SVG is pretty great, but its text handling leaves much to be desired.
2022-10-12 14:42:45 +02:00
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.
2024-01-07 17:07:26 +01:00
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
2024-09-28 13:13:48 +02:00
Text that is added to a pattern typically requires translation.
2024-01-07 17:07:26 +01:00
You should break up your text in such a way that it remains possible to translate it.
2024-01-21 11:16:40 -08:00
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.
2024-01-07 17:07:26 +01:00
2024-09-28 13:13:48 +02:00
:::note
2024-01-07 17:07:26 +01:00
Refer to [the `insertText` hook](/reference/hooks/inserttext#notes) for details.
2024-09-28 13:13:48 +02:00
:::
2024-01-07 17:07:26 +01:00