From 51148dfb8e5266fe6822eaac2efb0d3e5cab1d78 Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Mon, 28 Oct 2002 01:51:46 +0000 Subject: [PATCH] Moved AA information to the right place. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@17637 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/font.h | 10 ++-------- include/wx/gtk/font.h | 3 +++ include/wx/gtk1/font.h | 3 +++ src/gtk/font.cpp | 29 ++++++++++++++++++++++++++--- src/gtk1/font.cpp | 29 ++++++++++++++++++++++++++--- 5 files changed, 60 insertions(+), 14 deletions(-) diff --git a/include/wx/font.h b/include/wx/font.h index 5628bdffd9..bc5a0da2ac 100644 --- a/include/wx/font.h +++ b/include/wx/font.h @@ -81,9 +81,6 @@ struct WXDLLEXPORT wxNativeFontInfo; class WXDLLEXPORT wxFontBase : public wxGDIObject { public: - // default constructor - wxFontBase() { m_noAA = FALSE; } - // creator function virtual ~wxFontBase(); @@ -145,8 +142,8 @@ public: wxString GetWeightString() const; // Unofficial API, don't use - void SetNoAntiAliasing( bool no = TRUE ) { m_noAA = no; } - bool GetNoAntiAliasing() { return m_noAA; } + virtual void SetNoAntiAliasing( bool no = TRUE ) { } + virtual bool GetNoAntiAliasing() { return FALSE; } // the default encoding is used for creating all fonts with default // encoding parameter @@ -158,9 +155,6 @@ protected: wxFontRefData *GetFontData() const { return (wxFontRefData *)m_refData; } - // Don't use the native anti-aliasing - bool m_noAA; - private: // the currently default encoding: by default, it's the default system // encoding, but may be changed by the application using diff --git a/include/wx/gtk/font.h b/include/wx/gtk/font.h index 9311e7d115..bad03b9d6b 100644 --- a/include/wx/gtk/font.h +++ b/include/wx/gtk/font.h @@ -96,6 +96,9 @@ public: virtual void SetEncoding(wxFontEncoding encoding); virtual void SetNativeFontInfo( const wxNativeFontInfo& info ); + virtual void SetNoAntiAliasing( bool no = TRUE ); + virtual bool GetNoAntiAliasing(); + // implementation from now on void Unshare(); diff --git a/include/wx/gtk1/font.h b/include/wx/gtk1/font.h index 9311e7d115..bad03b9d6b 100644 --- a/include/wx/gtk1/font.h +++ b/include/wx/gtk1/font.h @@ -96,6 +96,9 @@ public: virtual void SetEncoding(wxFontEncoding encoding); virtual void SetNativeFontInfo( const wxNativeFontInfo& info ); + virtual void SetNoAntiAliasing( bool no = TRUE ); + virtual bool GetNoAntiAliasing(); + // implementation from now on void Unshare(); diff --git a/src/gtk/font.cpp b/src/gtk/font.cpp index 31345187cb..c13b08a612 100644 --- a/src/gtk/font.cpp +++ b/src/gtk/font.cpp @@ -93,6 +93,9 @@ public: void SetFaceName(const wxString& facename); void SetEncoding(wxFontEncoding encoding); + void SetNoAntiAliasing( bool no = TRUE ) { m_noAA = no; } + bool GetNoAntiAliasing() { return m_noAA; } + // and this one also modifies all the other font data fields void SetNativeFontInfo(const wxNativeFontInfo& info); @@ -140,7 +143,6 @@ private: wxScaledFontList m_scaled_xfonts; #endif // GTK 2.0/1.x - // the broken down font parameters int m_pointSize; int m_family, m_style, @@ -148,6 +150,7 @@ 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. @@ -188,6 +191,8 @@ void wxFontRefData::Init(int pointSize, m_underlined = underlined; m_encoding = encoding; + + m_noAA = FALSE; #ifdef __WXGTK20__ // Create native font info @@ -215,6 +220,8 @@ void wxFontRefData::Init(int pointSize, void wxFontRefData::InitFromNative() { + m_noAA = FALSE; + #ifdef __WXGTK20__ // Get native info PangoFontDescription *desc = m_nativeFontInfo.description; @@ -391,6 +398,8 @@ 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; } @@ -731,6 +740,13 @@ wxFontEncoding wxFont::GetEncoding() const return M_FONTDATA->m_encoding; } +bool wxFont::GetNoAntiAliasing() +{ + wxCHECK_MSG( Ok(), wxFONTENCODING_DEFAULT, wxT("invalid font") ); + + return M_FONTDATA->m_noAA; +} + wxNativeFontInfo *wxFont::GetNativeFontInfo() const { wxCHECK_MSG( Ok(), (wxNativeFontInfo *)NULL, wxT("invalid font") ); @@ -814,11 +830,18 @@ void wxFont::SetEncoding(wxFontEncoding encoding) M_FONTDATA->SetEncoding(encoding); } -void wxFont::SetNativeFontInfo(const wxNativeFontInfo& info) +void wxFont::SetNativeFontInfo( const wxNativeFontInfo& info ) { Unshare(); - M_FONTDATA->SetNativeFontInfo(info); + M_FONTDATA->SetNativeFontInfo( info ); +} + +void wxFont::SetNoAntiAliasing( bool no ) +{ + Unshare(); + + M_FONTDATA->SetNoAntiAliasing( no ); } // ---------------------------------------------------------------------------- diff --git a/src/gtk1/font.cpp b/src/gtk1/font.cpp index 31345187cb..c13b08a612 100644 --- a/src/gtk1/font.cpp +++ b/src/gtk1/font.cpp @@ -93,6 +93,9 @@ public: void SetFaceName(const wxString& facename); void SetEncoding(wxFontEncoding encoding); + void SetNoAntiAliasing( bool no = TRUE ) { m_noAA = no; } + bool GetNoAntiAliasing() { return m_noAA; } + // and this one also modifies all the other font data fields void SetNativeFontInfo(const wxNativeFontInfo& info); @@ -140,7 +143,6 @@ private: wxScaledFontList m_scaled_xfonts; #endif // GTK 2.0/1.x - // the broken down font parameters int m_pointSize; int m_family, m_style, @@ -148,6 +150,7 @@ 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. @@ -188,6 +191,8 @@ void wxFontRefData::Init(int pointSize, m_underlined = underlined; m_encoding = encoding; + + m_noAA = FALSE; #ifdef __WXGTK20__ // Create native font info @@ -215,6 +220,8 @@ void wxFontRefData::Init(int pointSize, void wxFontRefData::InitFromNative() { + m_noAA = FALSE; + #ifdef __WXGTK20__ // Get native info PangoFontDescription *desc = m_nativeFontInfo.description; @@ -391,6 +398,8 @@ 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; } @@ -731,6 +740,13 @@ wxFontEncoding wxFont::GetEncoding() const return M_FONTDATA->m_encoding; } +bool wxFont::GetNoAntiAliasing() +{ + wxCHECK_MSG( Ok(), wxFONTENCODING_DEFAULT, wxT("invalid font") ); + + return M_FONTDATA->m_noAA; +} + wxNativeFontInfo *wxFont::GetNativeFontInfo() const { wxCHECK_MSG( Ok(), (wxNativeFontInfo *)NULL, wxT("invalid font") ); @@ -814,11 +830,18 @@ void wxFont::SetEncoding(wxFontEncoding encoding) M_FONTDATA->SetEncoding(encoding); } -void wxFont::SetNativeFontInfo(const wxNativeFontInfo& info) +void wxFont::SetNativeFontInfo( const wxNativeFontInfo& info ) { Unshare(); - M_FONTDATA->SetNativeFontInfo(info); + M_FONTDATA->SetNativeFontInfo( info ); +} + +void wxFont::SetNoAntiAliasing( bool no ) +{ + Unshare(); + + M_FONTDATA->SetNoAntiAliasing( no ); } // ----------------------------------------------------------------------------