@@ -1396,44 +1396,32 @@ def _find_fonts_by_props(self, prop, fontext='ttf', directory=None,
1396
1396
which closely match the given font properties. Since this internally
1397
1397
uses the original API, there's no change to the logic of performing the
1398
1398
nearest neighbor search. See `findfont` for more details.
1399
-
1400
1399
"""
1401
1400
1402
- rc_params = tuple (tuple (rcParams [key ]) for key in [
1403
- "font.serif" , "font.sans-serif" , "font.cursive" , "font.fantasy" ,
1404
- "font.monospace" ])
1405
-
1406
1401
prop = FontProperties ._from_any (prop )
1407
1402
1408
1403
fpaths = []
1409
1404
for family in prop .get_family ():
1410
1405
cprop = prop .copy ()
1406
+ cprop .set_family (family ) # set current prop's family
1411
1407
1412
- # set current prop's family
1413
- cprop .set_family (family )
1414
-
1415
- # do not fall back to default font
1416
1408
try :
1417
1409
fpaths .append (
1418
- self ._findfont_cached (
1410
+ self .findfont (
1419
1411
cprop , fontext , directory ,
1420
- fallback_to_default = False ,
1412
+ fallback_to_default = False , # don't fallback to default
1421
1413
rebuild_if_missing = rebuild_if_missing ,
1422
- rc_params = rc_params ,
1423
1414
)
1424
1415
)
1425
1416
except ValueError :
1426
1417
if family in font_family_aliases :
1427
1418
_log .warning (
1428
1419
"findfont: Generic family %r not found because "
1429
1420
"none of the following families were found: %s" ,
1430
- family ,
1431
- ", " .join (self ._expand_aliases (family ))
1421
+ family , ", " .join (self ._expand_aliases (family ))
1432
1422
)
1433
1423
else :
1434
- _log .warning (
1435
- 'findfont: Font family \' %s\' not found.' , family
1436
- )
1424
+ _log .warning ("findfont: Font family %r not found." , family )
1437
1425
1438
1426
# only add default family if no other font was found and
1439
1427
# fallback_to_default is enabled
@@ -1443,16 +1431,15 @@ def _find_fonts_by_props(self, prop, fontext='ttf', directory=None,
1443
1431
cprop = prop .copy ()
1444
1432
cprop .set_family (dfamily )
1445
1433
fpaths .append (
1446
- self ._findfont_cached (
1434
+ self .findfont (
1447
1435
cprop , fontext , directory ,
1448
1436
fallback_to_default = True ,
1449
1437
rebuild_if_missing = rebuild_if_missing ,
1450
- rc_params = rc_params ,
1451
1438
)
1452
1439
)
1453
1440
else :
1454
1441
raise ValueError ("Failed to find any font, and fallback "
1455
- "to the default font was disabled. " )
1442
+ "to the default font was disabled" )
1456
1443
1457
1444
return fpaths
1458
1445
0 commit comments