Skip to content

Commit

Permalink
Merge pull request #158 from meerk40t/issue_157
Browse files Browse the repository at this point in the history
Issue #157 Correction
  • Loading branch information
tatarize authored Jan 5, 2022
2 parents 57b8bda + dc61349 commit 3904f8c
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = svgelements
version = 1.6.5
version = 1.6.6
description = Svg Elements Parsing
long_description_content_type=text/markdown
long_description = file: README.md
Expand Down
4 changes: 3 additions & 1 deletion svgelements/svgelements.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
and the Arc can do exact arc calculations if scipy is installed.
"""

SVGELEMENTS_VERSION = "1.6.5"
SVGELEMENTS_VERSION = "1.6.6"

MIN_DEPTH = 5
ERROR = 1e-12
Expand Down Expand Up @@ -7834,6 +7834,7 @@ def parse_font_weight(self, weight):
def property_by_values(self, values):
Transformable.property_by_values(self, values)
GraphicObject.property_by_values(self, values)
SVGElement.property_by_values(self, values)
self.anchor = values.get(SVG_ATTR_TEXT_ANCHOR, self.anchor)
self.font_face = values.get("font_face")
self.font_face = values.get(SVG_ATTR_FONT_FACE, self.font_face)
Expand Down Expand Up @@ -8080,6 +8081,7 @@ def property_by_values(self, values):
def render(self, **kwargs):
GraphicObject.render(self, **kwargs)
Transformable.render(self, **kwargs)
SVGElements.render(self, **kwargs)
width = kwargs.get("width", kwargs.get("relative_length"))
height = kwargs.get("height", kwargs.get("relative_length"))
try:
Expand Down
26 changes: 26 additions & 0 deletions test/test_text.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import io
import unittest

from svgelements import *


class TestElementText(unittest.TestCase):

def test_issue_157(self):
q = io.StringIO(u'''<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg>
<g id="layer1">
<text
style="font-size:18px;line-height:1.25;font-family:sans-serif;stroke-width:0.264583"
id="textobject"><tspan
id="tspanobject"
x="0"
y="0">Test</tspan></text>
</g>
</svg>
''')
m = SVG.parse(q)
q = list(m.elements())
self.assertIsNotNone(q[1].id) # Group
self.assertIsNotNone(q[2].id) # Text
self.assertIsNotNone(q[3].id) # TSpan

0 comments on commit 3904f8c

Please sign in to comment.