From 492e7fb4dd3087c9feb9edd62ceec9a8e4b75a3c Mon Sep 17 00:00:00 2001 From: Florian Festi Date: Mon, 6 Apr 2020 19:57:24 +0200 Subject: [PATCH] SVGSurface: Use horizontal and vertial lines instead for just regular lines. This saves one number per point involved. --- boxes/drawing.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/boxes/drawing.py b/boxes/drawing.py index 4154c07..280e301 100644 --- a/boxes/drawing.py +++ b/boxes/drawing.py @@ -455,7 +455,12 @@ Creation date: {date} if C == "M": p.append(f"M {x:.3f} {y:.3f}") elif C == "L": - p.append(f"L {x:.3f} {y:.3f}") + if abs(x - x0) < EPS: + p.append(f"V {y:.3f}") + elif abs(y - y0) < EPS: + p.append(f"H {x:.3f}") + else: + p.append(f"L {x:.3f} {y:.3f}") elif C == "C": x1, y1, x2, y2 = c[3:] p.append(