
File name
Commit message
Commit date

2023-06-14
File name
Commit message
Commit date
# source : https://stackoverflow.com/questions/75310650/how-to-get-font-path-from-font-name-python
# author : Mark Setchell
# this code is CC-BY-SA, in other words, do not mix this up with any other code.
import matplotlib.font_manager
from PIL import ImageFont
# Iterate over all font files known to matplotlib
for filename in matplotlib.font_manager.findSystemFonts():
# Avoid these two trouble makers - don't know why they are problematic
if "Emoji" not in filename and "18030" not in filename:
# Look up what PIL knows about the font
font = ImageFont.FreeTypeFont(filename)
name, weight = font.getname()
print(f'File: {filename}, fontname: {name}, weight: {weight}')