Font path from font name


Would anyone know if it is possible to get the OS path for a font name directly without having to resort to brute force methods.

I want to go from ‘My Font Name’ to finding ‘My Font Name.ttf or .otf’ in the OS filesystem.

I’ve tried to find the path using GtkFileChooser, Pango etc but it doesn’t seem to be present.

I know I can get the font name for every file in the system font folders using PIL.ImageFont, and then match it to the chosen font name - but I would rather avoid that.

The reason is, I would like to base64 encode a font given its name only.

Many thanks for any help :slight_smile:

Going from the font name and style to an actual file on disk is not as
easy as it might seem.

Thanks for your reply Steven.

I suspected as much :slight_smile:

I will have a look at the links you have provided.