Skip to content
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

Break out the font scoring methods and test them #704

Merged
merged 2 commits into from
Mar 11, 2021

Conversation

jwiggins
Copy link
Member

Ok, I'm pretty sure that along with #700, I'm really done breaking things out of kiva.fonttools.font_manager. The next PR is the big one.

This PR moves the font scoring methods to their own module and covers them liberally with tests. A bug in score_size was fixed (trying to call a dict instance).

The font scoring methods are used by FontManager.findfont to compare FontEntry instances with FontProperties instances to determine their similarity.

@jwiggins
Copy link
Member Author

I went ahead and actually deleted the old methods from FontManager.

Copy link
Contributor

@rahulporuri rahulporuri left a comment

Choose a reason for hiding this comment

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

LGTM.

I did a quick search through the enthought codebases on GitHub to see if there are any uses of the methods - and I don't see any. None whatsoever. Searching in general on GitHub raises a lot of false negatives - uses of the method on the matplotlib font manager.

I'm confident that removing the methods won't cause much (if any) pain.

Comment on lines +22 to +23
# Each of the scoring functions below should return a value between
# 0.0 (perfect match) and 1.0 (terrible match)
Copy link
Contributor

@rahulporuri rahulporuri Mar 11, 2021

Choose a reason for hiding this comment

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

bikeshed : that seems backwards to me. but i guess it also makes sense in terms of distance between fonts and 0.0 means perfect match/zero distance and 1.0 is scaled worst match/infinite distance.

@jwiggins
Copy link
Member Author

Thanks for the review!

@jwiggins jwiggins merged commit 0676682 into master Mar 11, 2021
@jwiggins jwiggins deleted the feature/split-font-scores branch March 11, 2021 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants