Address side effects of using fontconfig by default

This commit is contained in:
pcpa 2013-01-16 18:49:17 -02:00
parent eb9a122389
commit b58a0f66d3
2 changed files with 40 additions and 3 deletions

View File

@ -1,6 +1,6 @@
diff -up matplotlib-1.2.0/lib/matplotlib/font_manager.py.orig matplotlib-1.2.0/lib/matplotlib/font_manager.py
--- matplotlib-1.2.0/lib/matplotlib/font_manager.py.orig 2013-01-16 13:42:53.917687221 -0200
+++ matplotlib-1.2.0/lib/matplotlib/font_manager.py 2013-01-16 13:43:13.987687989 -0200
--- matplotlib-1.2.0/lib/matplotlib/font_manager.py.orig 2013-01-16 16:10:23.104026087 -0200
+++ matplotlib-1.2.0/lib/matplotlib/font_manager.py 2013-01-16 18:44:12.691379520 -0200
@@ -62,7 +62,7 @@ try:
except ImportError:
import pickle
@ -10,3 +10,34 @@ diff -up matplotlib-1.2.0/lib/matplotlib/font_manager.py.orig matplotlib-1.2.0/l
verbose = matplotlib.verbose
@@ -771,7 +771,7 @@ class FontProperties(object):
return float(self._size)
except ValueError:
pass
- default_size = fontManager.get_default_size()
+ default_size = FontManager.get_default_size()
return default_size * font_scalings.get(self._size)
def get_file(self):
@@ -991,7 +991,10 @@ class FontManager:
self.afmfiles = findSystemFonts(paths, fontext='afm') + \
findSystemFonts(fontext='afm')
self.afmlist = createFontList(self.afmfiles, fontext='afm')
- self.defaultFont['afm'] = self.afmfiles[0]
+ try:
+ self.defaultFont['afm'] = self.afmfiles[0]
+ except IndexError:
+ self.defaultFont['afm'] = None
self.ttf_lookup_cache = {}
self.afm_lookup_cache = {}
@@ -1002,7 +1005,8 @@ class FontManager:
"""
return self.__default_weight
- def get_default_size(self):
+ @staticmethod
+ def get_default_size():
"""
Return the default font size.
"""

View File

@ -17,7 +17,7 @@
Name: python-matplotlib
Version: 1.2.0
Release: 7%{?dist}
Release: 8%{?dist}
Summary: Python 2D plotting library
Group: Development/Libraries
License: Python
@ -31,6 +31,8 @@ Source0: matplotlib-%{version}-without-gpc.tar.gz
Patch0: %{name}-noagg.patch
Patch1: %{name}-tk.patch
# http://sourceforge.net/mailarchive/message.php?msg_id=30202451
# https://github.com/matplotlib/matplotlib/pull/1666
# https://bugzilla.redhat.com/show_bug.cgi?id=896182
Patch2: %{name}-fontconfig.patch
BuildRequires: agg-devel
@ -299,6 +301,10 @@ popd
%endif
%changelog
* Wed Jan 16 2013 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 1.2.0-8
- Update fontconfig patch to apply issue found by upstream
- Update fontconfig patch to apply issue with missing afm fonts (#896182)
* Wed Jan 16 2013 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 1.2.0-7
- Use fontconfig by default (#885307)