diff options
| author | Lex Neva <github.com@lexneva.name> | 2019-06-22 18:10:05 -0400 |
|---|---|---|
| committer | Lex Neva <github.com@lexneva.name> | 2019-06-22 18:13:05 -0400 |
| commit | 46fc95eea5d7fe0fa496744b69042d6dc66ca34a (patch) | |
| tree | 9115dac4096463a372507e212ae5a500c3d3f7b1 /lib | |
| parent | e8bd745dfca8c40c0e688c31cec1b09f1cfc65d2 (diff) | |
handle document width/height of 100% (fixes #476)
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/svg/units.py | 12 |
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) |
