Skip to content

Fix font family lookup calculation #2771

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 28, 2014
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fixes a bug in font family lookup. Any font in the font alias
list (e.g. font.sans-serif) would be considered a perfect match whenever
the selected font alias is the first in the font.family list.  This
broke the priority ordering of font names.
  • Loading branch information
mdboom committed Feb 24, 2014
commit 314a0cfdf2ebfb2faffdec5e4d702e5e6ed1f2ac
2 changes: 1 addition & 1 deletion lib/matplotlib/font_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -1071,7 +1071,7 @@ def score_family(self, families, family2):
if family2 in options:
idx = options.index(family2)
return ((0.1 * (float(idx) / len(options))) *
(float(i) / float(len(families))))
(float(i + 1) / float(len(families))))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't `from future_import division remove the need for all of this casting to float?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True. I think this code was written prior to that. Will fix.

elif family1 == family2:
# The score should be weighted by where in the
# list the font was found.
Expand Down