[python-win32] Problem accessing GetFontData in Windows API

Tim Roberts timr at probo.com
Sat Jan 23 03:40:34 CET 2010


Alec Bennett wrote:
>> A much better solution is to search through the registry
>> values in HKLM\SOFTWARE\Microsoft\Windows
>>     
>
> Three things concern me with this method: 
>
> 1) if I understand correctly, Windows appends the language to the font title. In other words, for German the Arial font is "arial german". Normally this wouldn't be the biggest issue in the world, but there are often multiple font names with the same string in them, one for bold, one for italic, etc., so its not simply a matter of returning any entry with the name "arial" in it.
>   

There is no "Arial German".  That's the whole point of Unicode and
TrueType.  All language glyphs are in one file.  You would have to deal
with bold, italic, and bold italic, but those are in the listing.

If you have antique raster fonts, it's possible you could come across
this, but those are separate files, so I think that's what you want.

> 2) under Vista 64-bit I've been getting permission denied errors when trying to read the registry using winreg. 
>   

Even if you set read-only?  I thought HKEY_LOCAL_MACHINE was readable
but not writable.

> 3) its a kludge and bound to be inaccurate on some systems.
>   

Not really -- this is the same database used by the system's font
manager.  That data is not simply decorative.  It's no more kludgy than
using OUTLINETEXTMETRICS

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the python-win32 mailing list