X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/51146826fc0a0a949d88f23fb9d83fc1f1ada14e..b2680ced12cbbed16990007c5fa3ea7730700122:/src/cocoa/font.mm?ds=sidebyside diff --git a/src/cocoa/font.mm b/src/cocoa/font.mm index e18a4768b3..bac3a57df9 100644 --- a/src/cocoa/font.mm +++ b/src/cocoa/font.mm @@ -319,7 +319,7 @@ bool wxFont::Create(wxFontRefData *refData) { UnRef(); m_refData = refData; - + return m_refData != NULL; } @@ -327,10 +327,20 @@ bool wxFont::Create(const wxNativeFontInfo& nativeFontInfo) { UnRef(); m_refData = new wxFontRefData(nativeFontInfo); - + return true; } +wxGDIRefData *wxFont::CreateGDIRefData() const +{ + return new wxFontRefData; +} + +wxGDIRefData *wxFont::CloneGDIRefData(const wxGDIRefData *data) const +{ + return new wxFontRefData(*wx_static_cast(const wxFontRefData *, data)); +} + void wxFont::SetEncoding(wxFontEncoding) { } @@ -398,24 +408,9 @@ bool wxFont::RealizeResource() return false; } -void wxFont::Unshare() -{ - // 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) { - Unshare(); + AllocExclusive(); M_FONTDATA->m_info.pointSize = pointSize; @@ -424,7 +419,7 @@ void wxFont::SetPointSize(int pointSize) void wxFont::SetFamily(int family) { - Unshare(); + AllocExclusive(); M_FONTDATA->m_info.family = static_cast(family); @@ -433,7 +428,7 @@ void wxFont::SetFamily(int family) void wxFont::SetStyle(int style) { - Unshare(); + AllocExclusive(); M_FONTDATA->m_info.style = static_cast(style); @@ -442,7 +437,7 @@ void wxFont::SetStyle(int style) void wxFont::SetWeight(int weight) { - Unshare(); + AllocExclusive(); M_FONTDATA->m_info.weight = static_cast(weight); @@ -451,7 +446,7 @@ void wxFont::SetWeight(int weight) bool wxFont::SetFaceName(const wxString& faceName) { - Unshare(); + AllocExclusive(); M_FONTDATA->m_info.faceName = faceName; @@ -462,7 +457,7 @@ bool wxFont::SetFaceName(const wxString& faceName) void wxFont::SetUnderlined(bool underlined) { - Unshare(); + AllocExclusive(); M_FONTDATA->m_info.underlined = underlined;