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

Case of unnecessary font installation #143

Open
0ctagon opened this issue Mar 28, 2024 · 2 comments
Open

Case of unnecessary font installation #143

0ctagon opened this issue Mar 28, 2024 · 2 comments

Comments

@0ctagon
Copy link
Collaborator

0ctagon commented Mar 28, 2024

In some cases, the fonts are already installed in the machine, but matplotlib is unaware of the location and doesn't check it. In this case, the user download the fonts even if he doesn't need to.
We could add in the __init__ something like:

import matplotlib
from matplotlib import font_manager

# Check if the recommended fonts are installed in the texlive path and the matplotlib path
font_dirs = ["/usr/share/texlive/texmf-dist/fonts", matplotlib.__path__[0]]

for font_dir in font_dirs:
    font_files = font_manager.findSystemFonts()
    for font_file in font_files:
        font_manager.fontManager.addfont(font_file)

but then will the fontManager (ref) still tries the default path if you don't tell where to look? I had problems providing explicitly None as a default parameters, some found fonts crashes the fontManager.addfont, so I'm a bit confused by how it proceeds to get the fonts.

@0ctagon 0ctagon changed the title Unnecessary font installation Case of unnecessary font installation Mar 28, 2024
@cyrraz
Copy link
Owner

cyrraz commented Jul 1, 2024

Hello @0ctagon, I think you fixed that, didn't you?

@0ctagon
Copy link
Collaborator Author

0ctagon commented Jul 2, 2024

Not yet. #158 only check if the fonts are already installed in ~/.fonts, it doesn't checks in all the system if they already are installed and then link it to matplotlib.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants