X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f3437beb5d119ef51d058a35ef8933b412f77576..4647fc083374a841380c181789336ff602975fbc:/src/mgl/font.cpp diff --git a/src/mgl/font.cpp b/src/mgl/font.cpp index 3120a1d59f..6bb8af4e47 100644 --- a/src/mgl/font.cpp +++ b/src/mgl/font.cpp @@ -2,7 +2,7 @@ // Name: font.cpp // Author: Vaclav Slavik // Id: $Id$ -// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) +// Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com) // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -14,10 +14,6 @@ // headers // ---------------------------------------------------------------------------- -#ifdef __GNUG__ - #pragma implementation "font.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -74,6 +70,8 @@ private: wxMGLFontLibrary *m_library; bool m_valid; + wxNativeFontInfo m_info; + friend class wxFont; }; @@ -192,20 +190,17 @@ struct font_t *wxFont::GetMGLfont_t(float scale, bool antialiased) return instance->GetMGLfont_t(); } -void wxFont::Unshare() +wxObjectRefData *wxFont::CreateRefData() const { - if ( !m_refData ) - { - m_refData = new wxFontRefData(); - } - else - { - wxFontRefData* ref = new wxFontRefData(*(wxFontRefData*)m_refData); - UnRef(); - m_refData = ref; - } + return new wxFontRefData; } +wxObjectRefData *wxFont::CloneRefData(const wxObjectRefData *data) const +{ + return new wxFontRefData(*(wxFontRefData *)data); +} + + // ---------------------------------------------------------------------------- // accessors // ---------------------------------------------------------------------------- @@ -267,6 +262,14 @@ bool wxFont::IsFixedWidth() const return (bool)(M_FONTDATA->m_library->GetFamily()->GetInfo()->isFixed); } +const wxNativeFontInfo *wxFont::GetNativeFontInfo() const +{ + wxCHECK_MSG( Ok(), NULL, wxT("invalid font") ); + + M_FONTDATA->m_info.InitFromFont(*this); + + return &(M_FONTDATA->m_info); +} // ---------------------------------------------------------------------------- // change font attributes @@ -274,7 +277,7 @@ bool wxFont::IsFixedWidth() const void wxFont::SetPointSize(int pointSize) { - Unshare(); + AllocExclusive(); M_FONTDATA->m_pointSize = pointSize; M_FONTDATA->m_valid = FALSE; @@ -282,7 +285,7 @@ void wxFont::SetPointSize(int pointSize) void wxFont::SetFamily(int family) { - Unshare(); + AllocExclusive(); M_FONTDATA->m_family = family; M_FONTDATA->m_valid = FALSE; @@ -290,7 +293,7 @@ void wxFont::SetFamily(int family) void wxFont::SetStyle(int style) { - Unshare(); + AllocExclusive(); M_FONTDATA->m_style = style; M_FONTDATA->m_valid = FALSE; @@ -298,7 +301,7 @@ void wxFont::SetStyle(int style) void wxFont::SetWeight(int weight) { - Unshare(); + AllocExclusive(); M_FONTDATA->m_weight = weight; M_FONTDATA->m_valid = FALSE; @@ -306,7 +309,7 @@ void wxFont::SetWeight(int weight) void wxFont::SetFaceName(const wxString& faceName) { - Unshare(); + AllocExclusive(); M_FONTDATA->m_faceName = faceName; M_FONTDATA->m_valid = FALSE; @@ -314,14 +317,14 @@ void wxFont::SetFaceName(const wxString& faceName) void wxFont::SetUnderlined(bool underlined) { - Unshare(); + AllocExclusive(); M_FONTDATA->m_underlined = underlined; } void wxFont::SetEncoding(wxFontEncoding encoding) { - Unshare(); + AllocExclusive(); M_FONTDATA->m_encoding = encoding; M_FONTDATA->m_valid = FALSE;