How to add fonts?

All approaches I’ve seen are broken hacks involving cache deletion, which I struggle to get to work in remotely built environments (ReadTheDocs). Path-based breaks fig.savefig(). The goal’s to ship arial.ttf with my Python library to be installed via pip.

Is there an official way? If not, it’d help to have, as I doubt there’s a timeless hack.

matplotlib.font_manager.fontManager.addfont(path)

works. This is undocumented, I learned it from #17568; opened PR.