-// ----------------------------------------------------------------------------
-// wxFontRefData
-// ----------------------------------------------------------------------------
-
-// FIXME: for now, always use single font
-static wxIDirectFBFontPtr gs_font = NULL;
-static unsigned gs_fontRefCnt = 0;
-
-class wxFontRefData : public wxObjectRefData
-{
-public:
- wxFontRefData(int size = wxDEFAULT,
- int family = wxDEFAULT,
- int style = wxDEFAULT,
- int weight = wxDEFAULT,
- bool underlined = false,
- const wxString& faceName = wxEmptyString,
- wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
- {
- if ( family == wxDEFAULT )
- family = wxSWISS;
- if ( style == wxDEFAULT )
- style = wxNORMAL;
- if ( weight == wxDEFAULT )
- weight = wxNORMAL;
- if ( size == wxDEFAULT )
- size = 12;
-
- m_info.family = (wxFontFamily)family;
- m_info.faceName = faceName;
- m_info.style = (wxFontStyle)style;
- m_info.weight = (wxFontWeight)weight;
- m_info.pointSize = size;
- m_info.underlined = underlined;
- m_info.encoding = encoding;
-
- // FIXME: always use default font for now
- if ( !gs_font )
- {
- DFBFontDescription desc;
- desc.flags = (DFBFontDescriptionFlags)0;
- wxIDirectFBFontPtr f(wxIDirectFB::Get()->CreateFont(NULL, &desc));
- if ( f )
- gs_font = f;
- }
- if ( gs_font ) // the above may fail
- {
- gs_fontRefCnt++;
- m_font = gs_font;
- }
- }
-
- wxFontRefData(const wxFontRefData& data)
- {
- m_info = data.m_info;
- m_font = data.m_font;
- }
-
- ~wxFontRefData()
- {
- if ( m_font )
- {
- m_font.Reset();
- // FIXME
- if ( --gs_fontRefCnt == 0 )
- gs_font = NULL;
- }
- }
-
- wxNativeFontInfo m_info;
- wxIDirectFBFontPtr m_font;
-};
-