#include "wx/x11/private.h"
-IMPLEMENT_DYNAMIC_CLASS(wxFont, wxGDIObject)
-
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
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 in Unicode mode
- bool m_noAA; // No anti-aliasing
wxNativeFontInfo m_nativeFontInfo;
void wxFontRefData::InitFromNative()
{
- m_noAA = false;
-
#if wxUSE_UNICODE
// Get native info
PangoFontDescription *desc = m_nativeFontInfo.description;
break;
default:
- wxFAIL_MSG(_T("unknown Pango font weight"));
+ wxFAIL_MSG(wxT("unknown Pango font weight"));
// fall through
case PANGO_WEIGHT_NORMAL:
m_weight = wxFONTWEIGHT_NORMAL;
wxString w = m_nativeFontInfo.GetXFontComponent(wxXLFD_WEIGHT).Upper();
- if ( !w.empty() && w != _T('*') )
+ if ( !w.empty() && w != wxT('*') )
{
// the test below catches all of BOLD, EXTRABOLD, DEMIBOLD, ULTRABOLD
// and BLACK
- if ( ((w[0u] == _T('B') && (!wxStrcmp(w.c_str() + 1, wxT("OLD")) ||
+ if ( ((w[0u] == wxT('B') && (!wxStrcmp(w.c_str() + 1, wxT("OLD")) ||
!wxStrcmp(w.c_str() + 1, wxT("LACK"))))) ||
- wxStrstr(w.c_str() + 1, _T("BOLD")) )
+ wxStrstr(w.c_str() + 1, wxT("BOLD")) )
{
m_weight = wxFONTWEIGHT_BOLD;
}
- else if ( w == _T("LIGHT") || w == _T("THIN") )
+ else if ( w == wxT("LIGHT") || w == wxT("THIN") )
{
m_weight = wxFONTWEIGHT_LIGHT;
}
}
switch ( wxToupper( m_nativeFontInfo.
- GetXFontComponent(wxXLFD_SLANT)[0u]).GetValue() )
+ GetXFontComponent(wxXLFD_SLANT)[0u]).GetValue() )
{
- case _T('I'): // italique
+ case wxT('I'): // italique
m_style = wxFONTSTYLE_ITALIC;
break;
- case _T('O'): // oblique
+ case wxT('O'): // oblique
m_style = wxFONTSTYLE_SLANT;
break;
// examine the spacing: if the font is monospaced, assume wxTELETYPE
// family for compatibility with the old code which used it instead of
// IsFixedWidth()
- if ( m_nativeFontInfo.GetXFontComponent(wxXLFD_SPACING).Upper() == _T('M') )
+ if ( m_nativeFontInfo.GetXFontComponent(wxXLFD_SPACING).Upper() == wxT('M') )
{
m_family = wxFONTFAMILY_TELETYPE;
}
registry = m_nativeFontInfo.GetXFontComponent(wxXLFD_REGISTRY).Upper(),
encoding = m_nativeFontInfo.GetXFontComponent(wxXLFD_ENCODING).Upper();
- if ( registry == _T("ISO8859") )
+ if ( registry == wxT("ISO8859") )
{
int cp;
if ( wxSscanf(encoding, wxT("%d"), &cp) == 1 )
m_encoding = (wxFontEncoding)(wxFONTENCODING_ISO8859_1 + cp - 1);
}
}
- else if ( registry == _T("MICROSOFT") )
+ else if ( registry == wxT("MICROSOFT") )
{
int cp;
if ( wxSscanf(encoding, wxT("cp125%d"), &cp) == 1 )
m_encoding = (wxFontEncoding)(wxFONTENCODING_CP1250 + cp);
}
}
- else if ( registry == _T("KOI8") )
+ else if ( registry == wxT("KOI8") )
{
m_encoding = wxFONTENCODING_KOI8;
}
m_faceName = data.m_faceName;
m_encoding = data.m_encoding;
- m_noAA = data.m_noAA;
-
m_nativeFontInfo = data.m_nativeFontInfo;
}
pango_font_description_set_style( desc, PANGO_STYLE_OBLIQUE );
break;
default:
- wxFAIL_MSG( _T("unknown font style") );
+ wxFAIL_MSG( wxT("unknown font style") );
// fall through
case wxFONTSTYLE_NORMAL:
pango_font_description_set_style( desc, PANGO_STYLE_NORMAL );
wxString registry = tn.GetNextToken().MakeUpper(),
encoding = tn.GetNextToken().MakeUpper();
- if ( registry == _T("ISO8859") )
+ if ( registry == wxT("ISO8859") )
{
int cp;
if ( wxSscanf(encoding, wxT("%d"), &cp) == 1 )
(wxFontEncoding)(wxFONTENCODING_ISO8859_1 + cp - 1);
}
}
- else if ( registry == _T("MICROSOFT") )
+ else if ( registry == wxT("MICROSOFT") )
{
int cp;
if ( wxSscanf(encoding, wxT("cp125%d"), &cp) == 1 )
(wxFontEncoding)(wxFONTENCODING_CP1250 + cp);
}
}
- else if ( registry == _T("KOI8") )
+ else if ( registry == wxT("KOI8") )
{
M_FONTDATA->m_encoding = wxFONTENCODING_KOI8;
}
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") );
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(), (wxNativeFontInfo *)NULL, wxT("invalid font") );
+ wxCHECK_MSG( IsOk(), NULL, wxT("invalid font") );
#if wxUSE_UNICODE
#else
bool wxFont::IsFixedWidth() const
{
- wxCHECK_MSG( Ok(), false, wxT("invalid font") );
+ wxCHECK_MSG( IsOk(), false, wxT("invalid font") );
#if wxUSE_UNICODE
return wxFontBase::IsFixedWidth();
wxString spacing = M_FONTDATA->
m_nativeFontInfo.GetXFontComponent(wxXLFD_SPACING);
- return spacing.Upper() == _T('M');
+ return spacing.Upper() == wxT('M');
}
// Unreaceable code for now
// return wxFontBase::IsFixedWidth();
M_FONTDATA->SetNativeFontInfo( info );
}
-void wxFont::SetNoAntiAliasing( bool no )
-{
- Unshare();
-
- M_FONTDATA->SetNoAntiAliasing( no );
-}
-
-#if wxUSE_UNICODE
-#else
+#if !wxUSE_UNICODE
// ----------------------------------------------------------------------------
// X11 implementation
// font to list in the private data for future reference.
wxXFont* wxFont::GetInternalFont(double scale, WXDisplay* display) const
{
- if ( !Ok() )
- return (wxXFont *)NULL;
+ if ( !IsOk() )
+ return NULL;
long intScale = long(scale * 100.0 + 0.5); // key for wxXFont
int pointSize = (M_FONTDATA->m_pointSize * 10 * intScale) / 100;
{
wxFAIL_MSG( wxT("Could not allocate even a default font -- something is wrong.") );
- return (wxXFont*) NULL;
+ return NULL;
}
wxXFont* f = new wxXFont;
return (f ? f->m_fontStruct : (WXFontStructPtr) 0);
}
-#endif
+#endif // !wxUSE_UNICODE