diff options
| author | Claudine Peyrat <88194877+claudinepeyrat06@users.noreply.github.com> | 2025-04-26 08:52:31 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-26 08:52:31 +0200 |
| commit | 7497a582840fa94415b56a8b45df593328d644ca (patch) | |
| tree | 6f88b587088d8a02f49ac90961f86ba3f87fb426 /lib/commands.py | |
| parent | 4cfb02c370e2f09d59658f652c4b15bd41d46d6e (diff) | |
Claudine/fix font sample (#3684)
* twist monicha
* Update lettering_font_sample.py
* better use default value
* and leave Monicha alone in this branch
* ensure command and marker symbols
---------
Co-authored-by: Kaalleen <reni@allenka.de>
Diffstat (limited to 'lib/commands.py')
| -rw-r--r-- | lib/commands.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/commands.py b/lib/commands.py index 24c045ee..37081f11 100644 --- a/lib/commands.py +++ b/lib/commands.py @@ -344,6 +344,19 @@ def ensure_symbol(svg, command) -> None: defs.append(symbol) +def ensure_command_symbols(group): + """Make sure all commands used in a svg group exist in the <svg:defs> tag""" + # collect commands + commands = set() + for element in group.iterdescendants(SVG_USE_TAG): + xlink = element.get(XLINK_HREF, ' ') + if xlink.startswith('#inkstitch_'): + commands.add(xlink[11:]) + # make sure all necessary command symbols are in the document + for command in commands: + ensure_symbol(group.getroottree().getroot(), command) + + def add_group(document, node, command): parent = node.getparent() description = _(get_command_description(command)) |
