Browse files

Make weighting by position in the list less magical

  • Loading branch information...
1 parent 2ea3dcb commit d129186c880c38c8e13448c7bc290dcd5a8bed6b @mdboom committed May 15, 2013
Showing with 5 additions and 2 deletions.
  1. +5 −2 lib/matplotlib/font_manager.py
View
7 lib/matplotlib/font_manager.py
@@ -1066,9 +1066,12 @@ def score_family(self, families, family2):
options = [x.lower() for x in options]
if family2 in options:
idx = options.index(family2)
- return 0.1 * ((float(idx) / len(options)) + float(i))
+ return ((0.1 * (float(idx) / len(options))) *
+ (float(i) / float(len(families))))
elif family1 == family2:
- return 0.1 * float(i)
+ # The score should be weighted by where in the
+ # list the font was found.
+ return float(i) / float(len(families))
return 1.0
def score_style(self, style1, style2):

0 comments on commit d129186

Please sign in to comment.