[EMAIL PROTECTED] (Berthold
Höllmann) writes:
> (Pdb) print self._header
> {'Notice': 'Copyright (c) 1999 Ministry of Education, Taipei, Taiwan. All
> Rights Reserved.', 'Ascender': 880.0, 'FontBBox': [-123, -250, 1000, 880],
> 'Weight': 'Regular', 'Descender': -250.0, 'CharacterSet': 'Adobe-CNS1-0',
> 'IsFixedPitch': False, 'FontName': 'MOEKai-Regular', 'StartFontMetrics':
> 4.0999999999999996, 'CapHeight': 880.0, 'Version': '1.000',
> 'UnderlinePosition': -100, 'Characters': 13699, 'UnderlineThickness': 50,
> 'ItalicAngle': 0.0, 'StartCharMetrics': 13699}
That AFM file doesn't include a family name or a full name for the font
it describes. It seems that both are in fact optional attributes. I have
committed a change (on the trunk, and in the maintenance branch) that
should fix this, but since I don't have any AFM files like this, I can't
check that it works. Can you check out either the trunk or the
maintenance branch from Subversion, or apply the following patch and try
again?
--
Jouni K. Seppänen
http://www.iki.fi/jks
Index: lib/matplotlib/afm.py
===================================================================
--- lib/matplotlib/afm.py (revision 6149)
+++ lib/matplotlib/afm.py (revision 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 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-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users