Commit 5a15053b authored by Michael Buschbeck's avatar Michael Buschbeck

Fix <text> and <tspan> coordinate properties

Both "x" and "y" are full-fledged length values and can have a unit
attached to them; "px" is just the default if no unit is specified.
parent 4b1a1f5b
......@@ -80,8 +80,8 @@ class FlowSpan(ShapeElement):
class TextElement(ShapeElement):
"""A Text element"""
tag_name = 'text'
x = property(lambda self: float(self.get('x', 0)))
y = property(lambda self: float(self.get('y', 0)))
x = property(lambda self: convert_unit(self.get('x', 0), 'px'))
y = property(lambda self: convert_unit(self.get('y', 0), 'px'))
def get_path(self):
return Path()
......@@ -117,8 +117,8 @@ class TextPath(ShapeElement):
class Tspan(ShapeElement):
"""A tspan text element"""
tag_name = 'tspan'
x = property(lambda self: float(self.get('x', 0)))
y = property(lambda self: float(self.get('y', 0)))
x = property(lambda self: convert_unit(self.get('x', 0), 'px'))
y = property(lambda self: convert_unit(self.get('y', 0), 'px'))
@classmethod
def superscript(cls, text):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment