From 8462a84b2caab30265823ebbdbdfc7cff91486e6 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 9 Oct 2009 13:04:59 +0000 Subject: [PATCH] Removed wxFont::Set/GetNoAntiAliasing() implementations. Most of them were dummy and didn't do anything and this API was never meant to be used anyhow. Keep just the declarations in wxFontBase but mark them as deprecated. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62349 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 3 +++ include/wx/dfb/font.h | 4 ---- include/wx/font.h | 10 ++++++---- include/wx/gtk/font.h | 3 --- include/wx/gtk1/font.h | 3 --- include/wx/mgl/font.h | 4 ---- include/wx/osx/font.h | 4 ---- include/wx/private/fontmgr.h | 5 ----- include/wx/x11/font.h | 3 --- src/common/dcgraph.cpp | 6 ------ src/common/fontmgrcmn.cpp | 11 +---------- src/dfb/font.cpp | 12 ------------ src/gtk/font.cpp | 22 ---------------------- src/gtk1/font.cpp | 24 ------------------------ src/mgl/font.cpp | 12 ------------ src/osx/carbon/font.cpp | 21 --------------------- src/stc/PlatWX.cpp | 3 +-- src/x11/font.cpp | 27 ++------------------------- 18 files changed, 13 insertions(+), 164 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index a93b1946c9..5de9bcef8b 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -345,6 +345,9 @@ Deprecated methods and their replacements the static box itself. - wxMouseState::{Left,Middle,Right}Down() were renamed to XXXIsDown() for consistency with wxMouseEvent and the old names were deprecated. +- wxFont::SetNoAntiAliasing() was deprecated, it never really worked in most + ports and was always marked as "experimental" API. It will be replaced with + wxDC-level anti-aliasing control in the future. Major new features in this release diff --git a/include/wx/dfb/font.h b/include/wx/dfb/font.h index 4b485d7f39..f3c6c485b1 100644 --- a/include/wx/dfb/font.h +++ b/include/wx/dfb/font.h @@ -90,10 +90,6 @@ public: wxDECLARE_COMMON_FONT_METHODS(); - // Unofficial API, don't use - virtual void SetNoAntiAliasing(bool no = true); - virtual bool GetNoAntiAliasing() const; - // implementation from now on: wxIDirectFBFontPtr GetDirectFBFont(bool antialiased) const; diff --git a/include/wx/font.h b/include/wx/font.h index 225460cda8..96efd04965 100644 --- a/include/wx/font.h +++ b/include/wx/font.h @@ -249,15 +249,17 @@ public: wxString GetStyleString() const; wxString GetWeightString() const; - // Unofficial API, don't use - virtual void SetNoAntiAliasing( bool WXUNUSED(no) = true ) { } - virtual bool GetNoAntiAliasing() const { return false; } - // the default encoding is used for creating all fonts with default // encoding parameter static wxFontEncoding GetDefaultEncoding() { return ms_encodingDefault; } static void SetDefaultEncoding(wxFontEncoding encoding); + // this doesn't do anything and is kept for compatibility only +#ifdef WXWIN_COMPATIBILITY_2_8 + wxDEPRECATED_INLINE(void SetNoAntiAliasing(bool no = true), wxUnusedVar(no);); + wxDEPRECATED_INLINE(bool GetNoAntiAliasing() const, return false;) +#endif // WXWIN_COMPATIBILITY_2_8 + protected: // the function called by both overloads of SetNativeFontInfo() virtual void DoSetNativeFontInfo(const wxNativeFontInfo& info); diff --git a/include/wx/gtk/font.h b/include/wx/gtk/font.h index 0f446d745c..adbecdadee 100644 --- a/include/wx/gtk/font.h +++ b/include/wx/gtk/font.h @@ -97,9 +97,6 @@ public: wxDECLARE_COMMON_FONT_METHODS(); - virtual void SetNoAntiAliasing( bool no = true ); - virtual bool GetNoAntiAliasing() const ; - // implementation from now on void Unshare(); diff --git a/include/wx/gtk1/font.h b/include/wx/gtk1/font.h index 068bb1a342..c619aad35e 100644 --- a/include/wx/gtk1/font.h +++ b/include/wx/gtk1/font.h @@ -111,9 +111,6 @@ public: wxDECLARE_COMMON_FONT_METHODS(); - virtual void SetNoAntiAliasing( bool no = true ); - virtual bool GetNoAntiAliasing() const ; - // implementation from now on void Unshare(); diff --git a/include/wx/mgl/font.h b/include/wx/mgl/font.h index 93802a8dd8..6ef7f521df 100644 --- a/include/wx/mgl/font.h +++ b/include/wx/mgl/font.h @@ -106,10 +106,6 @@ public: wxDECLARE_COMMON_FONT_METHODS(); - // Unofficial API, don't use - virtual void SetNoAntiAliasing(bool no = true); - virtual bool GetNoAntiAliasing() const; - struct font_t *GetMGLfont_t(float scale, bool antialiased); protected: diff --git a/include/wx/osx/font.h b/include/wx/osx/font.h index 6f379089c0..625a079c0b 100644 --- a/include/wx/osx/font.h +++ b/include/wx/osx/font.h @@ -120,10 +120,6 @@ public: virtual bool RealizeResource(); - // Unofficial API, don't use - virtual void SetNoAntiAliasing( bool noAA = TRUE ) ; - virtual bool GetNoAntiAliasing() const ; - // Mac-specific, risks to change, don't use in portable code #if wxOSX_USE_CARBON && wxOSX_USE_ATSU_TEXT diff --git a/include/wx/private/fontmgr.h b/include/wx/private/fontmgr.h index c9f4395487..389e4d5abc 100644 --- a/include/wx/private/fontmgr.h +++ b/include/wx/private/fontmgr.h @@ -237,15 +237,10 @@ public: void SetUnderlined(bool underlined); void SetEncoding(wxFontEncoding encoding); - // Unofficial API, don't use - void SetNoAntiAliasing(bool no); - bool GetNoAntiAliasing() const { return m_noAA; } - private: void EnsureValidFont(); wxNativeFontInfo m_info; - bool m_noAA; wxFontFace *m_fontFace; wxFontBundle *m_fontBundle; diff --git a/include/wx/x11/font.h b/include/wx/x11/font.h index ac9710472d..a7197b878b 100644 --- a/include/wx/x11/font.h +++ b/include/wx/x11/font.h @@ -100,9 +100,6 @@ public: wxDECLARE_COMMON_FONT_METHODS(); - virtual void SetNoAntiAliasing( bool no = TRUE ); - virtual bool GetNoAntiAliasing() const ; - // Implementation #if wxUSE_PANGO diff --git a/src/common/dcgraph.cpp b/src/common/dcgraph.cpp index 8de2da6817..94a541d21c 100644 --- a/src/common/dcgraph.cpp +++ b/src/common/dcgraph.cpp @@ -450,12 +450,6 @@ void wxGCDCImpl::SetFont( const wxFont &font ) if ( f.IsOk() ) f.SetPointSize( /*LogicalToDeviceYRel*/(font.GetPointSize())); m_graphicContext->SetFont( f, m_textForegroundColour ); -#if defined(__WXGTK__) || defined(__WXOSX__) - if ( m_font.IsOk() && m_font.GetNoAntiAliasing() ) - { - m_graphicContext->SetAntialiasMode(wxANTIALIAS_NONE); - } -#endif } } diff --git a/src/common/fontmgrcmn.cpp b/src/common/fontmgrcmn.cpp index f942d736e8..6ecd7e610e 100644 --- a/src/common/fontmgrcmn.cpp +++ b/src/common/fontmgrcmn.cpp @@ -245,8 +245,6 @@ wxFontMgrFontRefData::wxFontMgrFontRefData(int size, m_info.underlined = underlined; m_info.encoding = encoding; - m_noAA = false; - m_fontFace = NULL; m_fontBundle = NULL; m_fontValid = false; @@ -255,7 +253,6 @@ wxFontMgrFontRefData::wxFontMgrFontRefData(int size, wxFontMgrFontRefData::wxFontMgrFontRefData(const wxFontMgrFontRefData& data) { m_info = data.m_info; - m_noAA = data.m_noAA; m_fontFace = data.m_fontFace; m_fontBundle = data.m_fontBundle; @@ -281,7 +278,7 @@ wxFontMgrFontRefData::GetFontInstance(float scale, bool antialiased) const { wxConstCast(this, wxFontMgrFontRefData)->EnsureValidFont(); return m_fontFace->GetFontInstance(m_info.pointSize * scale, - antialiased && !m_noAA); + antialiased); } void wxFontMgrFontRefData::SetPointSize(int pointSize) @@ -326,12 +323,6 @@ void wxFontMgrFontRefData::SetEncoding(wxFontEncoding encoding) m_fontValid = false; } -void wxFontMgrFontRefData::SetNoAntiAliasing(bool no) -{ - m_noAA = no; -} - - void wxFontMgrFontRefData::EnsureValidFont() { if ( !m_fontValid ) diff --git a/src/dfb/font.cpp b/src/dfb/font.cpp index 83fc2138a6..05a83676f0 100644 --- a/src/dfb/font.cpp +++ b/src/dfb/font.cpp @@ -148,13 +148,6 @@ const wxNativeFontInfo *wxFont::GetNativeFontInfo() const return M_FONTDATA->GetNativeFontInfo(); } -bool wxFont::GetNoAntiAliasing() const -{ - wxCHECK_MSG( Ok(), false, wxT("invalid font") ); - - return M_FONTDATA->GetNoAntiAliasing(); -} - // ---------------------------------------------------------------------------- // change font attributes // ---------------------------------------------------------------------------- @@ -202,8 +195,3 @@ void wxFont::SetEncoding(wxFontEncoding encoding) M_FONTDATA->SetEncoding(encoding); } -void wxFont::SetNoAntiAliasing(bool no) -{ - AllocExclusive(); - M_FONTDATA->SetNoAntiAliasing(no); -} diff --git a/src/gtk/font.cpp b/src/gtk/font.cpp index 72b651732c..d011c26b35 100644 --- a/src/gtk/font.cpp +++ b/src/gtk/font.cpp @@ -73,9 +73,6 @@ public: bool SetFaceName(const wxString& facename); void SetEncoding(wxFontEncoding encoding); - void SetNoAntiAliasing( bool no = true ) { m_noAA = no; } - bool GetNoAntiAliasing() const { return m_noAA; } - // and this one also modifies all the other font data fields void SetNativeFontInfo(const wxNativeFontInfo& info); @@ -94,7 +91,6 @@ protected: private: bool m_underlined; - bool m_noAA; // No anti-aliasing // The native font info: basically a PangoFontDescription wxNativeFontInfo m_nativeFontInfo; @@ -120,7 +116,6 @@ void wxFontRefData::Init(int pointSize, family = wxFONTFAMILY_SWISS; m_underlined = underlined; - m_noAA = false; // Create native font info m_nativeFontInfo.description = pango_font_description_new(); @@ -145,8 +140,6 @@ void wxFontRefData::Init(int pointSize, void wxFontRefData::InitFromNative() { - m_noAA = false; - // Get native info PangoFontDescription *desc = m_nativeFontInfo.description; @@ -163,7 +156,6 @@ wxFontRefData::wxFontRefData( const wxFontRefData& data ) : wxGDIRefData() { m_underlined = data.m_underlined; - m_noAA = data.m_noAA; // Forces a copy of the internal data. wxNativeFontInfo should probably // have a copy ctor and assignment operator to fix this properly but that @@ -377,13 +369,6 @@ wxFontEncoding wxFont::GetEncoding() const // Pango always uses UTF8... see also SetEncoding() } -bool wxFont::GetNoAntiAliasing() const -{ - wxCHECK_MSG( IsOk(), false, wxT("invalid font") ); - - return M_FONTDATA->m_noAA; -} - const wxNativeFontInfo *wxFont::GetNativeFontInfo() const { wxCHECK_MSG( IsOk(), NULL, wxT("invalid font") ); @@ -459,13 +444,6 @@ void wxFont::DoSetNativeFontInfo( const wxNativeFontInfo& info ) M_FONTDATA->SetNativeFontInfo( info ); } -void wxFont::SetNoAntiAliasing( bool no ) -{ - AllocExclusive(); - - M_FONTDATA->SetNoAntiAliasing( no ); -} - wxGDIRefData* wxFont::CreateGDIRefData() const { return new wxFontRefData; diff --git a/src/gtk1/font.cpp b/src/gtk1/font.cpp index d04f27e413..176dde8d15 100644 --- a/src/gtk1/font.cpp +++ b/src/gtk1/font.cpp @@ -91,9 +91,6 @@ public: bool SetFaceName(const wxString& facename); void SetEncoding(wxFontEncoding encoding); - void SetNoAntiAliasing( bool no = true ) { m_noAA = no; } - bool GetNoAntiAliasing() const { return m_noAA; } - // and this one also modifies all the other font data fields void SetNativeFontInfo(const wxNativeFontInfo& info); @@ -124,7 +121,6 @@ private: bool m_underlined; wxString m_faceName; wxFontEncoding m_encoding; // Unused under GTK 2.0 - bool m_noAA; // No anti-aliasing // The native font info, basicly an XFLD under GTK 1.2 and // the pango font description under GTK 2.0. @@ -163,14 +159,10 @@ void wxFontRefData::Init(int pointSize, m_underlined = underlined; m_encoding = encoding; - - m_noAA = false; } void wxFontRefData::InitFromNative() { - m_noAA = false; - // get the font parameters from the XLFD // ------------------------------------- @@ -283,8 +275,6 @@ wxFontRefData::wxFontRefData( const wxFontRefData& data ) m_faceName = data.m_faceName; m_encoding = data.m_encoding; - m_noAA = data.m_noAA; - // Forces a copy of the internal data. wxNativeFontInfo should probably // have a copy ctor and assignment operator to fix this properly but that // would break binary compatibility... @@ -580,13 +570,6 @@ wxFontEncoding wxFont::GetEncoding() const return M_FONTDATA->m_encoding; } -bool wxFont::GetNoAntiAliasing() const -{ - wxCHECK_MSG( Ok(), wxFONTENCODING_DEFAULT, wxT("invalid font") ); - - return M_FONTDATA->m_noAA; -} - const wxNativeFontInfo *wxFont::GetNativeFontInfo() const { wxCHECK_MSG( Ok(), NULL, wxT("invalid font") ); @@ -679,13 +662,6 @@ void wxFont::DoSetNativeFontInfo( const wxNativeFontInfo& info ) M_FONTDATA->SetNativeFontInfo( info ); } -void wxFont::SetNoAntiAliasing( bool no ) -{ - Unshare(); - - M_FONTDATA->SetNoAntiAliasing( no ); -} - // ---------------------------------------------------------------------------- // get internal representation of font // ---------------------------------------------------------------------------- diff --git a/src/mgl/font.cpp b/src/mgl/font.cpp index fb72e2d45c..e322af0f80 100644 --- a/src/mgl/font.cpp +++ b/src/mgl/font.cpp @@ -145,13 +145,6 @@ const wxNativeFontInfo *wxFont::GetNativeFontInfo() const return M_FONTDATA->GetNativeFontInfo(); } -bool wxFont::GetNoAntiAliasing() const -{ - wxCHECK_MSG( Ok(), false, wxT("invalid font") ); - - return M_FONTDATA->GetNoAntiAliasing(); -} - // ---------------------------------------------------------------------------- // change font attributes // ---------------------------------------------------------------------------- @@ -199,8 +192,3 @@ void wxFont::SetEncoding(wxFontEncoding encoding) M_FONTDATA->SetEncoding(encoding); } -void wxFont::SetNoAntiAliasing(bool no) -{ - AllocExclusive(); - M_FONTDATA->SetNoAntiAliasing(no); -} diff --git a/src/osx/carbon/font.cpp b/src/osx/carbon/font.cpp index 9ac75bbfbd..f8c6f5f347 100644 --- a/src/osx/carbon/font.cpp +++ b/src/osx/carbon/font.cpp @@ -61,10 +61,6 @@ public: virtual ~wxFontRefData(); - void SetNoAntiAliasing( bool no = true ) { m_noAA = no; } - - bool GetNoAntiAliasing() const { return m_noAA; } - void SetPointSize( int size ) { if( GetPointSize() != size ) @@ -154,7 +150,6 @@ protected: #if wxOSX_USE_CORE_TEXT // void Init( CTFontRef font ); #endif - bool m_noAA; // No anti-aliasing public: bool m_fontValid; #if wxOSX_USE_CARBON && wxOSX_USE_ATSU_TEXT @@ -184,7 +179,6 @@ wxFontRefData::wxFontRefData(const wxFontRefData& data) { Init(); m_info = data.m_info; - m_noAA = data.m_noAA; m_fontValid = data.m_fontValid; #if wxOSX_USE_CARBON && wxOSX_USE_ATSU_TEXT m_macThemeFontID = data.m_macThemeFontID; @@ -219,7 +213,6 @@ wxFontRefData::wxFontRefData(const wxFontRefData& data) void wxFontRefData::Init() { - m_noAA = false; #if wxOSX_USE_CARBON && wxOSX_USE_ATSU_TEXT m_macThemeFontID = kThemeCurrentPortFont ; #endif @@ -656,13 +649,6 @@ void wxFont::SetUnderlined(bool underlined) M_FONTDATA->SetUnderlined( underlined ); } -void wxFont::SetNoAntiAliasing( bool no ) -{ - AllocExclusive(); - - M_FONTDATA->SetNoAntiAliasing( no ); -} - // ---------------------------------------------------------------------------- // accessors // ---------------------------------------------------------------------------- @@ -733,13 +719,6 @@ wxFontEncoding wxFont::GetEncoding() const return M_FONTDATA->GetEncoding() ; } -bool wxFont::GetNoAntiAliasing() const -{ - wxCHECK_MSG( M_FONTDATA != NULL , false, wxT("invalid font") ); - - return M_FONTDATA->GetNoAntiAliasing(); -} - #if wxOSX_USE_ATSU_TEXT && wxOSX_USE_CARBON short wxFont::MacGetFontNum() const diff --git a/src/stc/PlatWX.cpp b/src/stc/PlatWX.cpp index a58a60d8f5..8149bfbf5c 100644 --- a/src/stc/PlatWX.cpp +++ b/src/stc/PlatWX.cpp @@ -140,7 +140,7 @@ Font::~Font() { void Font::Create(const char *faceName, int characterSet, int size, bool bold, bool italic, - bool extraFontFlag) { + bool WXUNUSED(extraFontFlag)) { Release(); // The minus one is done because since Scintilla uses SC_SHARSET_DEFAULT @@ -160,7 +160,6 @@ void Font::Create(const char *faceName, int characterSet, false, stc2wx(faceName), encoding); - font->SetNoAntiAliasing(!extraFontFlag); id = font; } diff --git a/src/x11/font.cpp b/src/x11/font.cpp index 49a2b7dfd5..32aa7d6a56 100644 --- a/src/x11/font.cpp +++ b/src/x11/font.cpp @@ -125,9 +125,6 @@ public: bool SetFaceName(const wxString& facename); void SetEncoding(wxFontEncoding encoding); - void SetNoAntiAliasing( bool no = true ) { m_noAA = no; } - bool GetNoAntiAliasing() const { return m_noAA; } - // and this one also modifies all the other font data fields void SetNativeFontInfo(const wxNativeFontInfo& info); @@ -152,7 +149,6 @@ protected: bool m_underlined; wxString m_faceName; wxFontEncoding m_encoding; // Unused in Unicode mode - bool m_noAA; // No anti-aliasing wxNativeFontInfo m_nativeFontInfo; @@ -232,8 +228,6 @@ void wxFontRefData::Init(int pointSize, void wxFontRefData::InitFromNative() { - m_noAA = false; - #if wxUSE_UNICODE // Get native info PangoFontDescription *desc = m_nativeFontInfo.description; @@ -414,8 +408,6 @@ wxFontRefData::wxFontRefData( const wxFontRefData& data ) m_faceName = data.m_faceName; m_encoding = data.m_encoding; - m_noAA = data.m_noAA; - m_nativeFontInfo = data.m_nativeFontInfo; } @@ -768,13 +760,6 @@ wxFontEncoding wxFont::GetEncoding() const return M_FONTDATA->m_encoding; } -bool wxFont::GetNoAntiAliasing() const -{ - wxCHECK_MSG( Ok(), wxFONTENCODING_DEFAULT, wxT("invalid font") ); - - return M_FONTDATA->m_noAA; -} - const wxNativeFontInfo *wxFont::GetNativeFontInfo() const { wxCHECK_MSG( Ok(), NULL, wxT("invalid font") ); @@ -872,15 +857,7 @@ void wxFont::DoSetNativeFontInfo( const wxNativeFontInfo& info ) M_FONTDATA->SetNativeFontInfo( info ); } -void wxFont::SetNoAntiAliasing( bool no ) -{ - Unshare(); - - M_FONTDATA->SetNoAntiAliasing( no ); -} - -#if wxUSE_UNICODE -#else +#if !wxUSE_UNICODE // ---------------------------------------------------------------------------- // X11 implementation @@ -946,4 +923,4 @@ WXFontStructPtr wxFont::GetFontStruct(double scale, WXDisplay* display) const return (f ? f->m_fontStruct : (WXFontStructPtr) 0); } -#endif +#endif // !wxUSE_UNICODE -- 2.45.2