]> git.saurik.com Git - wxWidgets.git/commitdiff
Use PangoFontMetrics to get wxDC::GetCharHeight, because that's the proper and clean...
authorMart Raudsepp <leio@gentoo.org>
Sun, 9 Jul 2006 03:46:01 +0000 (03:46 +0000)
committerMart Raudsepp <leio@gentoo.org>
Sun, 9 Jul 2006 03:46:01 +0000 (03:46 +0000)
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

src/gtk/dcclient.cpp

index 805f66d495d09bba4b48d84874cbead6f5464389..e0898d91d0ae166ee6d2b87fdfea2adbaeca3e5d 100644 (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 );
-    int h;
-    pango_layout_get_pixel_size( m_layout, NULL, &h );
-    return h;
+    PangoFontMetrics *metrics = pango_context_get_metrics (m_context, m_fontdesc, NULL);
+    return PANGO_PIXELS (pango_font_metrics_get_descent (metrics) + pango_font_metrics_get_ascent (metrics));
 }
 
 void wxWindowDC::Clear()
 }
 
 void wxWindowDC::Clear()