Xojo System font, Win API mapping

I am getting some complaints of mismatch of font size between Xojo fonts and things that need to use Win API.

Years ago Xojo developers (Joe probably) or William set the lines what is correct way to get correct result.

But since then of course Xojo Windows has changed API’s

This is how we do it currently:

NONCLIENTMETRICSW ncm;

ncm.cbSize = sizeof(NONCLIENTMETRICSW) - sizeof(ncm.iPaddedBorderWidth);
if (SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(ncm) - sizeof(ncm.iPaddedBorderWidth), &ncm, 0) == 0)
{
fnt = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
}
else
{
fnt = CreateFontIndirectW(&ncm.lfStatusFont);
}

if(data->WinFontSize != 0)
{
GetObjectW(fnt,sizeof(longFont),&longFont);

longFont.lfWeight 	    = (data->WinFontBold) ? FW_BOLD : FW_NORMAL;
longFont.lfCharSet		= REALGetWin32Charset();

if(data->WinTextUnit == 2 || data->WinTextUnit == 0)
{
    longFont.lfHeight 		= -MulDiv((int)(data->WinFontSize), GetDeviceCaps(GetWindowDC(GetDesktopWindow()), LOGPIXELSY), 72);	
}
else
{
    float value = data->WinFontSize / (96 * (float)scaleFactor) * 72;
    longFont.lfHeight 		= -MulDiv((int)(value), GetDeviceCaps(GetWindowDC(GetDesktopWindow()), LOGPIXELSY), 72);	
}

DeleteObject(fnt);

fnt = CreateFontIndirectW(&longFont);

}

So is this incorrect for current Xojo’s ?

@William Yu

I guess this one is false alarm, the code above is probably perfectly fine. (I misunderstood the customer, his problem was on Mac).