| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| for k, family in enumerate(families): | ||
| font = FontProperties() | ||
| font.set_family(family) | ||
| font = FontProperties(family=family) |
There was a problem hiding this comment.
This broke with sans-serif, probably because of this special case:
https://github.com/QuLogic/matplotlib/blob/0cdb45da1bfe0af330f87eeadcf633919cd26f80/lib/matplotlib/font_manager.py#L614-L620
It could probably be fixed by passing family=[family].
Sorry, something went wrong.
There was a problem hiding this comment.
Whoops. That's surprising and awkward. The __init__ parameter behaves differently compared to the set_family method. 😢 But it's documented.
I believe FontProperties(pattern) should be deprecated and we should instead add a FontProperties.from_pattern(pattern) method. But that's for another PR (see #28837). For now, we have to go with the list.
Sorry, something went wrong.
Replace default initialization immediately followed by setting values by initialization with values, i.e. ``` # before: fp = FontProperties() fp.set_[something](val) # after fp = FontProperties([something]=val) ``` This is clearer and additionally helps with the possible transition of making FontProperties immutable, see matplotlib#22495.
| Back | FazBrowse Home | New Git URL |
Replace default initialization immediately followed by setting values by initialization with values, i.e.
This is clearer and additionally helps with the possible transition of making FontProperties immutable, see #22495.