Skip to content

Commit

Permalink
SVG Length or Width Zero, Disables Rendering.
Browse files Browse the repository at this point in the history
  • Loading branch information
tatarize committed Nov 26, 2020
1 parent b4d5c95 commit b503110
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions svgelements/svgelements.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def disable_numpy():
and the Arc can do exact arc calculations if scipy is installed.
"""

SVGELEMENTS_VERSION = "1.3.1"
SVGELEMENTS_VERSION = "1.3.2"

MIN_DEPTH = 5
ERROR = 1e-12
Expand Down Expand Up @@ -7125,7 +7125,13 @@ def parse(source,
s.render(ppi=ppi, width=width, height=height)

# viewbox was rendered here.
viewport_transform = s.viewbox.transform()
try:
viewport_transform = s.viewbox.transform()
except ZeroDivisionError:
# The width or height was zero.
# https://www.w3.org/TR/SVG11/struct.html#SVGElementWidthAttribute
# "A value of zero disables rendering of the element."
return s # No more parsing will be done.
if SVG_ATTR_TRANSFORM in values:
# transform on SVG element applied as if svg had parent with transform.
values[SVG_ATTR_TRANSFORM] += " " + viewport_transform
Expand Down

0 comments on commit b503110

Please sign in to comment.