#include "wx/log.h"
#include "wx/utils.h"
#include "wx/settings.h"
- #include "wx/cmndata.h"
#include "wx/gdicmn.h"
#endif
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);
void InitFromNative();
private:
- wxFontEncoding m_encoding;
bool m_underlined;
- bool m_noAA; // No anti-aliasing
// The native font info: basically a PangoFontDescription
wxNativeFontInfo m_nativeFontInfo;
wxFontWeight weight,
bool underlined,
const wxString& faceName,
- wxFontEncoding encoding)
+ wxFontEncoding WXUNUSED(encoding))
{
if (family == wxFONTFAMILY_DEFAULT)
family = wxFONTFAMILY_SWISS;
m_underlined = underlined;
- m_encoding = encoding;
- if ( m_encoding == wxFONTENCODING_DEFAULT )
- m_encoding = wxFont::GetDefaultEncoding();
-
- m_noAA = false;
// Create native font info
m_nativeFontInfo.description = pango_font_description_new();
// And set its values
if (!faceName.empty())
{
- pango_font_description_set_family( m_nativeFontInfo.description,
+ pango_font_description_set_family( m_nativeFontInfo.description,
wxGTK_CONV_SYS(faceName) );
}
else
void wxFontRefData::InitFromNative()
{
- m_noAA = false;
-
// Get native info
PangoFontDescription *desc = m_nativeFontInfo.description;
// Pango description are never underlined
m_underlined = false;
-
- // always with GTK+ 2
- m_encoding = wxFONTENCODING_UTF8;
}
wxFontRefData::wxFontRefData( const wxFontRefData& data )
: wxGDIRefData()
{
m_underlined = data.m_underlined;
- 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
return false;
}
- pango_font_description_set_absolute_size( m_nativeFontInfo.description,
+ pango_font_description_set_absolute_size( m_nativeFontInfo.description,
pixelSize.GetHeight() * PANGO_SCALE );
return true;
return m_nativeFontInfo.SetFaceName(facename);
}
-void wxFontRefData::SetEncoding(wxFontEncoding encoding)
+void wxFontRefData::SetEncoding(wxFontEncoding WXUNUSED(encoding))
{
- m_encoding = encoding;
-
- // the internal Pango encoding is always UTF8; here we save the
- // encoding just to make it possible to return it from GetEncoding()
- // FIXME: this seems wrong; shouldn't GetEncoding() always return wxFONTENCODING_UTF8?
+ // with GTK+ 2 Pango always uses UTF8 internally, we cannot change it
}
void wxFontRefData::SetNativeFontInfo(const wxNativeFontInfo& info)
// wxFont creation
// ----------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxFont, wxGDIObject)
-
wxFont::wxFont(const wxNativeFontInfo& info)
{
Create( info.GetPointSize(),
return M_FONTDATA->m_nativeFontInfo.GetFaceName();
}
-wxFontFamily wxFont::GetFamily() const
+wxFontFamily wxFont::DoGetFamily() const
{
- wxCHECK_MSG( IsOk(), wxFONTFAMILY_MAX, wxT("invalid font") );
-
return M_FONTDATA->m_nativeFontInfo.GetFamily();
}
{
wxCHECK_MSG( IsOk(), wxFONTENCODING_SYSTEM, wxT("invalid font") );
- return M_FONTDATA->m_encoding;
-}
-
-bool wxFont::GetNoAntiAliasing() const
-{
- wxCHECK_MSG( IsOk(), false, wxT("invalid font") );
-
- return M_FONTDATA->m_noAA;
+ return wxFONTENCODING_UTF8;
+ // Pango always uses UTF8... see also SetEncoding()
}
const wxNativeFontInfo *wxFont::GetNativeFontInfo() const
M_FONTDATA->SetNativeFontInfo( info );
}
-void wxFont::SetNoAntiAliasing( bool no )
-{
- AllocExclusive();
-
- M_FONTDATA->SetNoAntiAliasing( no );
-}
-
wxGDIRefData* wxFont::CreateGDIRefData() const
{
return new wxFontRefData;