diff options
| author | Kaalleen <36401965+kaalleen@users.noreply.github.com> | 2020-05-16 23:01:00 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-16 23:01:00 +0200 |
| commit | a308db7ae152626c84ade069e307864a7e7e6213 (patch) | |
| tree | 3af8a13562021796743378d16a1e7cc725ac75e4 /lib/elements/text.py | |
| parent | 4e950332419743dcbaf661fdda1f7c7970241d93 (diff) | |
support svg objects (#643)
Diffstat (limited to 'lib/elements/text.py')
| -rw-r--r-- | lib/elements/text.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/elements/text.py b/lib/elements/text.py new file mode 100644 index 00000000..2d066bb0 --- /dev/null +++ b/lib/elements/text.py @@ -0,0 +1,32 @@ +from simpletransform import applyTransformToPoint + +from ..i18n import _ +from ..svg import get_node_transform +from .element import EmbroideryElement +from .validation import ObjectTypeWarning + + +class TextTypeWarning(ObjectTypeWarning): + name = _("Text") + description = _("Ink/Stitch cannot work with objects like text.") + steps_to_solve = [ + _('* Text: Create your own letters or try the lettering tool:'), + _('- Extensions > Ink/Stitch > Lettering') + ] + + +class TextObject(EmbroideryElement): + + def center(self): + point = [float(self.node.get('x', 0)), float(self.node.get('y', 0))] + + transform = get_node_transform(self.node) + applyTransformToPoint(transform, point) + + return point + + def validation_warnings(self): + yield TextTypeWarning(self.center()) + + def to_patches(self, last_patch): + return [] |
