|
From: <jo...@us...> - 2009-09-20 12:30:39
|
Revision: 7794
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7794&view=rev
Author: jouni
Date: 2009-09-20 12:30:22 +0000 (Sun, 20 Sep 2009)
Log Message:
-----------
Prevent exception in case of missing height and depth information in a TeX font
Modified Paths:
--------------
branches/v0_99_maint/CHANGELOG
branches/v0_99_maint/lib/matplotlib/dviread.py
Modified: branches/v0_99_maint/CHANGELOG
===================================================================
--- branches/v0_99_maint/CHANGELOG 2009-09-19 23:49:24 UTC (rev 7793)
+++ branches/v0_99_maint/CHANGELOG 2009-09-20 12:30:22 UTC (rev 7794)
@@ -1,3 +1,7 @@
+2009-09-20 Prevent exception in case of missing height and depth information
+ in a TeX font - this doesn't make the typesetting right, but prevents
+ the crash - JKS
+
2009-09-15 Don't fail on AFM files containing floating-point bounding boxes - JKS
2009-08-06 Tagging the 0.99.0 release at svn r7397 - JDH
Modified: branches/v0_99_maint/lib/matplotlib/dviread.py
===================================================================
--- branches/v0_99_maint/lib/matplotlib/dviread.py 2009-09-19 23:49:24 UTC (rev 7793)
+++ branches/v0_99_maint/lib/matplotlib/dviread.py 2009-09-20 12:30:22 UTC (rev 7794)
@@ -88,8 +88,7 @@
e = 0 # zero depth
else: # glyph
x,y,font,g,w = elt
- h = _mul2012(font._scale, font._tfm.height[g])
- e = _mul2012(font._scale, font._tfm.depth[g])
+ h,e = font._height_depth_of(g)
minx = min(minx, x)
miny = min(miny, y - h)
maxx = max(maxx, x + w)
@@ -443,6 +442,24 @@
'debug')
return 0
+ def _height_depth_of(self, char):
+ """
+ Height and depth of char in dvi units. For internal use by dviread.py.
+ """
+
+ result = []
+ for metric,name in ((self._tfm.height, "height"),
+ (self._tfm.depth, "depth")):
+ value = metric.get(char, None)
+ if value is None:
+ matplotlib.verbose.report(
+ 'No %s for char %d in font %s' % (name, char, self.texname),
+ 'debug')
+ result.append(0)
+ else:
+ result.append(_mul2012(value, self._scale))
+ return result
+
class Vf(Dvi):
"""
A virtual font (\*.vf file) containing subroutines for dvi files.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|