Skip to content

Commit 4ed8cb2

Browse files
committed
Ensure that font family is unicode
fixes issues with set_family in python 2 using the OSX backend. Also test if family is a list and convert this to unicode too.
1 parent 59eda22 commit 4ed8cb2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/matplotlib/font_manager.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
set
5353
except NameError:
5454
from sets import Set as set
55+
from collections import Iterable
5556
import matplotlib
5657
from matplotlib import afm
5758
from matplotlib import ft2font
@@ -822,7 +823,9 @@ def set_family(self, family):
822823
if family is None:
823824
family = rcParams['font.family']
824825
if is_string_like(family):
825-
family = [family]
826+
family = [six.text_type(family)]
827+
elif (not is_string_like(family) and isinstance(family, Iterable)):
828+
family = [six.text_type(f) for f in family]
826829
self._family = family
827830
set_name = set_family
828831

0 commit comments

Comments
 (0)