From 7497a582840fa94415b56a8b45df593328d644ca Mon Sep 17 00:00:00 2001 From: Claudine Peyrat <88194877+claudinepeyrat06@users.noreply.github.com> Date: Sat, 26 Apr 2025 08:52:31 +0200 Subject: 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 --- lib/commands.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lib/commands.py') 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 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)) -- cgit v1.2.3