break ;
case wxMODERN :
+ case wxTELETYPE:
m_faceName = wxT("Monaco");
break ;
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;
void wxFont::SetFamily(int family)
{
- AllocExclusive();
+ Unshare();
M_FONTDATA->m_family = family;
void wxFont::SetStyle(int style)
{
- AllocExclusive();
+ Unshare();
M_FONTDATA->m_style = style;
void wxFont::SetWeight(int weight)
{
- AllocExclusive();
+ Unshare();
M_FONTDATA->m_weight = weight;
bool wxFont::SetFaceName(const wxString& faceName)
{
- AllocExclusive();
+ Unshare();
M_FONTDATA->m_faceName = faceName;
void wxFont::SetUnderlined(bool underlined)
{
- AllocExclusive();
+ Unshare();
M_FONTDATA->m_underlined = underlined;
void wxFont::SetNoAntiAliasing( bool no )
{
- AllocExclusive();
+ Unshare();
M_FONTDATA->SetNoAntiAliasing( no );
dc->GetTextExtent( wxT("g"), &width, &height, NULL, NULL);
return wxSize((int)width, (int)height);
#else
- wxFontBase::GetPixelSize();
+ return wxFontBase::GetPixelSize();
#endif
}