Re: List all fonts filename

Tim Roberts <[email protected]> Thu, 5 Jan 2023 12:26:07 -0800
Newsgroups gmane.comp.python.windows
Organization Providenza & Boekelheide, Inc.
Message-ID <[email protected]>
Moi15 Moi wrote:
> My goal is to list all the filename of the font installed without 
> listing the file in those 2 folders:
> - C:\Windows\Fonts
> - %userprofile%\AppData\Local\Microsoft\Windows\Fonts
>
> I found a way to do it directwrite: 
> https://gist.github.com/JeremieBergeron/dc04bcb747c94a82a10020a990ba884a
> But, from what I can see, pywin32 doesn't support directwrite api.

It's just COM, which pywin32 does perfectly well.  The advantage of COM 
is that you don't need a custom interface.  Did you look at the pyglet 
code that does this?


> But, I don't know how I get the font path 
> (ex: C:\Users\Admin\AppData\Local\Microsoft\Windows\Fonts\Jester.ttf) 
> with GDI

The easier way would be to read the registry. 
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" 
is where Windows stores the registered fonts.  The key is the font name, 
the value is the file name.  If there is a file name without a path, it 
defaults to C:\Windows\Fonts.

-- 
Tim Roberts, [email protected]
Providenza & Boekelheide, Inc.

_______________________________________________
python-win32 mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-win32
smime.p7s (application/pkcs7-signature, 3.3 KB) - not displayed