+ 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,
+ 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;
+
+ if (vInfo.FromString(rsFontdesc))
+ (void)Create(vInfo);
+} // end of wxFont::wxFont
+
+// ----------------------------------------------------------------------------
+// Constructor for a font. Note that the real construction is done
+// in wxDC::SetFont, when information is available about scaling etc.
+// ----------------------------------------------------------------------------
+bool wxFont::Create( int nPointSize,
+ int nFamily,
+ int nStyle,
+ int nWeight,
+ bool bUnderlined,
+ const wxString& rsFaceName,
+ wxFontEncoding vEncoding )
+{
+ UnRef();
+
+ //
+ // wxDEFAULT is a valid value for the font size too so we must treat it
+ // specially here (otherwise the size would be 70 == wxDEFAULT value)
+ //
+ if (nPointSize == wxDEFAULT)