applied wxNativeFontInfo patch from Derry Bryson (with minor changes)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9134 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Gilles Depeyrot
2001-01-20 19:30:47 +00:00
parent 1a2b91971d
commit 3b7e6277be
5 changed files with 43 additions and 6 deletions

View File

@@ -100,6 +100,15 @@ public:
(void)Create(size, family, style, weight, underlined, face, encoding); (void)Create(size, family, style, weight, underlined, face, encoding);
} }
wxFont(const wxNativeFontInfo& info)
{
Init();
(void)Create(info);
}
wxFont(const wxString& fontDesc);
bool Create(int size, bool Create(int size,
int family, int family,
int style, int style,
@@ -108,6 +117,8 @@ public:
const wxString& face = wxEmptyString, const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT); wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
bool Create(const wxNativeFontInfo& info);
virtual ~wxFont(); virtual ~wxFont();
// assignment // assignment

View File

@@ -18,13 +18,12 @@
#include "wx/font.h" #include "wx/font.h"
#include "wx/gdicmn.h" #include "wx/gdicmn.h"
#include "wx/fontutil.h"
#if !USE_SHARED_LIBRARIES #if !USE_SHARED_LIBRARIES
IMPLEMENT_DYNAMIC_CLASS(wxFont, wxGDIObject) IMPLEMENT_DYNAMIC_CLASS(wxFont, wxGDIObject)
#endif #endif
// ============================================================================ // ============================================================================
// implementation // implementation
// ============================================================================ // ============================================================================
@@ -120,6 +119,13 @@ void wxFont::Init()
wxTheFontList->Append(this); wxTheFontList->Append(this);
} }
wxFont::wxFont(const wxString& fontdesc)
{
wxNativeFontInfo info;
if ( info.FromString(fontdesc) )
(void)Create(info);
}
bool wxFont::Create(int pointSize, bool wxFont::Create(int pointSize,
int family, int family,
int style, int style,
@@ -137,6 +143,12 @@ bool wxFont::Create(int pointSize,
return TRUE; return TRUE;
} }
bool wxFont::Create(const wxNativeFontInfo& info)
{
return Create(info.pointSize, info.family, info.style, info.weight,
info.underlined, info.faceName, info.encoding);
}
wxFont::~wxFont() wxFont::~wxFont()
{ {
if (wxTheFontList) if (wxTheFontList)

View File

@@ -34,6 +34,7 @@
#include "wx/fontenum.h" #include "wx/fontenum.h"
#include "wx/fontmap.h" #include "wx/fontmap.h"
#include "wx/fontutil.h"
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// private classes // private classes

View File

@@ -18,13 +18,12 @@
#include "wx/font.h" #include "wx/font.h"
#include "wx/gdicmn.h" #include "wx/gdicmn.h"
#include "wx/fontutil.h"
#if !USE_SHARED_LIBRARIES #if !USE_SHARED_LIBRARIES
IMPLEMENT_DYNAMIC_CLASS(wxFont, wxGDIObject) IMPLEMENT_DYNAMIC_CLASS(wxFont, wxGDIObject)
#endif #endif
// ============================================================================ // ============================================================================
// implementation // implementation
// ============================================================================ // ============================================================================
@@ -120,6 +119,13 @@ void wxFont::Init()
wxTheFontList->Append(this); wxTheFontList->Append(this);
} }
wxFont::wxFont(const wxString& fontdesc)
{
wxNativeFontInfo info;
if ( info.FromString(fontdesc) )
(void)Create(info);
}
bool wxFont::Create(int pointSize, bool wxFont::Create(int pointSize,
int family, int family,
int style, int style,
@@ -137,6 +143,12 @@ bool wxFont::Create(int pointSize,
return TRUE; return TRUE;
} }
bool wxFont::Create(const wxNativeFontInfo& info)
{
return Create(info.pointSize, info.family, info.style, info.weight,
info.underlined, info.faceName, info.encoding);
}
wxFont::~wxFont() wxFont::~wxFont()
{ {
if (wxTheFontList) if (wxTheFontList)

View File

@@ -34,6 +34,7 @@
#include "wx/fontenum.h" #include "wx/fontenum.h"
#include "wx/fontmap.h" #include "wx/fontmap.h"
#include "wx/fontutil.h"
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// private classes // private classes