From 4837b89e3b9ddc02a752d9937e3e1d9f92328851 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Sat, 22 Oct 2005 08:51:12 +0000 Subject: [PATCH] Use GetFont not m_font for GetCharHeight git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35981 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/x11/window.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/x11/window.cpp b/src/x11/window.cpp index 000e1721e1..0a44944c1a 100644 --- a/src/x11/window.cpp +++ b/src/x11/window.cpp @@ -993,12 +993,13 @@ void wxWindowX11::DoSetSizeHints(int minW, int minH, int maxW, int maxH, int inc int wxWindowX11::GetCharHeight() const { - wxCHECK_MSG( m_font.Ok(), 0, wxT("valid window font needed") ); + wxFont font(GetFont()); + wxCHECK_MSG( font.Ok(), 0, wxT("valid window font needed") ); #if wxUSE_UNICODE // There should be an easier way. PangoLayout *layout = pango_layout_new( wxTheApp->GetPangoContext() ); - pango_layout_set_font_description( layout, GetFont().GetNativeFontInfo()->description ); + pango_layout_set_font_description( layout, font.GetNativeFontInfo()->description ); pango_layout_set_text(layout, "H", 1 ); int w,h; pango_layout_get_pixel_size(layout, &w, &h); @@ -1006,7 +1007,7 @@ int wxWindowX11::GetCharHeight() const return h; #else - WXFontStructPtr pFontStruct = m_font.GetFontStruct(1.0, wxGlobalDisplay()); + WXFontStructPtr pFontStruct = font.GetFontStruct(1.0, wxGlobalDisplay()); int direction, ascent, descent; XCharStruct overall; @@ -1020,12 +1021,13 @@ int wxWindowX11::GetCharHeight() const int wxWindowX11::GetCharWidth() const { - wxCHECK_MSG( m_font.Ok(), 0, wxT("valid window font needed") ); + wxFont font(GetFont()); + wxCHECK_MSG( font.Ok(), 0, wxT("valid window font needed") ); #if wxUSE_UNICODE // There should be an easier way. PangoLayout *layout = pango_layout_new( wxTheApp->GetPangoContext() ); - pango_layout_set_font_description( layout, GetFont().GetNativeFontInfo()->description ); + pango_layout_set_font_description( layout, font.GetNativeFontInfo()->description ); pango_layout_set_text(layout, "H", 1 ); int w,h; pango_layout_get_pixel_size(layout, &w, &h); @@ -1033,7 +1035,7 @@ int wxWindowX11::GetCharWidth() const return w; #else - WXFontStructPtr pFontStruct = m_font.GetFontStruct(1.0, wxGlobalDisplay()); + WXFontStructPtr pFontStruct = font.GetFontStruct(1.0, wxGlobalDisplay()); int direction, ascent, descent; XCharStruct overall; @@ -1049,7 +1051,7 @@ void wxWindowX11::GetTextExtent(const wxString& string, int *descent, int *externalLeading, const wxFont *theFont) const { - wxFont fontToUse = m_font; + wxFont fontToUse = GetFont(); if (theFont) fontToUse = *theFont; wxCHECK_RET( fontToUse.Ok(), wxT("invalid font") ); -- 2.45.2