// Name: src/gtk1/font.cpp
// Purpose:
// Author: Robert Roebling
-// Id: $Id$
// Copyright: (c) 1998 Robert Roebling and Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef WX_PRECOMP
#include "wx/log.h"
#include "wx/settings.h"
- #include "wx/cmndata.h"
#include "wx/gdicmn.h"
+ #include "wx/crt.h"
#endif
#include "wx/fontutil.h"
+#include "wx/encinfo.h"
#include "wx/utils.h"
#include "wx/tokenzr.h"
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);
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.
m_underlined = underlined;
m_encoding = encoding;
-
- m_noAA = false;
}
void wxFontRefData::InitFromNative()
{
- m_noAA = false;
-
// get the font parameters from the XLFD
// -------------------------------------
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...
// wxFont creation
// ----------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxFont, wxGDIObject)
-
wxFont::wxFont(const wxNativeFontInfo& info)
{
(void) Create(info.GetXFontName());
int wxFont::GetPointSize() const
{
- wxCHECK_MSG( Ok(), 0, wxT("invalid font") );
+ wxCHECK_MSG( IsOk(), 0, wxT("invalid font") );
return M_FONTDATA->m_pointSize;
}
wxString wxFont::GetFaceName() const
{
- wxCHECK_MSG( Ok(), wxEmptyString, wxT("invalid font") );
+ wxCHECK_MSG( IsOk(), wxEmptyString, wxT("invalid font") );
return M_FONTDATA->m_faceName;
}
-wxFontFamily wxFont::GetFamily() const
+wxFontFamily wxFont::DoGetFamily() const
{
- wxCHECK_MSG( Ok(), wxFONTFAMILY_MAX, wxT("invalid font") );
-
return M_FONTDATA->m_family;
}
wxFontStyle wxFont::GetStyle() const
{
- wxCHECK_MSG( Ok(), wxFONTSTYLE_MAX, wxT("invalid font") );
+ wxCHECK_MSG( IsOk(), wxFONTSTYLE_MAX, wxT("invalid font") );
return M_FONTDATA->m_style;
}
wxFontWeight wxFont::GetWeight() const
{
- wxCHECK_MSG( Ok(), wxFONTWEIGHT_MAX, wxT("invalid font") );
+ wxCHECK_MSG( IsOk(), wxFONTWEIGHT_MAX, wxT("invalid font") );
return M_FONTDATA->m_weight;
}
bool wxFont::GetUnderlined() const
{
- wxCHECK_MSG( Ok(), false, wxT("invalid font") );
+ wxCHECK_MSG( IsOk(), false, wxT("invalid font") );
return M_FONTDATA->m_underlined;
}
wxFontEncoding wxFont::GetEncoding() const
{
- wxCHECK_MSG( Ok(), wxFONTENCODING_DEFAULT, wxT("invalid font") );
+ wxCHECK_MSG( IsOk(), wxFONTENCODING_DEFAULT, wxT("invalid font") );
// m_encoding is unused in wxGTK2, return encoding that the user set.
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") );
+ wxCHECK_MSG( IsOk(), NULL, wxT("invalid font") );
if ( !M_FONTDATA->HasNativeFont() )
{
bool wxFont::IsFixedWidth() const
{
- wxCHECK_MSG( Ok(), false, wxT("invalid font") );
+ wxCHECK_MSG( IsOk(), false, wxT("invalid font") );
if ( M_FONTDATA->HasNativeFont() )
{
M_FONTDATA->SetNativeFontInfo( info );
}
-void wxFont::SetNoAntiAliasing( bool no )
-{
- Unshare();
-
- M_FONTDATA->SetNoAntiAliasing( no );
-}
-
// ----------------------------------------------------------------------------
// get internal representation of font
// ----------------------------------------------------------------------------
static GdkFont *g_systemDefaultGuiFont = NULL;
-// this is also used from tbargtk.cpp and tooltip.cpp, hence extern
+// this is also used from toolbar.cpp and tooltip.cpp, hence extern
extern GdkFont *GtkGetDefaultGuiFont()
{
if (!g_systemDefaultGuiFont)
{
GdkFont *font = NULL;
- wxCHECK_MSG( Ok(), font, wxT("invalid font") );
+ wxCHECK_MSG( IsOk(), font, wxT("invalid font") );
long int_scale = long(scale * 100.0 + 0.5); // key for fontlist
int point_scale = (int)((M_FONTDATA->m_pointSize * 10 * int_scale) / 100);