Win32: Getting LOGFONT from HFONT
Win32 win32
Published: 2007-08-22
Win32: Getting LOGFONT from HFONT

To convert a HFONT to a LOGFONT, use the GDI function GetObject(), as in:

1
2
3
LOGFONT lf;
int ret = GetObject(hfont, sizeof(lf), &lf);
// Be sure to check the return value of GetObject

The code is trivial but the function took me forever to find.