Font problem

Hi,

congratulations on releasing 0.98.4. I especially like the new improved possibilities for legends.

I'm trying to understand how to change fonts. But I'm not very successful. I use python 2.5 on windows xp with the latest 0.98.4 of matplotlib.

I want to create plots that work well with a manuscript in LaTeX using the IEEE template. Using that template the regular text comes out in Nimbus Roman No 9L, but I can't get matplotlib to use that font.

Using the attached script (with default matplotlibrc) I end up with BitstreamVeraSerif-Roman in the resulting pdf. So it seems only Vera is recognized. In the attached file 'log.txt' is the output from running the script with verbose.level=debug.

From the log it seems the pdfcorefonts are not on the fontpath. But still Times New Roman and palatino both are available in the system font directory as ttf fonts.

Any ideas on how to fix this

/Jörgen

fonts_problem.py (960 Bytes)

log.txt (35.8 KB)

Unfortunately, I think this is a bug. The ordering of fonts in the family list is being ignored, and Bitstream Vera Sans is winning over Nimbus Roman for reasons other than its name. I'll have to get this patch in for the bugfix release we're already planning.

As a workaround, try putting only "Nimbus Roman No9 L" as the only font in the list. Does that help?

Also, I don't see the Nimbus Roman font file (n021003l.ttf) anywhere in the debugging output. Are you sure it's in C:\Windows\Fonts ?

Mike

J�rgen Stenarson wrote:

···

Hi,

congratulations on releasing 0.98.4. I especially like the new improved possibilities for legends.

I'm trying to understand how to change fonts. But I'm not very successful. I use python 2.5 on windows xp with the latest 0.98.4 of matplotlib.

I want to create plots that work well with a manuscript in LaTeX using the IEEE template. Using that template the regular text comes out in Nimbus Roman No 9L, but I can't get matplotlib to use that font.

Using the attached script (with default matplotlibrc) I end up with BitstreamVeraSerif-Roman in the resulting pdf. So it seems only Vera is recognized. In the attached file 'log.txt' is the output from running the script with verbose.level=debug.

From the log it seems the pdfcorefonts are not on the fontpath. But still Times New Roman and palatino both are available in the system font directory as ttf fonts.

Any ideas on how to fix this

/J�rgen
------------------------------------------------------------------------

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you. Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
------------------------------------------------------------------------

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Michael Droettboom skrev:

Unfortunately, I think this is a bug. The ordering of fonts in the family list is being ignored, and Bitstream Vera Sans is winning over Nimbus Roman for reasons other than its name. I'll have to get this patch in for the bugfix release we're already planning.

As a workaround, try putting only "Nimbus Roman No9 L" as the only font in the list. Does that help?

Also, I don't see the Nimbus Roman font file (n021003l.ttf) anywhere in the debugging output. Are you sure it's in C:\Windows\Fonts ?

Mike

As you say it seems only one font at a time can be specified. These are the ones I have managed to use by only specifying a single font: Times New Roman, Georgia, Euclid, Arial, Vera.

It seems the Nimbus Roman my LaTeX installation uses is from utmr8a.pfm and utmr8a.pfb some kind of Type 1 font. I can install the pfm file in the system font directory but not the pfb files, anyway matplotlib won't use it. Is there a free ttf version available somewhere or is it possible to put the pfm/pfb files it somewhere else and have matplotlib use it?

Thanks for looking in to this,
Jörgen

J�rgen Stenarson wrote:

Michael Droettboom skrev:

Unfortunately, I think this is a bug. The ordering of fonts in the family list is being ignored, and Bitstream Vera Sans is winning over Nimbus Roman for reasons other than its name. I'll have to get this patch in for the bugfix release we're already planning.

As a workaround, try putting only "Nimbus Roman No9 L" as the only font in the list. Does that help?

Also, I don't see the Nimbus Roman font file (n021003l.ttf) anywhere in the debugging output. Are you sure it's in C:\Windows\Fonts ?

Mike

As you say it seems only one font at a time can be specified. These are the ones I have managed to use by only specifying a single font: Times New Roman, Georgia, Euclid, Arial, Vera.

It seems the Nimbus Roman my LaTeX installation uses is from utmr8a.pfm and utmr8a.pfb some kind of Type 1 font. I can install the pfm file in the system font directory but not the pfb files, anyway matplotlib won't use it.

That is correct. matplotlib can only use ttf files (or the standard 14 Postscript files when outputting Postscript).

Is there a free ttf version available somewhere or is it possible to put the pfm/pfb files it somewhere else and have matplotlib use it?

I believe Nimbus Roman is just a clone of Times that is included with Ghostscript.

http://www.tug.dk/FontCatalogue/nimbus/

If you have Times or Times New Roman installed, that's probably a reasonable substitute.

Cheers,
Mike

Michael Droettboom skrev:

put the pfm/pfb files it somewhere else and have matplotlib use it?

I believe Nimbus Roman is just a clone of Times that is included with Ghostscript.

http://www.tug.dk/FontCatalogue/nimbus/

If you have Times or Times New Roman installed, that's probably a reasonable substitute.

I tried to use usetex to generate my pdf figures but I got a crash when saving the figure, log attached. I traced the crash to find_tex_file(), apparently ' can not be used to quote filenames in the windows shell it has to be ". In my patch I just changed it to always use " I don't know if that works on other systems.

/Jörgen

broken_find_font_log.txt (7.92 KB)

dvi_read_patch.diff (590 Bytes)

J�rgen Stenarson wrote:

Michael Droettboom skrev:

put the pfm/pfb files it somewhere else and have matplotlib use it?

I believe Nimbus Roman is just a clone of Times that is included with Ghostscript.

http://www.tug.dk/FontCatalogue/nimbus/

If you have Times or Times New Roman installed, that's probably a reasonable substitute.

I tried to use usetex to generate my pdf figures but I got a crash when saving the figure, log attached. I traced the crash to find_tex_file(), apparently ' can not be used to quote filenames in the windows shell it has to be ". In my patch I just changed it to always use " I don't know if that works on other systems.

Someone who knows about usetex should review and apply this patch.

But just for clarification -- the font lookup issues we were talking about yesterday only apply when usetex is False. When usetex is True, all the font lookup happens with LaTeX, so you can't directly specify a font by name. Any particular reason why you're using usetex over the default?

Cheers,
Mike