Add wxDC::GetFontMetrics() and implement it for wxMSW.
Add a new wxDC method allowing to retrieve the font characteristics not available from GetTextExtent(), notably the internal leading (and also the average font width). Currently this is implemented for wxMSW only, the internal leading is always 0 in the other ports. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67063 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1134,6 +1134,27 @@ void wxDCImpl::InheritAttributes(wxWindow *win)
|
||||
SetLayoutDirection(win->GetLayoutDirection());
|
||||
}
|
||||
|
||||
void wxDCImpl::DoGetFontMetrics(int *height,
|
||||
int *ascent,
|
||||
int *descent,
|
||||
int *internalLeading,
|
||||
int *externalLeading,
|
||||
int *averageWidth) const
|
||||
{
|
||||
// Average width is typically the same as width of 'x'.
|
||||
wxCoord h, d;
|
||||
DoGetTextExtent("x", averageWidth, &h, &d, externalLeading);
|
||||
|
||||
if ( height )
|
||||
*height = h;
|
||||
if ( ascent )
|
||||
*ascent = h - d;
|
||||
if ( descent )
|
||||
*descent = d;
|
||||
if ( internalLeading )
|
||||
*internalLeading = 0;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxDC
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user