[python-win32] Load custom font
Steven Manross
steven at manross.net
Thu Jun 9 12:31:02 EDT 2022
While this isn't win32ui, I hope it helps.
pip install Pillow
from PIL import ImageFont
font = ImageFont.truetype("c:\\windows\\Fonts\\verdana.ttf", 28, encoding="unic")
font.font.family
font.font.height
font.font.style
google search revealed this:
https://stackoverflow.com/questions/24085996/how-i-can-load-a-font-file-with-pil-imagefont-truetype-without-specifying-the-ab
HTH
Steven
From: python-win32 <python-win32-bounces+steven=manross.net at python.org> On Behalf Of Jérémie Bergeron
Sent: Wednesday, June 8, 2022 6:28 AM
To: python-win32 at python.org
Subject: [python-win32] Load custom font
Hi,
Is it possible to get the family name of a font and/or any other information from the naming table from a font file?
Something like that:
font = win32ui.loadFont(pathToTheFont)
familyName = font.getNameId(1)
Have a nice day
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/python-win32/attachments/20220609/9d96fe45/attachment.html>
More information about the python-win32
mailing list