From c443ff6f5350df36902af42d0193e53d79dd6a14 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Tue, 14 Apr 2009 19:58:51 +0000 Subject: [PATCH] fixing native font info support bugs git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60150 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/osx/font.h | 2 ++ src/osx/carbon/font.cpp | 14 +++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/include/wx/osx/font.h b/include/wx/osx/font.h index 158df31e4d..c005e55be3 100644 --- a/include/wx/osx/font.h +++ b/include/wx/osx/font.h @@ -166,6 +166,8 @@ public: #endif protected: + virtual void DoSetNativeFontInfo(const wxNativeFontInfo& info); + virtual wxGDIRefData *CreateGDIRefData() const; virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; diff --git a/src/osx/carbon/font.cpp b/src/osx/carbon/font.cpp index fac6a43dc5..2b51a315a1 100644 --- a/src/osx/carbon/font.cpp +++ b/src/osx/carbon/font.cpp @@ -576,6 +576,14 @@ wxFont::~wxFont() { } +void wxFont::DoSetNativeFontInfo(const wxNativeFontInfo& info) +{ + UnRef(); + + m_refData = new wxFontRefData( info); +} + + bool wxFont::RealizeResource() { M_FONTDATA->MacFindFont(); @@ -938,7 +946,7 @@ void wxNativeFontInfo::Init() m_weight = wxFONTWEIGHT_NORMAL; m_underlined = false; m_faceName.clear(); - m_encoding = wxFONTENCODING_DEFAULT; + m_encoding = wxFont::GetDefaultEncoding(); m_descriptorValid = false; } @@ -1105,6 +1113,8 @@ void wxNativeFontInfo::Init(int size, m_weight = weight; m_underlined = underlined; m_faceName = faceName; + if ( encoding == wxFONTENCODING_DEFAULT ) + encoding = wxFont::GetDefaultEncoding(); m_encoding = encoding; } @@ -1289,6 +1299,8 @@ void wxNativeFontInfo::SetFamily(wxFontFamily family_) void wxNativeFontInfo::SetEncoding(wxFontEncoding encoding_) { + if ( encoding_ == wxFONTENCODING_DEFAULT ) + encoding_ = wxFont::GetDefaultEncoding(); m_encoding = encoding_; // not reflected in native descriptors } \ No newline at end of file