From be93c858a4b7bdd771521502c3c1195a01b32fbf Mon Sep 17 00:00:00 2001 From: Kaalleen <36401965+kaalleen@users.noreply.github.com> Date: Tue, 25 Jan 2022 16:41:30 +0100 Subject: markers and lettering (#1559) --- lib/lettering/font.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib/lettering') diff --git a/lib/lettering/font.py b/lib/lettering/font.py index 09b772c3..f0aac11e 100644 --- a/lib/lettering/font.py +++ b/lib/lettering/font.py @@ -15,6 +15,7 @@ from ..elements import nodes_to_elements from ..exceptions import InkstitchException from ..extensions.lettering_custom_font_dir import get_custom_font_dir from ..i18n import _, get_languages +from ..marker import MARKER, ensure_marker from ..stitches.auto_satin import auto_satin from ..svg.tags import (CONNECTION_END, CONNECTION_START, INKSCAPE_LABEL, SVG_PATH_TAG, SVG_USE_TAG, XLINK_HREF) @@ -218,7 +219,9 @@ class Font(object): style += inkex.Style("stroke-width:0.5px") element.set('style', '%s' % style.to_str()) + # make sure necessary marker and command symbols are in the defs section self._ensure_command_symbols(destination_group) + self._ensure_marker_symbols(destination_group) return destination_group @@ -336,6 +339,12 @@ class Font(object): for command in commands: ensure_symbol(group.getroottree().getroot(), command) + def _ensure_marker_symbols(self, group): + for marker in MARKER: + xpath = ".//*[contains(@style, 'marker-start:url(#inkstitch-%s-marker)')]" % marker + if group.xpath(xpath, namespaces=inkex.NSS): + ensure_marker(group.getroottree().getroot(), marker) + def _apply_auto_satin(self, group, trim): """Apply Auto-Satin to an SVG XML node tree with an svg:g at its root. -- cgit v1.2.3