matplotlib svn bug: "Found an unknown keyword in AFM header..."?

Eric Firing <efiring@...202...> writes:

I think that the problem is occurring in the last line. This remains to
be verified. It looks like *.afm files are being found, but when
createFontDict tries to parse them it doesn't find what it expects.

The cause of the problem is a combination of two things: first, for
some reason the afmfiles list contains non-AFM files, which is probably
a bug; second, the AFM parser doesn't quit when faced with a malformed
file. I committed a sanity check (diff attached) in afm.py to fix the
second problem, but the first one remains.

···

--
Jouni K. Sepp�nen

Hi-

I admit I don't understand the problems or the speccific code involved, but I *think* it may be that the OSX-specific code isn't restricted to afm files. Hence I wonder if the following is a fix:

% svn diff lib/matplotlib/font_manager.py
Index: lib/matplotlib/font_manager.py

···

===================================================================
--- lib/matplotlib/font_manager.py (revision 3727)
+++ lib/matplotlib/font_manager.py (working copy)
@@ -229,7 +229,7 @@
              fontpaths = x11FontDirectory()
              # check for OS X & load its fonts if present
              if sys.platform == 'darwin':
- for f in OSXInstalledFonts():
+ for f in OSXInstalledFonts(fontext=fontext):
                      fontfiles[f] = 1

              for f in get_fontconfig_fonts(fontext):

It would be great if someone could confirm this and submit to svn.

Andrew

Jouni K. Sepp�nen wrote:

Eric Firing <efiring@...202...> writes:

I think that the problem is occurring in the last line. This remains to be verified. It looks like *.afm files are being found, but when createFontDict tries to parse them it doesn't find what it expects.

The cause of the problem is a combination of two things: first, for some reason the afmfiles list contains non-AFM files, which is probably a bug; second, the AFM parser doesn't quit when faced with a malformed
file. I committed a sanity check (diff attached) in afm.py to fix the second problem, but the first one remains.