Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 334429 - dev-python/matplotlib-1.0.0 (and earlier) misses some fonts
Summary: dev-python/matplotlib-1.0.0 (and earlier) misses some fonts
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Python Gentoo Team
URL:
Whiteboard:
Keywords:
: 352605 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-08-25 11:59 UTC by François Bissey
Modified: 2011-06-07 20:16 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description François Bissey 2010-08-25 11:59:28 UTC
The matplotlib ebuild removes all the bakoma fonts (name starting with cm):
	# remove internal copies of fonts, pycxx, pyparsing
	rm -rf \
		CXX \
		lib/matplotlib/mpl-data/fonts/{afm,pdfcorefonts} \
		lib/matplotlib/mpl-data/fonts/ttf/{Vera*,cm*,*.TXT} \
		lib/matplotlib/pyparsing.py \
		|| die "removed internal copies failed"
------------
the ebuild also depends on texcm-ttf to provide the fonts in question.
Unfortunately texcm-ttf do not provide all the removed fonts.
Matplotlib ships:
-rw-r--r-- 1 francois users  25680 Aug  1  2009 cmb10.ttf
-rw-r--r-- 1 francois users  21092 Aug  1  2009 cmex10.ttf
-rw-r--r-- 1 francois users  32560 Aug  1  2009 cmmi10.ttf
-rw-r--r-- 1 francois users  26348 Aug  1  2009 cmr10.ttf
-rw-r--r-- 1 francois users  20376 Aug  1  2009 cmss10.ttf
-rw-r--r-- 1 francois users  29396 Aug  1  2009 cmsy10.ttf
-rw-r--r-- 1 francois users  28136 Aug  1  2009 cmtt10.ttf

texcm-ttf ships:
/usr/share/fonts/texcm-ttf/cmex10.ttf
/usr/share/fonts/texcm-ttf/cmmi10.ttf
/usr/share/fonts/texcm-ttf/cmr10.ttf
/usr/share/fonts/texcm-ttf/cmsy10.ttf

That's 3 fonts missing. They are used as revealed by the sage testsuite:
http://github.com/cschwan/sage-on-gentoo/issues/#issue/18/comment/370590

They are all set in the matplotlib file mathtext.py.

Possible work around: switching the default font in matplotlibrc
from cm to stix works:
#mathtext.fontset : cm # Should be 'cm' (Computer Modern), 'stix',
becomes:
mathtext.fontset : stix # Should be 'cm' (Computer Modern), 'stix',

Making change in matplotlib.conf doesn't appear to have an effect.
Comment 1 Sébastien Fabbro (RETIRED) gentoo-dev 2011-01-25 18:58:38 UTC
*** Bug 352605 has been marked as a duplicate of this bug. ***
Comment 2 Nico Schlömer 2011-02-02 17:02:57 UTC
Still true for mpl 1.0.1 btw.
Comment 3 Sébastien Fabbro (RETIRED) gentoo-dev 2011-02-24 04:57:53 UTC
Hopefully should be fixed in 1.0.1-r1. Re-open if not.
Thanks.
Comment 4 Bjoern Olausson 2011-02-24 13:58:41 UTC
Not fixed. Just installed matplotlib 1.0.1-r1 and fired up a script:

/usr/lib64/python2.6/site-packages/matplotlib/font_manager.py:1242: UserWarning: findfont: Font family ['cmb10'] not found. Falling back to Bitstream Vera Sans
  (prop.get_family(), self.defaultFamily[fontext]))
/usr/lib64/python2.6/site-packages/matplotlib/font_manager.py:1242: UserWarning: findfont: Font family ['cmtt10'] not found. Falling back to Bitstream Vera Sans
  (prop.get_family(), self.defaultFamily[fontext]))
/usr/lib64/python2.6/site-packages/matplotlib/font_manager.py:1242: UserWarning: findfont: Font family ['cmss10'] not found. Falling back to Bitstream Vera Sans
  (prop.get_family(), self.defaultFamily[fontext]))

