X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6d7ee9e860187240a5f82ec4489c831f894065f2..6bd02a4367b1c1dd37a7242809e359fed54a2119:/src/mgl/font.cpp diff --git a/src/mgl/font.cpp b/src/mgl/font.cpp index b6d93684c1..7c4f8903ab 100644 --- a/src/mgl/font.cpp +++ b/src/mgl/font.cpp @@ -1,8 +1,8 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: font.cpp +// Name: src/mgl/font.cpp // Author: Vaclav Slavik // Id: $Id$ -// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) +// Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com) // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -14,10 +14,6 @@ // headers // ---------------------------------------------------------------------------- -#ifdef __GNUG__ - #pragma implementation "font.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -26,10 +22,14 @@ #endif #include "wx/font.h" + +#ifndef WX_PRECOMP + #include "wx/log.h" + #include "wx/utils.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" @@ -46,7 +46,7 @@ public: 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); @@ -74,6 +74,8 @@ private: wxMGLFontLibrary *m_library; bool m_valid; + wxNativeFontInfo m_info; + friend class wxFont; }; @@ -119,7 +121,7 @@ void wxFontRefData::Init(int pointSize, m_encoding = encoding; m_library = NULL; - m_valid = FALSE; + m_valid = false; } wxFontRefData::wxFontRefData(const wxFontRefData& data) @@ -172,7 +174,7 @@ bool wxFont::Create(int pointSize, { 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) @@ -186,7 +188,7 @@ 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(); @@ -216,7 +218,7 @@ int wxFont::GetPointSize() const wxString wxFont::GetFaceName() const { - wxCHECK_MSG( Ok(), wxT(""), wxT("invalid font") ); + wxCHECK_MSG( Ok(), wxEmptyString, wxT("invalid font") ); return M_FONTDATA->m_faceName; } @@ -244,7 +246,7 @@ int wxFont::GetWeight() const bool wxFont::GetUnderlined() const { - wxCHECK_MSG( Ok(), FALSE, wxT("invalid font") ); + wxCHECK_MSG( Ok(), false, wxT("invalid font") ); return M_FONTDATA->m_underlined; } @@ -259,11 +261,19 @@ wxFontEncoding wxFont::GetEncoding() const 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 @@ -274,7 +284,7 @@ void wxFont::SetPointSize(int pointSize) AllocExclusive(); M_FONTDATA->m_pointSize = pointSize; - M_FONTDATA->m_valid = FALSE; + M_FONTDATA->m_valid = false; } void wxFont::SetFamily(int family) @@ -282,7 +292,7 @@ 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) @@ -290,7 +300,7 @@ 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) @@ -298,7 +308,7 @@ 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) @@ -306,7 +316,7 @@ void wxFont::SetFaceName(const wxString& faceName) AllocExclusive(); M_FONTDATA->m_faceName = faceName; - M_FONTDATA->m_valid = FALSE; + M_FONTDATA->m_valid = false; } void wxFont::SetUnderlined(bool underlined) @@ -321,5 +331,5 @@ void wxFont::SetEncoding(wxFontEncoding encoding) AllocExclusive(); M_FONTDATA->m_encoding = encoding; - M_FONTDATA->m_valid = FALSE; + M_FONTDATA->m_valid = false; }