From 1f82fbf38fa4f7dbcfd3c13e4f815550e524af0b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20Wobst?= Date: Thu, 9 Mar 2006 16:10:19 +0000 Subject: [PATCH] issue a warning when the content exceeds the papersize git-svn-id: https://pyx.svn.sourceforge.net/svnroot/pyx/trunk/pyx@2572 069f4177-920e-0410-937b-c2a4a81bcd90 --- pyx/document.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pyx/document.py b/pyx/document.py index e414f0e9..7641b811 100644 --- a/pyx/document.py +++ b/pyx/document.py @@ -92,16 +92,18 @@ class page: if self.rotated: atrafo = trafo.rotate(90).translated(paperwidth, 0) if self.centered or self.fittosize: + if not self.fittosize and (bbox.height() > paperwidth or bbox.width() > paperheight): + warnings.warn("content exceeds the papersize") atrafo = atrafo.translated(-0.5*(paperwidth - bbox.height()) + bbox.bottom(), 0.5*(paperheight - bbox.width()) - bbox.left()) else: if self.centered or self.fittosize: - atrafo = trafo.trafo() + if not self.fittosize and (bbox.width() > paperwidth or bbox.height() > paperheight): + warnings.warn("content exceeds the papersize") + atrafo = trafo.translate(0.5*(paperwidth - bbox.width()) - bbox.left(), + 0.5*(paperheight - bbox.height()) - bbox.bottom()) else: return None # no page transformation needed - if self.centered or self.fittosize: - atrafo = atrafo.translated(0.5*(paperwidth - bbox.width()) - bbox.left(), - 0.5*(paperheight - bbox.height()) - bbox.bottom()) if self.fittosize: -- 2.11.4.GIT