1
0
Fork 0
freesewing/sites/dev/docs/howtos/code/adding-text/readme.mdx

33 lines
1.1 KiB
Text
Raw Normal View History

---
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.
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
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
:::note
2024-01-07 17:07:26 +01:00
Refer to [the `insertText` hook](/reference/hooks/inserttext#notes) for details.
:::
2024-01-07 17:07:26 +01:00