Use wxString methods for UTF-8 conversions in wxX11 code.
Use wxString::utf8_str() and FromUTF8() to convert to and from UTF-8. This is more efficient than using wxConvUTF8 as the code did before as it avoids the conversion entirely when wxString uses UTF-8 internally (as it does by default in wxX11) and also has the advantage of compiling in STL build unlike the old code. Closes #12518. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65657 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
02e2609962
commit
0b2a860f0d
@ -53,8 +53,8 @@
|
||||
#include "wx/x11/private.h"
|
||||
#include "wx/gtk/private/string.h"
|
||||
|
||||
#define wxPANGO_CONV(s) (wxConvUTF8.cWX2MB((s)))
|
||||
#define wxPANGO_CONV_BACK(s) (wxConvUTF8.cMB2WX((s)))
|
||||
#define wxPANGO_CONV(s) s.utf8_str()
|
||||
#define wxPANGO_CONV_BACK(s) wxString::FromUTF8Unchecked(s)
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@ -1570,7 +1570,7 @@ void wxWindowDCImpl::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
|
||||
PangoLayout *layout = pango_layout_new(m_context);
|
||||
pango_layout_set_font_description(layout, m_fontdesc);
|
||||
|
||||
const wxCharBuffer data = wxConvUTF8.cWC2MB( text );
|
||||
const wxScopedCharBuffer data(text.utf8_str());
|
||||
pango_layout_set_text(layout, data, data.length());
|
||||
|
||||
// Measure layout.
|
||||
@ -1675,7 +1675,7 @@ void wxWindowDCImpl::DoGetTextExtent( const wxString &string, wxCoord *width, wx
|
||||
else
|
||||
pango_layout_set_font_description(layout, m_fontdesc);
|
||||
|
||||
const wxCharBuffer data = wxConvUTF8.cWC2MB( string );
|
||||
const wxScopedCharBuffer data(string.utf8_str());
|
||||
pango_layout_set_text(layout, data, data.length());
|
||||
|
||||
// Measure text.
|
||||
|
Loading…
Reference in New Issue
Block a user