Click to See Complete Forum and Search --> : HFONT to filename


Nethar
February 9th, 2009, 04:33 PM
Hi,
is it possible to get font filename from HFONT handle?

HFONT handle -> "C:\Windows\Fonts\arial.ttf"

I know i can get LOGFONT structure from HFONT (with GetObject function) so I can get font name. Then maybe I can search registry keys in HKeyLocalMachine\Software\Microsoft\Windows NT\CurrentVersion\Fonts to find the font name and there is a filename (i know how to get fonts directory path).
Is this good solution? Because it does not seem very friendly :) Is there any easier solution? ;-)
Thanks!

Codeplug
February 9th, 2009, 06:07 PM
>> Is there any easier solution?
Not that I know of. An implementation of your solution can be found here:
http://www.codeproject.com/KB/GDI/xfont.aspx

gg

Nethar
February 10th, 2009, 01:22 AM
OK, thanks, at least I know this is the only way ;-)