From 43c34e6a4202cb61f466d45eccf0f4d0fabac278 Mon Sep 17 00:00:00 2001 From: Florian Festi Date: Wed, 22 Jun 2016 10:47:47 +0200 Subject: [PATCH] Fix start of viewport to x=0 as we do not have the place to write a different value anyway. This fixes the scaling in x direction: gh#7 --- boxes/svgutil.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/boxes/svgutil.py b/boxes/svgutil.py index c628f87..2cdbc66 100755 --- a/boxes/svgutil.py +++ b/boxes/svgutil.py @@ -69,7 +69,12 @@ class SVGFile(object): m = re.search(r"""]*width="(\d+pt)" height="(\d+pt)" viewBox="0 (0 (\d+) (\d+))" version="1.1">""", s) - minx = 10*int(self.minx//10)-10 + #minx = 10*int(self.minx//10)-10 + # as we don't rewrite the left border keep it as 0 + if 0 <= self.minx <= 50: + minx = 0 + else: + raise ValueError("Left end of drawing at wrong place: %imm (0-50mm expected)" % self.minx) maxx = 10*int(self.maxx//10)+10 miny = 10*int(self.miny//10)-10 maxy = 10*int(self.maxy//10)+10