Hi,

I am trying to use EnumFontFamilies to get the elfFullName
<https://learn.microsoft.com/en-us/windows/win32/api/wingdi/ns-wingdi-enumlogfontw>
value
of each font.

Here is what I have tried:
from typing import Optional
import win32gui

def enum_fonts(family_name: Optional[str]=None):

    hwnd = win32gui.GetDesktopWindow()
    dc = win32gui.GetWindowDC(hwnd)

    res = []
    def callback(*args):
        print(args[0].elfFullName)
        res.append(args)
        return 1
    win32gui.EnumFontFamilies(dc, family_name, callback)

    win32gui.ReleaseDC(hwnd, dc)
    return res


for logfont in enum_fonts("Arial"):

            print(f"Font name: {logfont[0].lfFaceName}")
            print(f"Weight: {logfont[0].lfWeight}")
            print(f"Width: {logfont[0].lfWidth}")
            print(f"Height: {logfont[0].lfHeight}")
            print(f"Italic: {bool(logfont[0].lfItalic)}")
            print()



But, it does give me the elfFullName
<https://learn.microsoft.com/en-us/windows/win32/api/wingdi/ns-wingdi-enumlogfontw>
value.
How can I get it?
>From what I understand, I need to use EnumFontFamExProc
<https://learn.microsoft.com/en-us/previous-versions/dd162618(v=vs.85)>,
but I have no idea how to do it.

Thank you
_______________________________________________
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32

Reply via email to