summaryrefslogtreecommitdiff
path: root/lib/extensions/lettering_along_path.py
diff options
context:
space:
mode:
authorKaalleen <36401965+kaalleen@users.noreply.github.com>2025-10-27 18:09:21 +0100
committerGitHub <noreply@github.com>2025-10-27 18:09:21 +0100
commit6f282829537b69b8628b901cc717f18222ff33a0 (patch)
treed703e389a395f021836816ef1e0e5fe509474fc8 /lib/extensions/lettering_along_path.py
parente8859c4e14984bcdb3dd6d3c9bfed05cd233251c (diff)
Lettering: add spacing options (#4020)
Diffstat (limited to 'lib/extensions/lettering_along_path.py')
-rw-r--r--lib/extensions/lettering_along_path.py25
1 files changed, 18 insertions, 7 deletions
diff --git a/lib/extensions/lettering_along_path.py b/lib/extensions/lettering_along_path.py
index 6f1ca7a6..4afc4416 100644
--- a/lib/extensions/lettering_along_path.py
+++ b/lib/extensions/lettering_along_path.py
@@ -72,11 +72,7 @@ class TextAlongPath:
self.text = text
self.path = Stroke(path).as_multi_line_string().geoms[0]
self.text_position = text_position
-
- self.glyphs = [glyph for glyph in self.text.iterdescendants(SVG_GROUP_TAG) if glyph.get('inkstitch:letter-group', '') == 'glyph']
- if not self.glyphs:
- errormsg(_("The text doesn't contain any glyphs."))
- return
+ self.glyphs = []
self.load_settings()
self.font = get_font_by_id(self.settings.font, False)
@@ -87,6 +83,10 @@ class TextAlongPath:
self.font_scale = self.settings.scale / 100
self._reset_glyph_transforms()
+ if not self.glyphs:
+ errormsg(_("The text doesn't contain any glyphs."))
+ return
+
hidden_commands = self.hide_commands()
self.glyphs_along_path()
self.restore_commands(hidden_commands)
@@ -109,8 +109,14 @@ class TextAlongPath:
None, # we don't know the font variant (?)
self.settings.back_and_forth,
self.settings.trim_option,
- self.settings.use_trim_symbols
+ self.settings.use_trim_symbols,
+ 0, # color sort breaks the glyph structure needed for this method
+ self.settings.text_align,
+ self.settings.letter_spacing,
+ self.settings.word_spacing,
+ self.settings.line_height
)
+
self.glyphs = [glyph for glyph in rendered_text.iterdescendants(SVG_GROUP_TAG) if glyph.get('inkstitch:letter-group', '') == 'glyph']
self.bake_transforms_recursively(text_group)
@@ -230,7 +236,12 @@ class TextAlongPath:
"font": None,
"scale": 100,
"trim_option": 0,
- "use_trim_symbols": False
+ "use_trim_symbols": False,
+ "color_sort": 0,
+ "text_align": 0,
+ "letter_spacing": 0,
+ "word_spacing": 0,
+ "line_height": 0
})
if INKSTITCH_LETTERING in self.text.attrib: