+ wxFontEncoding enc = GetEncodingFromUser();
+ if ( enc != wxFONTENCODING_SYSTEM )
+ {
+ DoEnumerateFamilies(false, enc);
+ }
+}
+
+void MyFrame::OnSetNativeDesc(wxCommandEvent& WXUNUSED(event))
+{
+ wxString fontInfo = wxGetTextFromUser
+ (
+ wxT("Enter native font string"),
+ wxT("Input font description"),
+ m_canvas->GetTextFont().GetNativeFontInfoDesc(),
+ this
+ );
+ if ( fontInfo.empty() )
+ return; // user clicked "Cancel" - do nothing
+
+ wxFont font;
+ font.SetNativeFontInfo(fontInfo);
+ if ( !font.Ok() )
+ {
+ wxLogError(wxT("Font info string \"%s\" is invalid."),
+ fontInfo.c_str());
+ return;
+ }
+
+ DoChangeFont(font);
+}
+
+void MyFrame::OnSetFaceName(wxCommandEvent& WXUNUSED(event))
+{
+ wxString facename = GetCanvas()->GetTextFont().GetFaceName();
+ wxString newFaceName = wxGetTextFromUser(
+ wxT("Here you can edit current font face name."),
+ wxT("Input font facename"), facename,
+ this);
+ if (newFaceName.IsEmpty())
+ return; // user clicked "Cancel" - do nothing
+
+ wxFont font(GetCanvas()->GetTextFont());
+ if (font.SetFaceName(newFaceName)) // change facename only
+ {
+ wxASSERT_MSG(font.Ok(), wxT("The font should now be valid"));
+ DoChangeFont(font);
+ }
+ else
+ {
+ wxASSERT_MSG(!font.Ok(), wxT("The font should now be invalid"));
+ wxMessageBox(wxT("There is no font with such face name..."),
+ wxT("Invalid face name"), wxOK|wxICON_ERROR, this);
+ }
+}
+
+void MyFrame::OnSetNativeUserDesc(wxCommandEvent& WXUNUSED(event))
+{
+ wxString fontdesc = GetCanvas()->GetTextFont().GetNativeFontInfoUserDesc();
+ wxString fontUserInfo = wxGetTextFromUser(
+ wxT("Here you can edit current font description"),
+ wxT("Input font description"), fontdesc,
+ this);
+ if (fontUserInfo.IsEmpty())
+ return; // user clicked "Cancel" - do nothing
+
+ wxFont font;
+ if (font.SetNativeFontInfoUserDesc(fontUserInfo))