X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/873fd4af5f9ed1f078636af1ae9ea21bbed06b5a..05e0b047d879cdbfade7f2ab346c0acdf3e29f96:/src/os2/font.cpp diff --git a/src/os2/font.cpp b/src/os2/font.cpp index 61db533606..4a97f97c28 100644 --- a/src/os2/font.cpp +++ b/src/os2/font.cpp @@ -297,7 +297,7 @@ protected: bool m_bInternalPS; // Internally generated PS? }; // end of CLASS wxFontRefData -#define M_FONTDATA (wxFontRefData*)m_refData) +#define M_FONTDATA ((wxFontRefData*)m_refData) // ============================================================================ // implementation @@ -857,7 +857,7 @@ wxString wxNativeFontInfo::ToString() const fa.usCodePage, fa.lMatch, fn.usWeightClass, - fa.szFacename); + (char *)fa.szFacename); return sStr; } // end of wxNativeFontInfo::ToString @@ -931,6 +931,16 @@ wxFont::~wxFont() // here, but we may check that font definition is true // ---------------------------------------------------------------------------- +wxGDIRefData *wxFont::CreateGDIRefData() const +{ + return new wxFontRefData(); +} + +wxGDIRefData *wxFont::CloneGDIRefData(const wxGDIRefData *data) const +{ + return new wxFontRefData(*wx_static_cast(const wxFontRefData *, data)); +} + bool wxFont::RealizeResource() { if ( GetResourceHandle() ) @@ -965,21 +975,6 @@ bool wxFont::IsFree() const return M_FONTDATA && (M_FONTDATA->GetHFONT() == 0); } // end of wxFont::IsFree -void wxFont::Unshare() -{ - // Don't change shared data - if ( !m_refData ) - { - m_refData = new wxFontRefData(); - } - else - { - wxFontRefData* ref = new wxFontRefData(*M_FONTDATA); - UnRef(); - m_refData = ref; - } -} // end of wxFont::Unshare - // ---------------------------------------------------------------------------- // change font attribute: we recreate font when doing it // ---------------------------------------------------------------------------- @@ -988,7 +983,7 @@ void wxFont::SetPointSize( int nPointSize ) { - Unshare(); + AllocExclusive(); M_FONTDATA->SetPointSize(nPointSize); @@ -999,7 +994,7 @@ void wxFont::SetFamily( int nFamily ) { - Unshare(); + AllocExclusive(); M_FONTDATA->SetFamily(nFamily); @@ -1010,7 +1005,7 @@ void wxFont::SetStyle( int nStyle ) { - Unshare(); + AllocExclusive(); M_FONTDATA->SetStyle(nStyle); @@ -1021,7 +1016,7 @@ void wxFont::SetWeight( int nWeight ) { - Unshare(); + AllocExclusive(); M_FONTDATA->SetWeight(nWeight); @@ -1032,7 +1027,7 @@ bool wxFont::SetFaceName( const wxString& rsFaceName ) { - Unshare(); + AllocExclusive(); bool refdataok = M_FONTDATA->SetFaceName(rsFaceName); @@ -1045,7 +1040,7 @@ void wxFont::SetUnderlined( bool bUnderlined ) { - Unshare(); + AllocExclusive(); M_FONTDATA->SetUnderlined(bUnderlined); @@ -1056,7 +1051,7 @@ void wxFont::SetEncoding( wxFontEncoding vEncoding ) { - Unshare(); + AllocExclusive(); M_FONTDATA->SetEncoding(vEncoding); @@ -1067,7 +1062,7 @@ void wxFont::DoSetNativeFontInfo( const wxNativeFontInfo& rInfo ) { - Unshare(); + AllocExclusive(); FreeResource(); @@ -1147,7 +1142,7 @@ void wxFont::SetFM( PFONTMETRICS pFM, int nNumFonts ) void wxFont::SetPS( HPS hPS ) { - Unshare(); + AllocExclusive(); M_FONTDATA->SetPS(hPS);