From 987d51a73b4397de6cdc19e573372126bef8a733 Mon Sep 17 00:00:00 2001 From: Florian Festi Date: Tue, 25 Jun 2013 19:45:09 +0200 Subject: [PATCH] Fix scaling --- boxes.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/boxes.py b/boxes.py index da1ed2a..317de4a 100755 --- a/boxes.py +++ b/boxes.py @@ -76,10 +76,13 @@ class Boxes: self._init_surface(width, height) def _init_surface(self, width, height): + mm2pt = 90 / 25.4 / 1.25 + width *= mm2pt + height *= 3.543307 self.surface = cairo.SVGSurface(self.output, width, height) self.ctx = ctx = cairo.Context(self.surface) ctx.translate(0, height) - ctx.scale(1, -1) + ctx.scale(mm2pt, -mm2pt) ctx.set_source_rgb(1.0, 1.0, 1.0) ctx.rectangle(0, 0, width, height)