Hi Is there a way to obtain the font path via pywin32? I need to communicate with DirectWrite.
Here is the algorithm I would need to be able to get the fonts path based on the microsoft documentation: # DWriteCreateFactory - https://learn.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-dwritecreatefactory # IDWriteFactory3 - https://learn.microsoft.com/en-us/windows/win32/api/dwrite_3/nn-dwrite_3-idwritefactory3 write_factory = DWriteCreateFactory(DWRITE_FACTORY_TYPE.DWRITE_FACTORY_TYPE_ISOLATED, __uuidof(IDWriteFactory3), False) # GetSystemFontSet - https://learn.microsoft.com/en-us/windows/win32/api/dwrite_3/nf-dwrite_3-idwritefactory3-getsystemfontset font_set = write_factory.GetSystemFontSet() # GetFontCount - https://learn.microsoft.com/en-us/windows/win32/api/dwrite_3/nf-dwrite_3-idwritefontset-getfontcount for i in range(font_set.GetFontCount()): # GetFontFaceReference - https://learn.microsoft.com/en-us/windows/win32/api/dwrite_3/nf-dwrite_3-idwritefontset-getfontfacereference font_face_reference = font_set.GetFontFaceReference(i) # GetFontFile - https://learn.microsoft.com/en-us/windows/win32/api/dwrite_3/nf-dwrite_3-idwritefontfacereference-getfontfile font_file = font_face_reference.GetFontFile() # GetReferenceKey - https://learn.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefontfile-getreferencekey reference_key, reference_key_size = font_file.GetReferenceKey() # GetFilePathFromKey - https://learn.microsoft.com/en-us/windows/win32/directwrite/idwritelocalfontfileloader-getfilepathfromkey path = GetFilePathFromKey(reference_key, reference_key_size) Have a nice day
_______________________________________________ python-win32 mailing list python-win32@python.org https://mail.python.org/mailman/listinfo/python-win32