diff options
| author | Claudine Peyrat <88194877+claudinepeyrat06@users.noreply.github.com> | 2025-07-20 07:07:42 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-20 07:07:42 +0200 |
| commit | 2a3963cb852e150d3d71da5d7ca02f0240e0bc5a (patch) | |
| tree | 5fe5cab0a86217b3b5ba2dfd28c7fb0e3ebce76f /lib/extensions | |
| parent | c0584c1c005e1a14227eee1eee1eedd769925d12 (diff) | |
Claudine/more help to add lock stitches in fonts (#3875)
* allow locks on last element of each group
* a layer is not a group
* Update lettering_force_lock_stitches.py
Diffstat (limited to 'lib/extensions')
| -rw-r--r-- | lib/extensions/lettering_force_lock_stitches.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/extensions/lettering_force_lock_stitches.py b/lib/extensions/lettering_force_lock_stitches.py index a04fac79..ee6accf6 100644 --- a/lib/extensions/lettering_force_lock_stitches.py +++ b/lib/extensions/lettering_force_lock_stitches.py @@ -10,7 +10,7 @@ from ..elements import iterate_nodes, nodes_to_elements from ..i18n import _ from ..marker import has_marker from ..svg import PIXELS_PER_MM -from ..svg.tags import EMBROIDERABLE_TAGS +from ..svg.tags import EMBROIDERABLE_TAGS, SVG_GROUP_TAG from .base import InkstitchExtension @@ -28,6 +28,7 @@ class LetteringForceLockStitches(InkstitchExtension): self.arg_parser.add_argument("-a", "--max_distance", type=float, default=3, dest="max_distance") self.arg_parser.add_argument("-i", "--min_distance", type=float, default=1, dest="min_distance") self.arg_parser.add_argument("-l", "--last_element", type=inkex.Boolean, dest="last_element") + self.arg_parser.add_argument("-g", "--last_group_element", type=inkex.Boolean, dest="last_group_element") def effect(self): if self.options.max_distance < self.options.min_distance: @@ -43,6 +44,8 @@ class LetteringForceLockStitches(InkstitchExtension): # Set glyph layers to be visible. We don't want them to be ignored by self.elements self._update_layer_visibility('inline') for layer in glyph_layers: + if uses_glyph_layers and self.options.last_group_element: + self._set_force_attribute_on_last_group_elements(layer) if uses_glyph_layers and self.options.last_element: self._set_force_attribute_on_last_elements(layer) if self.options.distance: @@ -52,6 +55,11 @@ class LetteringForceLockStitches(InkstitchExtension): # unhide glyph layers self._update_layer_visibility('none') + def _set_force_attribute_on_last_group_elements(self, layer): + group_nodes = list(layer.iterdescendants(SVG_GROUP_TAG)) + for group in group_nodes: + self._set_force_attribute_on_last_elements(group) + def _set_force_attribute_on_last_elements(self, layer): # find the last path that does not carry a marker or belongs to a visual command and add a trim there last_element = None |
