]>
git.saurik.com Git - wxWidgets.git/blob - src/common/fontcmn.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: common/fontcmn.cpp
3 // Purpose: implementation of wxFontBase methods
4 // Author: Vadim Zeitlin
8 // Copyright: (c) wxWindows team
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
21 #pragma implementation "fontbase.h"
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
35 // ============================================================================
37 // ============================================================================
39 // ----------------------------------------------------------------------------
41 // ----------------------------------------------------------------------------
43 wxFontEncoding
wxFontBase::ms_encodingDefault
= wxFONTENCODING_SYSTEM
;
46 wxFont
*wxFontBase::New(int size
,
52 wxFontEncoding encoding
)
54 return new wxFont(size
, family
, style
, weight
, underlined
, face
, encoding
);
57 wxFont
& wxFont::operator=(const wxFont
& font
)
62 return (wxFont
&)*this;
65 // VZ: is it correct to compare pointers and not the contents? (FIXME)
66 bool wxFontBase::operator==(const wxFont
& font
) const
68 return GetFontData() == font
.GetFontData();
71 bool wxFontBase::operator!=(const wxFont
& font
) const
73 return GetFontData() != font
.GetFontData();
76 wxString
wxFontBase::GetFamilyString() const
78 wxCHECK_MSG( Ok(), wxT("wxDEFAULT"), wxT("invalid font") );
80 switch ( GetFamily() )
82 case wxDECORATIVE
: return wxT("wxDECORATIVE");
83 case wxROMAN
: return wxT("wxROMAN");
84 case wxSCRIPT
: return wxT("wxSCRIPT");
85 case wxSWISS
: return wxT("wxSWISS");
86 case wxMODERN
: return wxT("wxMODERN");
87 case wxTELETYPE
: return wxT("wxTELETYPE");
88 default: return wxT("wxDEFAULT");
92 wxString
wxFontBase::GetStyleString() const
94 wxCHECK_MSG( Ok(), wxT("wxDEFAULT"), wxT("invalid font") );
98 case wxNORMAL
: return wxT("wxNORMAL");
99 case wxSLANT
: return wxT("wxSLANT");
100 case wxITALIC
: return wxT("wxITALIC");
101 default: return wxT("wxDEFAULT");
105 wxString
wxFontBase::GetWeightString() const
107 wxCHECK_MSG( Ok(), wxT("wxDEFAULT"), wxT("invalid font") );
109 switch ( GetWeight() )
111 case wxNORMAL
: return wxT("wxNORMAL");
112 case wxBOLD
: return wxT("wxBOLD");
113 case wxLIGHT
: return wxT("wxLIGHT");
114 default: return wxT("wxDEFAULT");