From 0b2a860f0d3ee4724e3c0c5d2ba67a982c220b4a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 27 Sep 2010 12:48:21 +0000 Subject: [PATCH] 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 --- src/unix/fontutil.cpp | 4 ++-- src/x11/dcclient.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/unix/fontutil.cpp b/src/unix/fontutil.cpp index a9fac62420..39554c0fff 100644 --- a/src/unix/fontutil.cpp +++ b/src/unix/fontutil.cpp @@ -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 // ---------------------------------------------------------------------------- diff --git a/src/x11/dcclient.cpp b/src/x11/dcclient.cpp index 6ef0cb4f33..945b8d5e6c 100644 --- a/src/x11/dcclient.cpp +++ b/src/x11/dcclient.cpp @@ -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.