X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f08b7bec7f042cc8df4be88504f50961dae36697..105fbe1ffa8968cb85fd2cac7192957e522d17ba:/src/mac/carbon/font.cpp diff --git a/src/mac/carbon/font.cpp b/src/mac/carbon/font.cpp index bd90c3bdf1..fe8a315e25 100644 --- a/src/mac/carbon/font.cpp +++ b/src/mac/carbon/font.cpp @@ -254,6 +254,7 @@ void wxFontRefData::MacFindFont() break ; case wxMODERN : + case wxTELETYPE: m_faceName = wxT("Monaco"); break ; @@ -444,26 +445,31 @@ bool wxFont::RealizeResource() void wxFont::SetEncoding(wxFontEncoding encoding) { - AllocExclusive(); + Unshare(); M_FONTDATA->m_encoding = encoding; RealizeResource(); } -wxObjectRefData* wxFont::CreateRefData() const +void wxFont::Unshare() { - return new wxFontRefData; -} - -wxObjectRefData* wxFont::CloneRefData(const wxObjectRefData* data) const -{ - return new wxFontRefData(*wx_static_cast(const wxFontRefData*, data)); + // Don't change shared data + if (!m_refData) + { + m_refData = new wxFontRefData(); + } + else + { + wxFontRefData* ref = new wxFontRefData(*(wxFontRefData*)m_refData); + UnRef(); + m_refData = ref; + } } void wxFont::SetPointSize(int pointSize) { - AllocExclusive(); + Unshare(); M_FONTDATA->m_pointSize = pointSize; @@ -472,7 +478,7 @@ void wxFont::SetPointSize(int pointSize) void wxFont::SetFamily(int family) { - AllocExclusive(); + Unshare(); M_FONTDATA->m_family = family; @@ -481,7 +487,7 @@ void wxFont::SetFamily(int family) void wxFont::SetStyle(int style) { - AllocExclusive(); + Unshare(); M_FONTDATA->m_style = style; @@ -490,7 +496,7 @@ void wxFont::SetStyle(int style) void wxFont::SetWeight(int weight) { - AllocExclusive(); + Unshare(); M_FONTDATA->m_weight = weight; @@ -499,7 +505,7 @@ void wxFont::SetWeight(int weight) bool wxFont::SetFaceName(const wxString& faceName) { - AllocExclusive(); + Unshare(); M_FONTDATA->m_faceName = faceName; @@ -510,7 +516,7 @@ bool wxFont::SetFaceName(const wxString& faceName) void wxFont::SetUnderlined(bool underlined) { - AllocExclusive(); + Unshare(); M_FONTDATA->m_underlined = underlined; @@ -519,7 +525,7 @@ void wxFont::SetUnderlined(bool underlined) void wxFont::SetNoAntiAliasing( bool no ) { - AllocExclusive(); + Unshare(); M_FONTDATA->SetNoAntiAliasing( no );