X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a246f95e96183bc81bf5be5e1927d9bb53094f55..31c8af3abb1150658652f506e76af7fa1bb86898:/src/mgl/font.cpp diff --git a/src/mgl/font.cpp b/src/mgl/font.cpp index ff9f73343d..e3ac9a29d2 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 ///////////////////////////////////////////////////////////////////////////// @@ -33,6 +33,7 @@ #include "wx/gdicmn.h" #include "wx/tokenzr.h" #include "wx/settings.h" +#include "wx/mgl/private.h" // ---------------------------------------------------------------------------- // wxFontRefData @@ -191,20 +192,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 // ---------------------------------------------------------------------------- @@ -259,6 +257,13 @@ wxFontEncoding wxFont::GetEncoding() const return M_FONTDATA->m_encoding; } +bool wxFont::IsFixedWidth() const +{ + wxCHECK_MSG( Ok(), FALSE, wxT("invalid font") ); + + return (bool)(M_FONTDATA->m_library->GetFamily()->GetInfo()->isFixed); +} + // ---------------------------------------------------------------------------- // change font attributes @@ -266,7 +271,7 @@ wxFontEncoding wxFont::GetEncoding() const void wxFont::SetPointSize(int pointSize) { - Unshare(); + AllocExclusive(); M_FONTDATA->m_pointSize = pointSize; M_FONTDATA->m_valid = FALSE; @@ -274,7 +279,7 @@ void wxFont::SetPointSize(int pointSize) void wxFont::SetFamily(int family) { - Unshare(); + AllocExclusive(); M_FONTDATA->m_family = family; M_FONTDATA->m_valid = FALSE; @@ -282,7 +287,7 @@ void wxFont::SetFamily(int family) void wxFont::SetStyle(int style) { - Unshare(); + AllocExclusive(); M_FONTDATA->m_style = style; M_FONTDATA->m_valid = FALSE; @@ -290,7 +295,7 @@ void wxFont::SetStyle(int style) void wxFont::SetWeight(int weight) { - Unshare(); + AllocExclusive(); M_FONTDATA->m_weight = weight; M_FONTDATA->m_valid = FALSE; @@ -298,7 +303,7 @@ void wxFont::SetWeight(int weight) void wxFont::SetFaceName(const wxString& faceName) { - Unshare(); + AllocExclusive(); M_FONTDATA->m_faceName = faceName; M_FONTDATA->m_valid = FALSE; @@ -306,14 +311,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;