Use PangoFontMetrics to get wxDC::GetCharHeight, because that's the proper and clean way to get the body size of a

particular font, and it doesn't go through all the layoutting code (hence, 20-35% quicker than measuring H for
logical extents).


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40049 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Mart Raudsepp
2006-07-09 03:46:01 +00:00
parent dec588bd6e
commit 370b406c71

View File

@@ -1762,10 +1762,8 @@ wxCoord wxWindowDC::GetCharWidth() const
wxCoord wxWindowDC::GetCharHeight() const wxCoord wxWindowDC::GetCharHeight() const
{ {
pango_layout_set_text( m_layout, "H", 1 ); PangoFontMetrics *metrics = pango_context_get_metrics (m_context, m_fontdesc, NULL);
int h; return PANGO_PIXELS (pango_font_metrics_get_descent (metrics) + pango_font_metrics_get_ascent (metrics));
pango_layout_get_pixel_size( m_layout, NULL, &h );
return h;
} }
void wxWindowDC::Clear() void wxWindowDC::Clear()