getting matplotlib to recognize a new font

Hi, All,

I am using matplotlib 1.2.0 under Windows 7 64-bit.

I am trying to get matplotlib to recognize a new font that I downloaded (Arimo, for the curious). I put the .ttf files in the matplotlib ttf font directory (…\fonts\ttf\ArimoRegularLatin.ttf, etc.), where Bitstream Vera Sans, STIX, etc. live. But matplotlib does
not recognize the new font, and defaults to Vera Sans. If I load the font_manager and do a findfont, it does not find the new font and defualts to Vera Sans.

I also tried putting the ttf files in the system font location, with the same results. When I do this, other programs like Word can see and use the font.

Is there some trick that I’m missing, here?

Thanks,

Chad

Most likely, you need to clear out matplotlib’s font cache. How to do that for windows, I don’t know, but for Linux, it is as simple as “rm ~/.matplotlib/fontList.cache”. Maybe there is a similar file somewhere on your system. After getting rid of that file, at the next import of matplotlib, it will recognize that that file is gone and rebuild it.

Cheers!
Ben

···

On Thu, Feb 28, 2013 at 8:40 AM, CAB <cabraut@…9…> wrote:

Hi, All,

I am using matplotlib 1.2.0 under Windows 7 64-bit.

I am trying to get matplotlib to recognize a new font that I downloaded (Arimo, for the curious). I put the .ttf files in the matplotlib ttf font directory (…\fonts\ttf\ArimoRegularLatin.ttf, etc.), where Bitstream Vera Sans, STIX, etc. live. But matplotlib does
not recognize the new font, and defaults to Vera Sans. If I load the font_manager and do a findfont, it does not find the new font and defualts to Vera Sans.

I also tried putting the ttf files in the system font location, with the same results. When I do this, other programs like Word can see and use the font.

Is there some trick that I’m missing, here?

Thanks,

Chad

That did it, Ben!

Many thanks,
Chad

···

From: Benjamin Root <ben.root@…1304…>
To: CAB <cabraut@…9…>
Cc: Matplotlib Users <matplotlib-users@…2569…sourceforge.net>
Sent: Thursday, February 28, 2013 8:19 AM
Subject: Re: [Matplotlib-users] getting matplotlib to recognize a new
font

On Thu, Feb 28, 2013 at 8:40 AM, CAB <cabraut@…9…> wrote:

Hi, All,

I am using matplotlib 1.2.0 under Windows 7 64-bit.

I am trying to get matplotlib to recognize a new font that I downloaded (Arimo, for the curious). I put the .ttf files in the matplotlib ttf font directory (…\fonts\ttf\ArimoRegularLatin.ttf, etc.), where Bitstream Vera Sans, STIX, etc. live. But matplotlib does
not recognize the new font, and defaults to Vera Sans. If I load the font_manager and do a findfont, it does not find the new font and defualts to Vera Sans.

I also tried putting the ttf files in the system font location, with the same results. When I do this, other programs like Word can see and use the font.

Is there some trick that I’m missing, here?

Thanks,

Chad

Most likely, you need to clear out matplotlib’s font cache. How to do that for windows, I don’t know, but for Linux, it is as simple as “rm ~/.matplotlib/fontList.cache”. Maybe there is a similar file somewhere on your system. After getting rid of that file, at the next import of matplotlib, it will recognize that that file is gone and rebuild it.

Cheers!
Ben