+ if (wxFontMapper::Get()->GetAltForEncoding( eEncoding
+ ,&vInfo
+ ))
+ {
+ if (!vInfo.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(vInfo.facename);
+ }
+ }
+ else
+ {
+ // unsupported encoding, replace with the default
+ vInfo.charset = 850;
+ }
+ }
+ fa.usCodePage = (USHORT)vInfo.charset;
+} // end of wxNativeFontInfo::SetFaceName
+
+bool wxNativeFontInfo::FromString( const wxString& rsStr )
+{
+ long lVal;
+
+ wxStringTokenizer vTokenizer(rsStr, _T(";"));
+
+ //
+ // First the version
+ //
+ wxString sToken = vTokenizer.GetNextToken();
+
+ if (sToken != _T('0'))
+ return false;
+
+ sToken = vTokenizer.GetNextToken();
+ if (!sToken.ToLong(&lVal))
+ return false;
+ fm.lEmHeight = lVal;
+
+ sToken = vTokenizer.GetNextToken();
+ if (!sToken.ToLong(&lVal))
+ return false;
+ fa.lAveCharWidth = lVal;
+
+ sToken = vTokenizer.GetNextToken();
+ if (!sToken.ToLong(&lVal))
+ return false;
+ fa.fsSelection = (USHORT)lVal;
+
+ sToken = vTokenizer.GetNextToken();
+ if (!sToken.ToLong(&lVal))
+ return false;
+ fa.fsType = (USHORT)lVal;
+
+ sToken = vTokenizer.GetNextToken();
+ if (!sToken.ToLong(&lVal))
+ return false;
+ fa.fsFontUse = (USHORT)lVal;
+
+ sToken = vTokenizer.GetNextToken();
+ if (!sToken.ToLong(&lVal))
+ return false;
+ fa.idRegistry = (USHORT)lVal;
+
+ sToken = vTokenizer.GetNextToken();
+ if (!sToken.ToLong(&lVal))
+ return false;
+ fa.usCodePage = (USHORT)lVal;
+
+ sToken = vTokenizer.GetNextToken();
+ if (!sToken.ToLong(&lVal))
+ return false;
+ fa.lMatch = lVal;
+
+ sToken = vTokenizer.GetNextToken();
+ if (!sToken.ToLong(&lVal))
+ return false;
+ fn.usWeightClass = (USHORT)lVal;
+
+ sToken = vTokenizer.GetNextToken();
+ if(!sToken)
+ return false;
+ wxStrcpy((wxChar*)fa.szFacename, sToken.c_str());
+ return true;
+} // end of wxNativeFontInfo::FromString
+
+wxString wxNativeFontInfo::ToString() const
+{
+ wxString sStr;
+
+ sStr.Printf(_T("%d;%ld;%ld;%ld;%d;%d;%d;%d;%d;%ld;%d;%s"),
+ 0, // version, in case we want to change the format later
+ fm.lEmHeight,
+ fa.lAveCharWidth,
+ fa.lMaxBaselineExt,
+ fa.fsSelection,
+ fa.fsType,
+ fa.fsFontUse,
+ fa.idRegistry,
+ fa.usCodePage,
+ fa.lMatch,
+ fn.usWeightClass,
+ (char *)fa.szFacename);
+ return sStr;
+} // end of wxNativeFontInfo::ToString
+
+// ----------------------------------------------------------------------------
+// wxFont
+// ----------------------------------------------------------------------------
+
+bool wxFont::Create( const wxNativeFontInfo& rInfo,
+ WXHFONT hFont )
+{
+ UnRef();
+ m_refData = new wxFontRefData( rInfo
+ ,hFont
+ );
+ RealizeResource();
+ return true;
+} // end of wxFont::Create
+
+wxFont::wxFont(
+ const wxString& rsFontdesc
+)
+{
+ wxNativeFontInfo vInfo;