I'm trying to find out what fonts are available to be used in PIL with the font = ImageFont.load()
and/or ImageFont.truetype()
function. I want to create a list from which I can sample a random font to be used. I haven't found anything in the documentation so far, unfortunately.
I have so far not found a solution with PIL
but matplotlib
has a function to get all the available fonts from the system:
system_fonts = matplotlib.font_manager.findSystemFonts(fontpaths=None, fontext='ttf')
The font can then be loaded using fnt = ImageFont.truetype(font, 60)