From 2f35a4a192eb6aa3b68b715da6c1ba984084e0e5 Mon Sep 17 00:00:00 2001 From: Kaalleen <36401965+kaalleen@users.noreply.github.com> Date: Sun, 25 Jul 2021 07:24:34 +0200 Subject: Fix Style Issues (#1154) Co-authored-by: Lex Neva --- lib/lettering/font.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'lib/lettering/font.py') diff --git a/lib/lettering/font.py b/lib/lettering/font.py index d241bf05..cbd8f257 100644 --- a/lib/lettering/font.py +++ b/lib/lettering/font.py @@ -7,16 +7,15 @@ import json import os from copy import deepcopy -from inkex import styles -from lxml import etree +import inkex +from .font_variant import FontVariant from ..elements import nodes_to_elements from ..exceptions import InkstitchException from ..i18n import _, get_languages from ..stitches.auto_satin import auto_satin -from ..svg.tags import INKSCAPE_LABEL, SVG_GROUP_TAG, SVG_PATH_TAG +from ..svg.tags import INKSCAPE_LABEL, SVG_PATH_TAG from ..utils import Point -from .font_variant import FontVariant class FontError(InkstitchException): @@ -190,7 +189,7 @@ class Font(object): for element in destination_group.iterdescendants(SVG_PATH_TAG): dash_array = "" stroke_width = "" - style = styles.Style(element.get('style')) + style = inkex.styles.Style(element.get('style')) if style.get('fill') == 'none': stroke_width = ";stroke-width:1px" @@ -224,7 +223,7 @@ class Font(object): An svg:g element containing the rendered text. """ - group = etree.Element(SVG_GROUP_TAG, { + group = inkex.Group(attrib={ INKSCAPE_LABEL: line }) -- cgit v1.2.3 From 37c76aafba1f1f48cdcc69f3410abd719f5076f1 Mon Sep 17 00:00:00 2001 From: Kaalleen <36401965+kaalleen@users.noreply.github.com> Date: Mon, 26 Jul 2021 18:54:38 +0200 Subject: mark custom fonts (#1159) --- lib/lettering/font.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'lib/lettering/font.py') diff --git a/lib/lettering/font.py b/lib/lettering/font.py index cbd8f257..81044853 100644 --- a/lib/lettering/font.py +++ b/lib/lettering/font.py @@ -9,13 +9,14 @@ from copy import deepcopy import inkex -from .font_variant import FontVariant 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 ..stitches.auto_satin import auto_satin from ..svg.tags import INKSCAPE_LABEL, SVG_PATH_TAG from ..utils import Point +from .font_variant import FontVariant class FontError(InkstitchException): @@ -157,6 +158,23 @@ class Font(object): raise FontError(_("The font '%s' has no variants.") % self.name) return font_variants + @property + def marked_custom_font_id(self): + if not self.is_custom_font(): + return self.id + else: + return self.id + '*' + + @property + def marked_custom_font_name(self): + if not self.is_custom_font(): + return self.name + else: + return self.name + '*' + + def is_custom_font(self): + return get_custom_font_dir() in self.path + def render_text(self, text, destination_group, variant=None, back_and_forth=True, trim=False): """Render text into an SVG group element.""" self._load_variants() -- cgit v1.2.3 From e6fad808e9459ed6211c5ee04f3f1a00b786fa7a Mon Sep 17 00:00:00 2001 From: luzpaz Date: Thu, 29 Jul 2021 14:52:44 -0400 Subject: Fix typos (#1291) --- lib/lettering/font.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/lettering/font.py') diff --git a/lib/lettering/font.py b/lib/lettering/font.py index 81044853..ff726a56 100644 --- a/lib/lettering/font.py +++ b/lib/lettering/font.py @@ -114,7 +114,7 @@ class Font(object): min_scale = font_metadata('min_scale', 1.0) max_scale = font_metadata('max_scale', 1.0) - # use values from SVG Font, exemple: + # use values from SVG Font, example: # ... .... /> # Example font.json : "horiz_adv_x": {"A":49}, -- cgit v1.2.3