Hello,
I'm looking for a way to list all fonts installed on a linux/Debian system, and then generate images of some strings using these fonts. I'm looking for your advice as I kind of see how to do each part, but not to do both:
To list all fonts on a UNIX system,
xlsfonts
can do the trick:import os
list_of_fonts=os.popen("xslfonts").readlines()- To render a string into an image using a font, I could use PIL (Python Imaging Library) and the
ImageFont
class.
However, ImagesFont.load
expects a file name, whereas xlsfonts
gives a kind of normalized font name, and the correspondence between the two doesn't seems obvious (I tried to search my system for files named as the output of xlsfonts
, without results).
Does anyone has an idea on how I can do that? Thanks!