I am looking for a way to list all the fonts installed on a linux / Debian system and then generate images of some strings using these fonts. I am looking for your advice, as I somehow see how to do each part, but not in order to do both:
To list all the fonts on a UNIX system, xlsfonts can do the trick:
import os
list_of_fonts = os.popen ("xslfonts"). readlines ()
- To display a string in an image using a font, I could use PIL (Python Image Library) and the
ImageFont class.
However, ImagesFont.load expects a file name, while xlsfonts gives a kind of normalized font name, and the correspondence between them does not seem obvious (I tried to search my system for files named as xlsfonts output with no results).
Does anyone have an idea how I can do this? Thanks!
source share