Re: [python-win32] List all fonts filename

2023-01-05 Thread Tim Roberts

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, t...@probo.com
Providenza & Boekelheide, Inc.



smime.p7s
Description: S/MIME Cryptographic Signature
___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] List all fonts filename

2023-01-03 Thread Tim Roberts

On 1/3/23 6:13 PM, moi15moismokerlolilol wrote:


I don't wanna list the family name.


Then what do you want?  Do you understand how Windows arranges fonts?  
"Arial" is a font family.  "Tahoma" is a font family.  You can enumerate 
all of the fonts using the WIn32 API, and everything in the Win32 API 
can be accessed through pywin32.


--
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.

___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] List all fonts filename

2022-12-30 Thread Tim Roberts

On 12/23/22 6:29 AM, Moi15 Moi wrote:



Is it possible to list all the fonts filename with pywin32?

From what I can see, it is possible with the GetFontData 
 from 
GDI.


GetFontData is certainly available in pywin32, as are most Win32 APIs.  
However, it only returns information about one font at a time -- the 
font that is currently selected into that DC.


You can use EnumFontFamilies or EnumFontFamiliesEx, available in win32gui.

http://timgolden.me.uk/pywin32-docs/win32gui__EnumFontFamilies_meth.html

https://stackoverflow.com/questions/5760594/pywin32-enumfontfamilies-breaks-python

--
Tim Roberts,t...@probo.com
Providenza & Boekelheide, Inc.
___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


[python-win32] List all fonts filename

2022-12-29 Thread Moi15 Moi
Hi,
Is it possible to list all the fonts filename with pywin32?

>From what I can see, it is possible with the GetFontData

from
GDI.

Here is an example in c++:
https://stackoverflow.com/questions/16769758/get-a-font-filename-based-on-the-font-handle-hfont

Have a nice day
___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32