*
* SEE ALSO
* GetTextExtentPointW, GetTextMetricsW, MapDialogRect.
+ *
+ * Despite most of MSDN insisting that the horizontal base unit is
+ * tmAveCharWidth it isn't. Knowledge base article Q145994
+ * "HOWTO: Calculate Dialog Units When Not Using the System Font",
+ * says that we should take the average of the 52 English upper and lower
+ * case characters.
*/
/*
* @implemented
if (dlgInfo->hUserFont)
{
SIZE charSize;
- if (DIALOG_GetCharSize( dc, dlgInfo->hUserFont, &charSize ))
+ HFONT hOldFont = SelectObject( dc, dlgInfo->hUserFont );
+ charSize.cx = GdiGetCharDimensions( dc, NULL, &charSize.cy );
+ if (charSize.cx)
{
dlgInfo->xBaseUnit = charSize.cx;
dlgInfo->yBaseUnit = charSize.cy;
}
+ SelectObject( dc, hOldFont );
}
ReleaseDC(0, dc);
}
if ((hdc = GetDC(0)))
{
- if (DIALOG_GetCharSize( hdc, 0, &size )) units = MAKELONG( size.cx, size.cy );
+ size.cx = GdiGetCharDimensions( hdc, NULL, &size.cy );
+ if (size.cx) units = MAKELONG( size.cx, size.cy );
ReleaseDC( 0, hdc );
}
}