int weight = wxDEFAULT,
bool underlined = FALSE,
const wxString& faceName = wxEmptyString,
- wxFontEncoding encoding = wxFONTENCODING_DEFAULT,
- const wxNativeFontInfo& info = wxNullNativeFontInfo);
+ wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
wxFontRefData( const wxFontRefData& data );
virtual ~wxFontRefData();
int weight,
bool underlined,
const wxString& faceName,
- wxFontEncoding encoding,
- const wxNativeFontInfo& info);
+ wxFontEncoding encoding);
private:
wxList m_scaled_xfonts;
bool m_underlined;
wxString m_faceName;
wxFontEncoding m_encoding;
+
wxNativeFontInfo m_nativeFontInfo;
friend class wxFont;
int weight,
bool underlined,
const wxString& faceName,
- wxFontEncoding encoding,
- const wxNativeFontInfo& info = wxNullNativeFontInfo)
+ wxFontEncoding encoding)
{
if (family == wxDEFAULT)
m_family = wxSWISS;
m_underlined = underlined;
m_encoding = encoding;
- m_nativeFontInfo = info;
}
wxFontRefData::wxFontRefData( const wxFontRefData& data )
: m_scaled_xfonts(wxKEY_INTEGER)
{
Init(data.m_pointSize, data.m_family, data.m_style, data.m_weight,
- data.m_underlined, data.m_faceName, data.m_encoding,
- data.m_nativeFontInfo );
+ data.m_underlined, data.m_faceName, data.m_encoding);
}
wxFontRefData::wxFontRefData(int size, int family, int style,
- int weight, bool underlined, const wxString& faceName, wxFontEncoding encoding,
- const wxNativeFontInfo& info = wxNullNativeFontInfo)
+ int weight, bool underlined,
+ const wxString& faceName,
+ wxFontEncoding encoding)
: m_scaled_xfonts(wxKEY_INTEGER)
{
- Init(size, family, style, weight,
- underlined, faceName, encoding, info);
+ Init(size, family, style, weight, underlined, faceName, encoding);
}
wxFontRefData::~wxFontRefData()
bool wxNativeFontInfo::FromString(const wxString& s)
{
- xFontName = s;
+ wxStringTokenizer tokenizer(s, _T(";"));
+
+ wxString token = tokenizer.GetNextToken();
+ //
+ // Ignore the version for now
+ //
+
+ xFontName = tokenizer.GetNextToken();
+ if(!xFontName)
+ return FALSE;
+
return TRUE;
}
wxString wxNativeFontInfo::ToString() const
{
- return xFontName;
+ wxString s;
+
+ s.Printf(_T("%d;%s"),
+ 0, // version
+ xFontName.c_str());
+
+ return s;
}
// ----------------------------------------------------------------------------
void wxFont::Init()
{
- if (wxTheFontList)
- wxTheFontList->Append( this );
}
wxFont::wxFont(const wxNativeFontInfo& info)
{
- Create(info.xFontName, wxFontData());
+ Init();
+
+ Create(info.xFontName);
+}
+
+bool wxFont::Create(const wxNativeFontInfo& info)
+{
+ return Create(info.xFontName);
}
bool wxFont::Create( int pointSize,
int weight,
bool underlined,
const wxString& face,
- wxFontEncoding encoding,
- const wxNativeFontInfo& info )
+ wxFontEncoding encoding)
{
m_refData = new wxFontRefData(pointSize, family, style, weight,
- underlined, face, encoding, info);
+ underlined, face, encoding);
return TRUE;
}
-bool wxFont::Create(const wxString& fontname, const wxFontData& fontdata)
+bool wxFont::Create(const wxString& fontname, wxFontEncoding enc)
{
- Init();
-
- if(!fontname)
+ if( !fontname )
{
*this = wxSystemSettings::GetSystemFont( wxSYS_DEFAULT_GUI_FONT);
return TRUE;
tn.GetNextToken(); // avg width
// deal with font encoding
- M_FONTDATA->m_encoding = fontdata.GetEncoding();
+ M_FONTDATA->m_encoding = enc;
if ( M_FONTDATA->m_encoding == wxFONTENCODING_SYSTEM )
{
wxString registry = tn.GetNextToken().MakeUpper(),
wxFont::~wxFont()
{
- if (wxTheFontList)
- wxTheFontList->DeleteObject( this );
}
// ----------------------------------------------------------------------------
return M_FONTDATA->m_encoding;
}
-wxNativeFontInfo wxFont::GetNativeFontInfo() const
+wxNativeFontInfo *wxFont::GetNativeFontInfo() const
{
- wxCHECK_MSG( Ok(), wxNullNativeFontInfo, wxT("invalid font") );
+ wxCHECK_MSG( Ok(), (wxNativeFontInfo *)NULL, wxT("invalid font") );
if(M_FONTDATA->m_nativeFontInfo.xFontName.IsEmpty())
GetInternalFont();
- return M_FONTDATA->m_nativeFontInfo;
+
+ return new wxNativeFontInfo(M_FONTDATA->m_nativeFontInfo);
}
}
gtk_widget_destroy( widget );
}
+ else
+ {
+ // already have it, but ref it once more before returning
+ gdk_font_ref(g_systemDefaultGuiFont);
+ }
+
return g_systemDefaultGuiFont;
}