blub@repulsion $ equery l -i dev-python/matplotlib
[ Searching for package 'matplotlib' in 'dev-python' among: ]
 * installed packages
[I--] [ ~] dev-python/matplotlib-1.0.1-r1 (0)

Cheers,
Bjoern
Comment 5 Bjoern Olausson 2011-02-24 14:17:40 UTC
Just in case - An example which reproduces the warning:

--------------------------------------------------------------------------
#!/bin/env python
#
#

import matplotlib as mpl

X = range(0,100,1)
Y = range(0,100,1)

f = mpl.pyplot.figure()
ax = f.add_subplot(111)
PLT = ax.plot(X, Y, linestyle='-', linewidth="1")

# mpl.pyplot.xlabel makes calls to font_manager which then throws a warning about the missing font
mpl.pyplot.xlabel(r"$Time$ $(ps)$")
# Same here...
mpl.pyplot.ylabel(r'$Average$  $r^2C.O.M$')

mpl.pyplot.tick_params(axis="x", direction="out")
mpl.pyplot.ticklabel_format(axis="x", style="sci", scilimits=(0,0))

mpl.pyplot.savefig("test.png")
------------------------------------------------------------------------
Comment 6 Bjoern Olausson 2011-02-24 14:36:52 UTC
Sorry, posted the wrong one...

-------------------------------------------------------
#!/bin/env python
#
#
from matplotlib.pyplot import figure, show, xlabel, ylabel, savefig
from matplotlib.figure import Figure

X = range(0,100,1)
Y = range(0,100,1)

f = figure()
ax = f.add_subplot(111)
PLT = ax.plot(X, Y, linestyle='-', linewidth="1")

# mpl.pyplot.xlabel makes calls to font_manager which then throws a warning about the missing font
xlabel(r"$Time$ $(ps)$")
# Same here...
ylabel(r'$Average$  $r^2C.O.M$')
savefig("test.png")
---------------------------------------------------------------------


Cheers,
Bjoern
Comment 7 François Bissey 2011-03-21 23:42:17 UTC
Bjoern, would switching to stix font instead of cm as default be satisfactory for you? It involves touching the default matplotlibrc file shipped to set mathtext.fonset to stix rather than the default cm. We would just just forget about the cm fonts.

We would print a warning about it at post_install. How does that sounds?
Comment 8 Bjoern Olausson 2011-03-22 09:27:15 UTC
(In reply to comment #7)
> Bjoern, would switching to stix font instead of cm as default be satisfactory
> for you?
>

Yes why not. But I dont't understand the underlying problem. Is ist matplotlib not shipping the cm font or is it tex not installing this font, or is the cm simply outdated.

I installed the cm fontset in KDE but matplotlib seems to ignore this successfully.


But anyway, I have no problems switching to stix and get rid of that nasty warning message.

Cheers,
Bjoern
Comment 9 François Bissey 2011-03-22 10:47:07 UTC
It is shipping the cm fonts. When I filled the bug they were removed in favor of an incomplete font package. In the current ebuild we leave them but we seem to have a problem setting the path to find them. In theory stix is one of the future standard for math fonts, so it makes sense to use them. I'll make a patch in the morning.
Comment 10 Bjoern Olausson 2011-06-07 11:15:06 UTC
(In reply to comment #9)
> It is shipping the cm fonts. When I filled the bug they were removed in favor
> of an incomplete font package. In the current ebuild we leave them but we seem
> to have a problem setting the path to find them. In theory stix is one of the
> future standard for math fonts, so it makes sense to use them. I'll make a
> patch in the morning.
>

Any news on this?

Cheers,
Bjoern
Comment 11 Bjoern Olausson 2011-06-07 11:24:48 UTC
Oh wait, my fault... the font cache was outdated now.

deleting ~/.matplotlib fixed it.

Sorry again.

Cheers,
Bjoern
Comment 12 François Bissey 2011-06-07 20:16:45 UTC
I hadn't done that either! I am sorry I let it slip for so long, got a new baby just a few days after my last answer here.

Anyway it is now fixed provided that the font cache is reset.