]>
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
;
45 wxFont
*wxFontBase::New(int size
,
51 wxFontEncoding encoding
)
53 return new wxFont(size
, family
, style
, weight
, underlined
, face
, encoding
);
56 wxFont
& wxFont::operator=(const wxFont
& font
)
61 return (wxFont
&)*this;
64 // VZ: is it correct to compare pointers and not the contents? (FIXME)
65 bool wxFontBase::operator==(const wxFont
& font
) const
67 return GetFontData() == font
.GetFontData();
70 bool wxFontBase::operator!=(const wxFont
& font
) const
72 return GetFontData() != font
.GetFontData();
75 wxString
wxFontBase::GetFamilyString() const
77 wxCHECK_MSG( Ok(), wxT("wxDEFAULT"), wxT("invalid font") );
79 switch ( GetFamily() )
81 case wxDECORATIVE
: return wxT("wxDECORATIVE");
82 case wxROMAN
: return wxT("wxROMAN");
83 case wxSCRIPT
: return wxT("wxSCRIPT");
84 case wxSWISS
: return wxT("wxSWISS");
85 case wxMODERN
: return wxT("wxMODERN");
86 case wxTELETYPE
: return wxT("wxTELETYPE");
87 default: return wxT("wxDEFAULT");
91 wxString
wxFontBase::GetStyleString() const
93 wxCHECK_MSG( Ok(), wxT("wxDEFAULT"), wxT("invalid font") );
97 case wxNORMAL
: return wxT("wxNORMAL");
98 case wxSLANT
: return wxT("wxSLANT");
99 case wxITALIC
: return wxT("wxITALIC");
100 default: return wxT("wxDEFAULT");
104 wxString
wxFontBase::GetWeightString() const
106 wxCHECK_MSG( Ok(), wxT("wxDEFAULT"), wxT("invalid font") );
108 switch ( GetWeight() )
110 case wxNORMAL
: return wxT("wxNORMAL");
111 case wxBOLD
: return wxT("wxBOLD");
112 case wxLIGHT
: return wxT("wxLIGHT");
113 default: return wxT("wxDEFAULT");