X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/03424b1b897ff207c3fefc8d9af47ed2f0f9cb05..6c41903ced78c0b4115785aa80a934833abbc1ef:/samples/font/font.cpp diff --git a/samples/font/font.cpp b/samples/font/font.cpp index 10cbdefa46..d919ea6a59 100644 --- a/samples/font/font.cpp +++ b/samples/font/font.cpp @@ -262,10 +262,10 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) class MyEncodingEnumerator : public wxFontEnumerator { public: - MyEncodingEnumerator() + MyEncodingEnumerator() { m_n = 0; } - const wxString& GetText() const + const wxString& GetText() const { return m_text; } protected: @@ -299,10 +299,10 @@ void MyFrame::OnEnumerateEncodings(wxCommandEvent& WXUNUSED(event)) class MyFontEnumerator : public wxFontEnumerator { public: - bool GotAny() const + bool GotAny() const { return !m_facenames.IsEmpty(); } - const wxArrayString& GetFacenames() const + const wxArrayString& GetFacenames() const { return m_facenames; } protected: @@ -557,14 +557,15 @@ void MyFrame::OnViewMsg(wxCommandEvent& WXUNUSED(event)) m_textctrl->LoadFile(filename); - if (!wxTheFontMapper->IsEncodingAvailable(fontenc)) + if ( fontenc == wxFONTENCODING_UTF8 || + !wxTheFontMapper->IsEncodingAvailable(fontenc) ) { // try to find some similar encoding: wxFontEncoding encAlt; if ( wxTheFontMapper->GetAltForEncoding(fontenc, &encAlt) ) { wxEncodingConverter conv; - + if (conv.Init(fontenc, encAlt)) { fontenc = encAlt; @@ -677,7 +678,7 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) ) if ( m_font.Ok() ) { wxString fontDesc = m_font.GetNativeFontInfoDesc(); - dc.SetFont(wxFont(fontDesc)); + dc.SetFont(m_font); fontInfo.Printf("Native font info: %s", fontDesc.c_str()); dc.DrawText(fontInfo, 5, 5 + dc.GetCharHeight()); }