Skip to content

Commit 07cae1a

Browse files
committed
MNT: set the family to rcParam value in init
1 parent bb9b4cd commit 07cae1a

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
@@ -682,7 +682,7 @@ def __init__(self,
682682
fname = None, # if this is set, it's a hardcoded filename to use
683683
_init = None # used only by copy()
684684
):
685-
self._family = None
685+
self._family = _normalize_font_family(rcParams['font.family'])
686686
self._slant = rcParams['font.style']
687687
self._variant = rcParams['font.variant']
688688
self._weight = rcParams['font.weight']
@@ -821,10 +821,7 @@ def set_family(self, family):
821821
"""
822822
if family is None:
823823
family = rcParams['font.family']
824-
if is_string_like(family):
825-
family = [six.text_type(family)]
826-
elif not is_string_like(family) and isinstance(family, Iterable):
827-
family = [six.text_type(f) for f in family]
824+
family = _normalize_font_family(family)
828825
self._family = family
829826
set_name = set_family
830827

@@ -968,6 +965,14 @@ def pickle_load(filename):
968965
return data
969966

970967

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

0 commit comments

Comments
 (0)