Feature Request
I think it would be usefull if the class tkinter.font.Font would contain the path to the font.
With it, we can use many software like fonttools to obtain more information about the font.
It is usefull because the tkinter.font.Font class is very limited.
In which case this feature is usefull?
- When you know a font name and need more information (ex: with glyph the font contain, information in the NamingTable, etc…), but you doesnt know it’s location on the drive.
- When you wanna get all the font with the same characteristic. It would be possible like that:
from fontTools import ttLib
from tkinter import font as tkFont, Tk
Tk()
for family_name in tkFont.families():
a_tk_font = tkFont.Font(name=family_name)
font_path = a_tk_font.actual("path")
# Example with FontTools
font = ttLib.TTFont(font_path)
# Do X operation with FontTools
Why it should the the job of tkinter?
tkinter already do the hard jobs to communicate with the os to get some font information.
Like you can see on this issue, it is not simple to get the path of an font: [MNT]: findSystemFonts - Use system API instead to look into folder · Issue #24001 · matplotlib/matplotlib · GitHub
So, in brief, tkinter would now not only be used for the rendering, but also a way to get installed font path on the drive.
Have a nice day