/////////////////////////////////////////////////////////////////////////////
-// Name: font.cpp
+// Name: src/mgl/font.cpp
// Author: Vaclav Slavik
// Id: $Id$
// Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com)
// headers
// ----------------------------------------------------------------------------
-#ifdef __GNUG__
- #pragma implementation "font.h"
-#endif
-
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#endif
#include "wx/font.h"
+
+#ifndef WX_PRECOMP
+ #include "wx/log.h"
+ #include "wx/utils.h"
+ #include "wx/settings.h"
+ #include "wx/cmndata.h"
+ #include "wx/gdicmn.h"
+#endif
+
#include "wx/fontutil.h"
-#include "wx/cmndata.h"
-#include "wx/utils.h"
-#include "wx/log.h"
-#include "wx/gdicmn.h"
#include "wx/tokenzr.h"
-#include "wx/settings.h"
#include "wx/mgl/private.h"
// ----------------------------------------------------------------------------
int family = wxDEFAULT,
int style = wxDEFAULT,
int weight = wxDEFAULT,
- bool underlined = FALSE,
+ bool underlined = false,
const wxString& faceName = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
wxFontRefData(const wxFontRefData& data);
wxMGLFontLibrary *m_library;
bool m_valid;
+ wxNativeFontInfo m_info;
+
friend class wxFont;
};
m_encoding = encoding;
m_library = NULL;
- m_valid = FALSE;
+ m_valid = false;
}
wxFontRefData::wxFontRefData(const wxFontRefData& data)
{
m_refData = new wxFontRefData(pointSize, family, style, weight,
underlined, face, encoding);
- return TRUE;
+ return true;
}
struct font_t *wxFont::GetMGLfont_t(float scale, bool antialiased)
old->DecRef();
}
- wxMGLFontInstance *instance =
+ wxMGLFontInstance *instance =
M_FONTDATA->m_library->GetFontInstance(this, scale, antialiased);
return instance->GetMGLfont_t();
wxString wxFont::GetFaceName() const
{
- wxCHECK_MSG( Ok(), wxT(""), wxT("invalid font") );
+ wxCHECK_MSG( Ok(), wxEmptyString, wxT("invalid font") );
return M_FONTDATA->m_faceName;
}
bool wxFont::GetUnderlined() const
{
- wxCHECK_MSG( Ok(), FALSE, wxT("invalid font") );
+ wxCHECK_MSG( Ok(), false, wxT("invalid font") );
return M_FONTDATA->m_underlined;
}
bool wxFont::IsFixedWidth() const
{
- wxCHECK_MSG( Ok(), FALSE, wxT("invalid font") );
+ wxCHECK_MSG( Ok(), false, wxT("invalid font") );
return (bool)(M_FONTDATA->m_library->GetFamily()->GetInfo()->isFixed);
}
+const wxNativeFontInfo *wxFont::GetNativeFontInfo() const
+{
+ wxCHECK_MSG( Ok(), NULL, wxT("invalid font") );
+
+ M_FONTDATA->m_info.InitFromFont(*this);
+
+ return &(M_FONTDATA->m_info);
+}
// ----------------------------------------------------------------------------
// change font attributes
AllocExclusive();
M_FONTDATA->m_pointSize = pointSize;
- M_FONTDATA->m_valid = FALSE;
+ M_FONTDATA->m_valid = false;
}
void wxFont::SetFamily(int family)
AllocExclusive();
M_FONTDATA->m_family = family;
- M_FONTDATA->m_valid = FALSE;
+ M_FONTDATA->m_valid = false;
}
void wxFont::SetStyle(int style)
AllocExclusive();
M_FONTDATA->m_style = style;
- M_FONTDATA->m_valid = FALSE;
+ M_FONTDATA->m_valid = false;
}
void wxFont::SetWeight(int weight)
AllocExclusive();
M_FONTDATA->m_weight = weight;
- M_FONTDATA->m_valid = FALSE;
+ M_FONTDATA->m_valid = false;
}
-void wxFont::SetFaceName(const wxString& faceName)
+bool wxFont::SetFaceName(const wxString& faceName)
{
AllocExclusive();
M_FONTDATA->m_faceName = faceName;
- M_FONTDATA->m_valid = FALSE;
+ M_FONTDATA->m_valid = false;
+
+ return wxFontBase::SetFaceName(faceName);
}
void wxFont::SetUnderlined(bool underlined)
AllocExclusive();
M_FONTDATA->m_encoding = encoding;
- M_FONTDATA->m_valid = FALSE;
+ M_FONTDATA->m_valid = false;
}