Font management under win32

Stefano Masini stefano at pragma2000.com
Wed Sep 28 12:07:06 EDT 2005


Hi,

I have a simple need, running under windows:

1) retrieve the list of installed system fonts
2) maybe install missing fonts

Surprisingly for me, there seems to be no support for such a thing in
python. I really hope I'm mistaken, so _please_ correct me if I'm
wrong.

I found out that it all boils down to a couple of win32 syscalls:
EnumFontFamiliesEx and AddFontResourceEx. Unfortunately I'm no expert
of win32 programming whatsoever. I asked Mark Hammond about this.
While I wait for him to receive my email, I thought I'd post on the
list in case someone else was interested, or had found a different
solution.

Indeed, win32gui does contain an EnumFontFamilies (without the
trailing "Ex") function, but I found no usage example, and I couldn't
figure out how to use LOGFONT handles (since such a thing is required
as the first parameter to the call). So I decided to punt on it and
ask for wiser support.

If I could get this EnumFontFamilies to work, it could already be
enough, because I found a command line tool that allows me to do font
installation. It's got to be some no-brainer 10 lines of C code simply
calling AddFontResourceEx, but it works!

So, does anybody ever had the same problem?

thanks,
stefano



More information about the Python-list mailing list