X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a1624575a3a606543105dbdcf9fa3c47ba837f9b..ca282726be518ce2f214b890dbaafce736f14e36:/src/gtk/textmeasure.cpp diff --git a/src/gtk/textmeasure.cpp b/src/gtk/textmeasure.cpp index 2cc403e046..2032a45df0 100644 --- a/src/gtk/textmeasure.cpp +++ b/src/gtk/textmeasure.cpp @@ -3,6 +3,7 @@ // Purpose: wxTextMeasure implementation for wxGTK // Author: Manuel Martin // Created: 2012-10-05 +// RCS-ID: $Id: // Copyright: (c) 1997-2012 wxWidgets team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -27,6 +28,7 @@ #include "wx/fontutil.h" #include "wx/gtk/private.h" +#include "wx/gtk/dc.h" #ifndef __WXGTK3__ #include "wx/gtk/dcclient.h" @@ -40,11 +42,24 @@ void wxTextMeasure::Init() { wxASSERT_MSG( m_font, wxT("wxTextMeasure needs a valid wxFont") ); + m_context = NULL; + m_layout = NULL; + #ifndef __WXGTK3__ m_wdc = NULL; + + if ( m_dc ) + { + wxClassInfo* const ci = m_dc->GetImpl()->GetClassInfo(); + + // Currently the code here only works with wxWindowDCImpl and only in + // wxGTK2 as wxGTK3 uses Cairo and not Pango for all its DCs. + if ( ci->IsKindOf(wxCLASSINFO(wxWindowDCImpl))) + { + m_useDCImpl = false; + } + } #endif // GTK+ < 3 - m_context = NULL; - m_layout = NULL; } // Get Gtk needed elements, if we have not them yet.