summaryrefslogtreecommitdiff
path: root/lib/extensions
diff options
context:
space:
mode:
authorKaalleen <36401965+kaalleen@users.noreply.github.com>2024-07-02 15:32:05 +0200
committerGitHub <noreply@github.com>2024-07-02 15:32:05 +0200
commitb3b7023cb84d17682ffd587d23d929a7c9bc5fde (patch)
treebeab6a6bbeec2b9d43f5b15232aa030f13a8ffa3 /lib/extensions
parent4934893f4e2d2c98ed0fcea8969363d442260f71 (diff)
fix split text (#3037)
Diffstat (limited to 'lib/extensions')
-rw-r--r--lib/extensions/palette_split_text.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/extensions/palette_split_text.py b/lib/extensions/palette_split_text.py
index 67549f4f..a866f09b 100644
--- a/lib/extensions/palette_split_text.py
+++ b/lib/extensions/palette_split_text.py
@@ -3,6 +3,7 @@
# Copyright (c) 2022 Authors
# Licensed under the GNU GPL version 3.0 or later. See the file LICENSE for details.
+from re import findall
from tempfile import TemporaryDirectory
import inkex
@@ -38,8 +39,10 @@ class PaletteSplitText(InkstitchExtension):
with TemporaryDirectory(prefix="inkscape-command") as tmpdir:
svg_file = inkex.command.write_svg(text.root, tmpdir, "input.svg")
bbox = inkscape(svg_file, "-X", "-Y", "-W", "-H", query_id=text.get_id())
- bbox = list(map(text.root.viewport_to_unit, bbox.splitlines()))
- bbox = inkex.BoundingBox.new_xywh(*bbox[1:])
+ # output can contain other information, so let's filter out the requested numbers
+ bbox = findall(r"(?m)^-?\d+\.?\d*$", bbox)
+ bbox = list(map(text.root.viewport_to_unit, bbox))
+ bbox = inkex.BoundingBox.new_xywh(*bbox)
x = bbox.left
y = bbox.bottom