+ wxStrncpy(lf.lfFaceName, facename, WXSIZEOF(lf.lfFaceName));
+}
+
+void wxNativeFontInfo::SetFamily(wxFontFamily family)
+{
+ int ff_family;
+ wxString facename;
+
+ switch ( family )
+ {
+ case wxSCRIPT:
+ ff_family = FF_SCRIPT;
+ facename = _T("Script");
+ break;
+
+ case wxDECORATIVE:
+ ff_family = FF_DECORATIVE;
+ facename = _T("Old English Text MT");
+ break;
+
+ case wxROMAN:
+ ff_family = FF_ROMAN;
+ facename = _T("Times New Roman");
+ break;
+
+ case wxTELETYPE:
+ case wxMODERN:
+ ff_family = FF_MODERN;
+ facename = _T("Courier New");
+ break;
+
+ case wxSWISS:
+ ff_family = FF_SWISS;
+ facename = _T("Arial");
+ break;
+
+ case wxDEFAULT:
+ default:
+ ff_family = FF_SWISS;
+ facename = _T("MS Sans Serif");
+ }
+
+ lf.lfPitchAndFamily = DEFAULT_PITCH | ff_family;
+
+ if ( !wxStrlen(lf.lfFaceName) )
+ {
+ SetFaceName(facename);
+ }
+}
+
+void wxNativeFontInfo::SetEncoding(wxFontEncoding encoding)
+{
+ wxNativeEncodingInfo info;
+ if ( !wxGetNativeFontEncoding(encoding, &info) )
+ {
+#if wxUSE_FONTMAP
+ if ( wxFontMapper::Get()->GetAltForEncoding(encoding, &info) )
+ {
+ if ( !info.facename.empty() )
+ {
+ // if we have this encoding only in some particular facename, use
+ // the facename - it is better to show the correct characters in a
+ // wrong facename than unreadable text in a correct one
+ SetFaceName(info.facename);
+ }
+ }
+ else
+#endif // wxUSE_FONTMAP
+ {
+ // unsupported encoding, replace with the default
+ info.charset = DEFAULT_CHARSET;
+ }
+ }
+
+ lf.lfCharSet = info.charset;
+}
+
+bool wxNativeFontInfo::FromString(const wxString& s)
+{
+ long l;
+
+ wxStringTokenizer tokenizer(s, _T(";"));
+
+ // first the version
+ wxString token = tokenizer.GetNextToken();
+ if ( token != _T('0') )
+ return FALSE;
+
+ token = tokenizer.GetNextToken();
+ if ( !token.ToLong(&l) )
+ return FALSE;
+ lf.lfHeight = l;
+
+ token = tokenizer.GetNextToken();
+ if ( !token.ToLong(&l) )
+ return FALSE;
+ lf.lfWidth = l;
+
+ token = tokenizer.GetNextToken();
+ if ( !token.ToLong(&l) )
+ return FALSE;
+ lf.lfEscapement = l;
+
+ token = tokenizer.GetNextToken();
+ if ( !token.ToLong(&l) )
+ return FALSE;
+ lf.lfOrientation = l;
+
+ token = tokenizer.GetNextToken();
+ if ( !token.ToLong(&l) )
+ return FALSE;
+ lf.lfWeight = l;
+
+ token = tokenizer.GetNextToken();
+ if ( !token.ToLong(&l) )
+ return FALSE;
+ lf.lfItalic = (BYTE)l;
+
+ token = tokenizer.GetNextToken();
+ if ( !token.ToLong(&l) )
+ return FALSE;
+ lf.lfUnderline = (BYTE)l;
+
+ token = tokenizer.GetNextToken();
+ if ( !token.ToLong(&l) )
+ return FALSE;
+ lf.lfStrikeOut = (BYTE)l;
+
+ token = tokenizer.GetNextToken();
+ if ( !token.ToLong(&l) )
+ return FALSE;
+ lf.lfCharSet = (BYTE)l;
+
+ token = tokenizer.GetNextToken();
+ if ( !token.ToLong(&l) )
+ return FALSE;
+ lf.lfOutPrecision = (BYTE)l;
+
+ token = tokenizer.GetNextToken();
+ if ( !token.ToLong(&l) )
+ return FALSE;
+ lf.lfClipPrecision = (BYTE)l;
+
+ token = tokenizer.GetNextToken();
+ if ( !token.ToLong(&l) )
+ return FALSE;
+ lf.lfQuality = (BYTE)l;
+
+ token = tokenizer.GetNextToken();
+ if ( !token.ToLong(&l) )
+ return FALSE;
+ lf.lfPitchAndFamily = (BYTE)l;
+
+ token = tokenizer.GetNextToken();
+ if(!token)
+ return FALSE;
+ wxStrcpy(lf.lfFaceName, token.c_str());
+