class MyEncodingEnumerator : public wxFontEnumerator
{
public:
- MyEncodingEnumerator()
+ MyEncodingEnumerator()
{ m_n = 0; }
- const wxString& GetText() const
+ const wxString& GetText() const
{ return m_text; }
protected:
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:
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;
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());
}