@@ -1222,10 +1222,9 @@ def _findfont_cached(self, prop, fontext, directory, fallback_to_default,
12221222
12231223 if not isinstance (prop , FontProperties ):
12241224 prop = FontProperties (prop )
1225- fname = prop .get_file ()
12261225
1226+ fname = prop .get_file ()
12271227 if fname is not None :
1228- _log .debug ('findfont returning %s' , fname )
12291228 return fname
12301229
12311230 if fontext == 'afm' :
@@ -1236,19 +1235,19 @@ def _findfont_cached(self, prop, fontext, directory, fallback_to_default,
12361235 best_score = 1e64
12371236 best_font = None
12381237
1238+ _log .debug ('findfont: Matching %s.' , prop )
12391239 for font in fontlist :
12401240 if (directory is not None and
12411241 Path (directory ) not in Path (font .fname ).parents ):
12421242 continue
1243- # Matching family should have highest priority, so it is multiplied
1244- # by 10.0
1245- score = \
1246- self .score_family (prop .get_family (), font .name ) * 10.0 + \
1247- self .score_style (prop .get_style (), font .style ) + \
1248- self .score_variant (prop .get_variant (), font .variant ) + \
1249- self .score_weight (prop .get_weight (), font .weight ) + \
1250- self .score_stretch (prop .get_stretch (), font .stretch ) + \
1251- self .score_size (prop .get_size (), font .size )
1243+ # Matching family should have top priority, so multiply it by 10.
1244+ score = (self .score_family (prop .get_family (), font .name ) * 10
1245+ + self .score_style (prop .get_style (), font .style )
1246+ + self .score_variant (prop .get_variant (), font .variant )
1247+ + self .score_weight (prop .get_weight (), font .weight )
1248+ + self .score_stretch (prop .get_stretch (), font .stretch )
1249+ + self .score_size (prop .get_size (), font .size ))
1250+ _log .debug ('findfont: score(%s) = %s' , font , score )
12521251 if score < best_score :
12531252 best_score = score
12541253 best_font = font
0 commit comments