summaryrefslogtreecommitdiff
path: root/lib/svg/units.py
diff options
context:
space:
mode:
authorKaalleen <36401965+kaalleen@users.noreply.github.com>2019-07-28 10:02:28 +0200
committerGitHub <noreply@github.com>2019-07-28 10:02:28 +0200
commitd5e873f8c50789b94e24d27a30c72f65ba9c08a3 (patch)
treeffa31c0f808f67857cdf7f86ecd2a9da41590a06 /lib/svg/units.py
parent833a8a971d8a73fbc42468a89d083e37a0bd6d8d (diff)
parente81e819602a3823ec344d412ba2e5213349fb2c4 (diff)
Merge pull request #481
show various bugs the door
Diffstat (limited to 'lib/svg/units.py')
-rw-r--r--lib/svg/units.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/svg/units.py b/lib/svg/units.py
index 0de410ab..739dcbb4 100644
--- a/lib/svg/units.py
+++ b/lib/svg/units.py
@@ -1,7 +1,8 @@
import simpletransform
-from ..utils import cache
from ..i18n import _
+from ..utils import cache
+
# modern versions of Inkscape use 96 pixels per inch as per the CSS standard
PIXELS_PER_MM = 96 / 25.4
@@ -91,6 +92,15 @@ def get_doc_size(svg):
width = svg.get('width')
height = svg.get('height')
+ if width == "100%" and height == "100%":
+ # Some SVG editors set width and height to "100%". I can't find any
+ # solid documentation on how one is supposed to interpret that, so
+ # just ignore it and use the viewBox. That seems to have the intended
+ # result anyway.
+
+ width = None
+ height = None
+
if width is None or height is None:
# fall back to the dimensions from the viewBox
viewbox = get_viewbox(svg)