Skip to content

Commit 55c266c

Browse files
committed
MNT: set the family to rcParam value in init
1 parent b079583 commit 55c266c

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

lib/matplotlib/font_manager.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@ def __init__(self,
681681
fname = None, # if this is set, it's a hardcoded filename to use
682682
_init = None # used only by copy()
683683
):
684-
self._family = None
684+
self._family = _normalize_font_family(rcParams['font.family'])
685685
self._slant = rcParams['font.style']
686686
self._variant = rcParams['font.variant']
687687
self._weight = rcParams['font.weight']
@@ -820,10 +820,7 @@ def set_family(self, family):
820820
"""
821821
if family is None:
822822
family = rcParams['font.family']
823-
if is_string_like(family):
824-
family = [six.text_type(family)]
825-
elif not is_string_like(family) and isinstance(family, Iterable):
826-
family = [six.text_type(f) for f in family]
823+
family = _normalize_font_family(family)
827824
self._family = family
828825
set_name = set_family
829826

@@ -967,6 +964,14 @@ def pickle_load(filename):
967964
return data
968965

969966

967+
def _normalize_font_family(family):
968+
if is_string_like(family):
969+
family = [six.text_type(family)]
970+
elif (not is_string_like(family) and isinstance(family, Iterable)):
971+
family = [six.text_type(f) for f in family]
972+
return family
973+
974+
970975
class TempCache(object):
971976
"""
972977
A class to store temporary caches that are (a) not saved to disk

0 commit comments

Comments
 (0)