views:

147

answers:

1

I am trying to find the default system font size using SystemParametersInfo() with SPI_GETNONCLIENTMETRICS.

While on Vista the LOGFONT structures inside the returned NONCLIENTMETRICS actually have the correct font height in lfHeight, when I run the exact same app on XP, lfHeight (and lfWidth) are always zero.

Why is that so, and what is the correct way to retrieve the font size on both systems?

A: 

I don't know the 100% correct answer, but according to MSDN the value of zero has a special meaning for both lfHeight and lfWidth:

this is taken from MSDN, article Windows GDI, "LOGFONT"

lfHeight - if 0 - The font mapper uses a default height value when it searches for a match.

lfWidth - If lfWidth is zero, the aspect ratio of the device is matched against the digitization aspect ratio of the available fonts to find the closest match, determined by the absolute value of the difference.

Andrey