-
Notifications
You must be signed in to change notification settings - Fork 45
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
Use a database object to manage fonts #714
Conversation
|
||
def __init__(self, size=None, weight="normal"): | ||
self._version = self.__version__ | ||
|
||
self.__default_weight = weight | ||
self.default_size = size if size is not None else 12.0 | ||
|
||
paths = [] | ||
self.default_family = "sans-serif" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is basically equivalent to the previous value. Bitstream Vera and Helvetica are both sans-serif families. But since not every system may have them, we can use the generic family name for the default and get good results thanks to the preferred_fonts
dictionary listing several options for sans-serif.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for the multiple self reviews, which helped my review in the end. I don't have any comments apart from what you already added in your self review.
Thanks for the review |
This will be useful to #711 (for avoiding duplicate additions).
Instead of using lists inside of
FontManager
to hold collections ofFontEntry
objects, this PR introduces aFontDatabase
class which ensures all known entries are unique and provides a way to query entries by file path or font family in order to pare down the number of fonts that need to be scored byFontManager.findfont
.