X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/942d5e2d7223bde6ae7aceab3ddb3d417b55d48c..58ce18f2fdadecffb21e27555115af708325cf18:/include/wx/dc.h?ds=inline diff --git a/include/wx/dc.h b/include/wx/dc.h index 4981bda64a..82f4848adf 100644 --- a/include/wx/dc.h +++ b/include/wx/dc.h @@ -1377,8 +1377,21 @@ private: class WXDLLIMPEXP_CORE wxDCFontChanger { public: - wxDCFontChanger(wxDC& dc, const wxFont& font) : m_dc(dc), m_fontOld(dc.GetFont()) + wxDCFontChanger(wxDC& dc) + : m_dc(dc), m_fontOld() { + } + + wxDCFontChanger(wxDC& dc, const wxFont& font) + : m_dc(dc), m_fontOld(dc.GetFont()) + { + m_dc.SetFont(font); + } + + void Set(const wxFont& font) + { + if ( !m_fontOld.Ok() ) + m_fontOld = m_dc.GetFont(); m_dc.SetFont(font); }