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
This commit is contained in:
Robert Roebling
2002-10-28 01:51:46 +00:00
parent d089223aa3
commit 51148dfb8e
5 changed files with 60 additions and 14 deletions

View File

@@ -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

View File

@@ -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();

View File

@@ -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();

View File

@@ -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.
@@ -189,6 +192,8 @@ void wxFontRefData::Init(int pointSize,
m_underlined = underlined;
m_encoding = encoding;
m_noAA = FALSE;
#ifdef __WXGTK20__
// Create native font info
m_nativeFontInfo.description = pango_font_description_new();
@@ -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 );
}
// ----------------------------------------------------------------------------

View File

@@ -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.
@@ -189,6 +192,8 @@ void wxFontRefData::Init(int pointSize,
m_underlined = underlined;
m_encoding = encoding;
m_noAA = FALSE;
#ifdef __WXGTK20__
// Create native font info
m_nativeFontInfo.description = pango_font_description_new();
@@ -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 );
}
// ----------------------------------------------------------------------------