Revision: 6150
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6150&view=rev
Author: jouni
Date: 2008-10-05 10:14:42 +0000 (Sun, 05 Oct 2008)
Log Message:
-----------
Merged revisions 6149 via svnmerge from
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_91_maint
........
r6149 | jouni | 2008-10-05 13:02:16 +0300 (Sun, 05 Oct 2008) | 2 lines
Fix problem with AFM files that don't specify the font's full name or family
name
........
Modified Paths:
--------------
trunk/matplotlib/API_CHANGES
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/afm.py
Property Changed:
----------------
trunk/matplotlib/
Property changes on: trunk/matplotlib
___________________________________________________________________
Modified: svnmerge-integrated
- /branches/v0_91_maint:1-6073
+ /branches/v0_91_maint:1-6073,6149
Modified: trunk/matplotlib/API_CHANGES
===================================================================
--- trunk/matplotlib/API_CHANGES 2008-10-05 10:02:16 UTC (rev 6149)
+++ trunk/matplotlib/API_CHANGES 2008-10-05 10:14:42 UTC (rev 6150)
@@ -1,6 +1,10 @@
Changes for 0.98.x
==================
+
+* AFM.get_fullname() and get_familyname() no longer raise an
+ exception if the AFM file does not specify these optional attributes,
+ but returns a guess based on the required FontName attribute.
* Changed precision kwarg in spy; default is 0, and the string value
'present' is used for sparse arrays only to show filled locations.
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2008-10-05 10:02:16 UTC (rev 6149)
+++ trunk/matplotlib/CHANGELOG 2008-10-05 10:14:42 UTC (rev 6150)
@@ -1,3 +1,6 @@
+2008-10-05 Fix problem with AFM files that don't specify the font's
+ full name or family name. - JKS
+
2008-10-04 Added 'scilimits' kwarg to Axes.ticklabel_format() method,
for easy access to the set_powerlimits method of the
major ScalarFormatter. - EF
Modified: trunk/matplotlib/lib/matplotlib/afm.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/afm.py 2008-10-05 10:02:16 UTC (rev
6149)
+++ trunk/matplotlib/lib/matplotlib/afm.py 2008-10-05 10:14:42 UTC (rev
6150)
@@ -34,7 +34,7 @@
John D. Hunter <[EMAIL PROTECTED]>
"""
-import sys, os
+import sys, os, re
from _mathtext_data import uni2type1
#Convert string the a python type
@@ -433,12 +433,22 @@
def get_fullname(self):
"Return the font full name, eg, 'Times-Roman'"
- return self._header['FullName']
+ name = self._header.get('FullName')
+ if name is None: # use FontName as a substitute
+ name = self._header['FontName']
+ return name
def get_familyname(self):
"Return the font family name, eg, 'Times'"
- return self._header['FamilyName']
+ name = self._header.get('FamilyName')
+ if name is not None:
+ return name
+ # FamilyName not specified so we'll make a guess
+ name = self.get_fullname()
+ extras = r'(?i)([
-](regular|plain|italic|oblique|bold|semibold|light|ultralight|extra|condensed))+$'
+ return re.sub(extras, '', name)
+
def get_weight(self):
"Return the font weight, eg, 'Bold' or 'Roman'"
return self._header['Weight']
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins