Cay anyone can provide some guidance on using system-installed fonts on Mac OS X?
I'm using the PDF backend in matplotlib 0.91.2 on 10.5 (leopard)'s native python 2.5 installed with easy_install. Things seem to be working well and with matplotlib.font_manager.OSXInstalledFonts() I can see that it seems to know what fonts I have on my system. I can even get it to find some of these fonts however any attempts to use them results in errors when writing out the figure (I've included some stack traces below).
Are there reasons to think another backend would work if PDF fails? Also, I'd be interested in an easy way to take a given font file and know whether it is of a type supported by MPL and what name I should give to MPL to find and use it.
Nick Matsakis
------ an error using /Library/Fonts/tahoma.ttf
Traceback (most recent call last):
...skipping some calls...
File "/Library/Python/2.5/site-packages/matplotlib-0.91.2-py2.5-macosx-10.5-ppc.egg/matplotlib/backend_bases.py",
line 1195, in print_figure
**kwargs)
File "/Library/Python/2.5/site-packages/matplotlib-0.91.2-py2.5-macosx-10.5-ppc.egg/matplotlib/backends/backend_pdf.py", line 1969, in print_pdf
file.close()
File "/Library/Python/2.5/site-packages/matplotlib-0.91.2-py2.5-macosx-10.5-ppc.egg/matplotlib/backends/backend_pdf.py", line 420, in close
self.writeFonts()
File "/Library/Python/2.5/site-packages/matplotlib-0.91.2-py2.5-macosx-10.5-ppc.egg/matplotlib/backends/backend_pdf.py", line 490, in writeFonts
fontdictObject = self.embedTTF(realpath, chars[1])
File "/Library/Python/2.5/site-packages/matplotlib-0.91.2-py2.5-macosx-10.5-ppc.egg/matplotlib/backends/backend_pdf.py", line 859, in embedTTF
ps_name = Name(font.get_sfnt()[(1,0,0,6)])
KeyError: (1, 0, 0, 6)
----- a different error using /System/Library/Fonts/AppleGothic.ttf
...skipping some calls...
File "/Library/Python/2.5/site-packages/matplotlib-0.91.2-py2.5-macosx-10.5-ppc.egg/matplotlib/backend_bases.py", line 1195, in print_figure
**kwargs)
File "/Library/Python/2.5/site-packages/matplotlib-0.91.2-py2.5-macosx-10.5-ppc.egg/matplotlib/backends/backend_pdf.py", line 1969, in print_pdf
file.close()
File "/Library/Python/2.5/site-packages/matplotlib-0.91.2-py2.5-macosx-10.5-ppc.egg/matplotlib/backends/backend_pdf.py", line 420, in close
self.writeFonts()
File "/Library/Python/2.5/site-packages/matplotlib-0.91.2-py2.5-macosx-10.5-ppc.egg/matplotlib/backends/backend_pdf.py", line 490, in writeFonts
fontdictObject = self.embedTTF(realpath, chars[1])
File "/Library/Python/2.5/site-packages/matplotlib-0.91.2-py2.5-macosx-10.5-ppc.egg/matplotlib/backends/backend_pdf.py", line 901, in embedTTF
return embedTTFType3(font, characters, descriptor)
File "/Library/Python/2.5/site-packages/matplotlib-0.91.2-py2.5-macosx-10.5-ppc.egg/matplotlib/backends/backend_pdf.py", line 689, in embedTTFType3
glyph_name = font.get_glyph_name(gind)
RuntimeError: Face has no glyph names