#include "wx/font.h"
#endif // WX_PRECOMP
+#include "wx/fontutil.h" // for wxNativeFontInfo
+
#include "wx/tokenzr.h"
// ============================================================================
return new wxFont(info);
}
-wxNativeFontInfo wxFontBase::GetNativeFontInfo() const
+/* static */
+wxFont *wxFontBase::New(const wxString& strNativeFontDesc)
{
-#if !defined(__WXGTK__)
wxNativeFontInfo fontInfo;
+ if ( !fontInfo.FromString(strNativeFontDesc) )
+ return (wxFont *)NULL;
+
+ return New(fontInfo);
+}
+
+wxNativeFontInfo *wxFontBase::GetNativeFontInfo() const
+{
+#if !defined(__WXGTK__)
+ wxNativeFontInfo *fontInfo = new wxNativeFontInfo;
- fontInfo.pointSize = GetPointSize();
- fontInfo.family = GetFamily();
- fontInfo.style = GetStyle();
- fontInfo.weight = GetWeight();
- fontInfo.underlined = GetUnderlined();
- fontInfo.faceName = GetFaceName();
- fontInfo.encoding = GetEncoding();
+ fontInfo->pointSize = GetPointSize();
+ fontInfo->family = GetFamily();
+ fontInfo->style = GetStyle();
+ fontInfo->weight = GetWeight();
+ fontInfo->underlined = GetUnderlined();
+ fontInfo->faceName = GetFaceName();
+ fontInfo->encoding = GetEncoding();
return fontInfo;
#else
- return wxNullNativeFontInfo;
+ return (wxNativeFontInfo *)NULL;
#endif
}
#endif
}
+wxString wxFontBase::GetNativeFontInfoDesc() const
+{
+ wxString fontDesc;
+ wxNativeFontInfo *fontInfo = GetNativeFontInfo();
+ if ( fontInfo )
+ {
+ fontDesc = fontInfo->ToString();
+ delete fontInfo;
+ }
+
+ return fontDesc;
+}
+
wxFont& wxFont::operator=(const wxFont& font)
{
if ( this != &font )
token = tokenizer.GetNextToken();
if ( !token.ToLong(&l) )
return FALSE;
- underlined = (int)l;
+ underlined = l != 0;
faceName = tokenizer.GetNextToken();
if( !faceName )
{
wxString s;
- s.Printf("%d;%d;%d;%d;%d;%s;%d",
+ s.Printf(_T("%d;%d;%d;%d;%d;%s;%d"),
pointSize,
family,
style,
return s;
}
-#endif
+#endif // generic wxNativeFontInfo implementation