From f72987d69b053af82d70301ca90c0ed4b75a9c7b Mon Sep 17 00:00:00 2001 From: derVedro Date: Fri, 31 Mar 2017 00:17:59 +0200 Subject: [PATCH 1/3] fixed ignored height and width arguments issue #17 fix --- svgpathtools/paths2svg.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/svgpathtools/paths2svg.py b/svgpathtools/paths2svg.py index 4854d4e..7f61957 100644 --- a/svgpathtools/paths2svg.py +++ b/svgpathtools/paths2svg.py @@ -278,7 +278,9 @@ def disvg(paths=None, colors=None, # Create an SVG file if svg_attributes: - dwg = Drawing(filename=filename, **svg_attributes) + szx = svg_attributes.get("height", "100%") + szy = svg_attributes.get("width", "100%") + dwg = Drawing(filename=filename, size=(szx, szy), **svg_attributes) else: dwg = Drawing(filename=filename, size=(szx, szy), viewBox=viewbox) From 88185419f53ba112554d0176ac5c4b69f58cbaba Mon Sep 17 00:00:00 2001 From: derVedro Date: Fri, 31 Mar 2017 00:26:02 +0200 Subject: [PATCH 2/3] fliped width and height the x and y were swaped by my mistake --- svgpathtools/paths2svg.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/svgpathtools/paths2svg.py b/svgpathtools/paths2svg.py index 7f61957..492911f 100644 --- a/svgpathtools/paths2svg.py +++ b/svgpathtools/paths2svg.py @@ -278,8 +278,8 @@ def disvg(paths=None, colors=None, # Create an SVG file if svg_attributes: - szx = svg_attributes.get("height", "100%") - szy = svg_attributes.get("width", "100%") + szx = svg_attributes.get("width", "100%") + szy = svg_attributes.get("height", "100%") dwg = Drawing(filename=filename, size=(szx, szy), **svg_attributes) else: dwg = Drawing(filename=filename, size=(szx, szy), viewBox=viewbox) From d8dfbd01fc944777eff603ba458f165856261077 Mon Sep 17 00:00:00 2001 From: Andy Port Date: Thu, 6 Apr 2017 16:05:28 -0700 Subject: [PATCH 3/3] changed default (when svg_attributes doesn't have a height/width) to the szx and szy constructed from path bounding boxes @DerVedro was there a reason you thought the default should be 100% (beyond that being the current behavior -- which I see as a bug)? --- svgpathtools/paths2svg.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/svgpathtools/paths2svg.py b/svgpathtools/paths2svg.py index 492911f..935c5ec 100644 --- a/svgpathtools/paths2svg.py +++ b/svgpathtools/paths2svg.py @@ -278,8 +278,8 @@ def disvg(paths=None, colors=None, # Create an SVG file if svg_attributes: - szx = svg_attributes.get("width", "100%") - szy = svg_attributes.get("height", "100%") + szx = svg_attributes.get("width", szx) + szy = svg_attributes.get("height", szy) dwg = Drawing(filename=filename, size=(szx, szy), **svg_attributes) else: dwg = Drawing(filename=filename, size=(szx, szy), viewBox=viewbox)