Add support for declared fonts
Opened this issue · 2 comments
Quite often themes are created with specific fonts in mind. Should this be something we support by allowing users to add a font.family to theme files?
Guidelines would need to be written and followed in order to make this work:
- Fonts must be publicly available - google fonts etc..
- Theme creators must supply a link to where the font was found†
- Font files and links must be declared safe before merge to master
† Should (and can we legally) store fonts within the repo instead of linking to external potentially harmful sites?
If font families are allowed in theme files, a guide should be added to the package on how to correctly add new fonts to matplotlib for windows/mac/linux.
It would also be good to add a warning message to set_font(), set_title_font(), set_body_font()
if theme font is not installed giving users the message, a link to where the font can found, and a link to the above guide on adding new fonts to MPL.
I think it is great if users can add font files along with their theme files. And if you do so, fonts should be stored within the repo because it is safer and more convenient than redirecting to other sites.
google font also stores font files in its repo as well. Font Metadata specification provides good details about adding fonts and their metadata.
Very interested in exploring other ways to handle fonts -- it took me a while to figure out how to install a new font for matplotlib (which doesn't seem to be able to use system fonts, at least as I was using it in VS Code on mac). Google Fonts is a good option, and having logic for either automatically downloading and installing Google Fonts that are not yet installed, and/or a "thempy.install_font("Font Name") function for installing a missing Google Font would be amazing.