-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Cache paths of fonts shipped with mpl relative to the mpl data path. #10245
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
Conversation
d9ad3ba
to
cd87892
Compare
I think the gain of keeping the fontcache across venvs is nice enough to mark this as RC. |
I think we need to add the matplotlib version number to the file incase we change the fonts we ship between versions again (to support multiple matplotlib versions across multiple venvs). |
cd87892
to
0a80831
Compare
Done as a separate commit. Now also closes #4993 (until we decide to also change the format of the tex cache...). |
Cleaned up too much style! |
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.
Modulo removing the flake8 exception.
This lets the font cache stay valid across multiple virtualenvs (as long as the list of fonts shipped by mpl does not change).
0a80831
to
9f821d1
Compare
done |
d["fname"] = str( | ||
Path(d["fname"]).relative_to(mpl.get_data_path())) | ||
except ValueError: | ||
pass |
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.
One concern is that are we sure every path we see here will be absolute?
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.
fontconfig returns absolute paths, and we call os.path.abspath in findSystemFonts.
This lets the font cache stay valid across multiple virtualenvs (as long
as the list of fonts shipped by mpl does not change).
xref #10201.
As a side note note the previously buggy line
if fname.lower().find('DejaVuSans.ttf')>=0
which would always return False...PR Summary
PR Checklist