From feaa9c40e8cfd0f829c0d26f5cdeff268d0edaef Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20Wobst?= Date: Thu, 16 Jun 2011 22:01:19 +0000 Subject: [PATCH] calculcate bbox from path to allow Type1 font usage without TeX and without AFM font metric git-svn-id: https://pyx.svn.sourceforge.net/svnroot/pyx/trunk/pyx@3168 069f4177-920e-0410-937b-c2a4a81bcd90 --- CHANGES | 1 + pyx/font/font.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index c43a2a6a..fbedef8b 100644 --- a/CHANGES +++ b/CHANGES @@ -97,6 +97,7 @@ TODO: - type 1 font modules: - allow font slanting for T1builtinfont instances - improve stripped font compatibility + - allow Type1 font usage without TeX and without AFM font metric - epsfile module: - fix raise condition while generating bitmap for PDF inclusion diff --git a/pyx/font/font.py b/pyx/font/font.py index cd943d01..8938f09b 100644 --- a/pyx/font/font.py +++ b/pyx/font/font.py @@ -21,6 +21,7 @@ # along with PyX; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA +import warnings from pyx import bbox, canvasitem, deco, path, pswriter, pdfwriter, trafo, unit import t1file @@ -390,7 +391,8 @@ class T1text_pt(text_pt): def bbox(self): if self.font.metric is None: - raise ValueError("metric missing") + warnings.warn("We are about to extract the text bounding box information by calculating the path of the text. This is slow. You should provide an afm file whenever possible.") + return self.textpath().bbox() if not self.decode: raise ValueError("decoding required for font metric access (bbox)") return bbox.bbox_pt(self.x_pt, -- 2.11.4.GIT