[without findfont diff] Parsing all families in font_manager - #20549
aitikgupta wants to merge 8 commits into
Conversation
|
^^ Drop in the whole workflow/idea behind the per-glyph font fallback (not a lot of details, but on a user's perspective) |
|
Things yet to complete:
Apart from these, this PR could still use a re-review (because a major chunk of changes requested were based on |
06913db to
3855f6c
Compare
3855f6c to
6ffc56e
Compare
|
|
||
| How does Matplotlib achieve this? | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| Well, Matplotlib doesn't achieve this, *yet*. It was initially only designed to |
There was a problem hiding this comment.
We aim for the writing in the docs to be more formal.
[We also discussed this on the phone]
| prop, fontext, directory, fallback_to_default, rebuild_if_missing, | ||
| rc_params) | ||
|
|
||
| def find_fontsprop(self, prop, fontext='ttf', directory=None, |
There was a problem hiding this comment.
We talked on the phone about renaming this. The should invoke that is is going at a) find multiple fonts b) that the order of the returned fonts matters.
There was a problem hiding this comment.
Some suggestions:
find_fontsfind_orderedfontsfind_fontsdictfind_fontorderfind_fontsetfind_fontfamiliesfind_orderedfamilyfind_familyorderedfind_familiesfind_fontfamilies
|
I am going to try rebasing this so that we capture the docs. I think the code changes were made redundent by #20740 . |

PR Summary
Short Note:
This is a newer and more dynamic approach than #20496, which changed findfont's API, thus breaking a lot of backends.
A much more flexible approach would be to gradually move the different backends to
find_fontspropinstead offindfont, since the new function is built over the existing API and acts as a middleware.Quoting previous PR:
This is the beginning of migrating from Matplotlib's "Font-First" approach to a "Text-First" approach.
The very first step is to parse all families in font manager. Previously, we only parsed families until we find a font file, and the rest of the backends are accustomed to just a single font file (which needs changing)
OrderedDict would contain fonts defined by font.family
pytestpasses).flake8on changed files to check).flake8-docstringsand runflake8 --docstring-convention=all).doc/users/next_whats_new/(follow instructions in README.rst there).doc/api/next_api_changes/(follow instructions in README.rst there).