[python-win32] Problem accessing GetFontData in Windows API
Tim Roberts
timr at probo.com
Mon Jan 25 18:01:13 CET 2010
Alec Bennett wrote:
> Thanks for the tips.
>
> Using that method I'm able to obtain the filename for about 75% of the fonts in my Windows directory, but I can't resolve fonts with names such as this:
>
> - the font's name is Arno Pro. It shows up in font choosers with names like "Arno Pro", "Arno Pro Caption", "Arno Pro Display", etc.
>
> - however, no such names appear in the Windows font directory/registry. This font appears as, for example, "ArnoPro-Regular", "ArnoPro-Caption", "ArnoPro-Display".
>
> I don't imagine you can think of a way to obtain the file name for fonts with that sort of naming convention?
>
Yecch. Yes, this is ugly. TrueType font have several names, including
a "full name" and a "PostScript name", where the PostScript name must be
ASCII and usually has no spaces. I'm not sure I have an answer for this
problem.
In the worst case, I suppose you could do like GIMP does, and scan
through %SystemRoot%\Fonts on your own. You could cache the information
so you only checked files that had changed.
The alternative is to go through the trouble of constructing a ctypes
wrapper for GetOutlineTextMetrics.
--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the python-win32
mailing list