1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxFont class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "font.h"
19 class WXDLLEXPORT wxFontRefData
: public wxGDIRefData
21 friend class WXDLLEXPORT wxFont
;
30 , m_faceName(wxT("Geneva"))
31 , m_encoding(wxFONTENCODING_DEFAULT
)
37 Init(10, wxDEFAULT
, wxNORMAL
, wxNORMAL
, FALSE
,
38 wxT("Geneva"), wxFONTENCODING_DEFAULT
);
41 wxFontRefData(const wxFontRefData
& data
)
43 , m_fontId(data
.m_fontId
)
44 , m_pointSize(data
.m_pointSize
)
45 , m_family(data
.m_family
)
46 , m_style(data
.m_style
)
47 , m_weight(data
.m_weight
)
48 , m_underlined(data
.m_underlined
)
49 , m_faceName(data
.m_faceName
)
50 , m_encoding(data
.m_encoding
)
51 , m_macFontNum(data
.m_macFontNum
)
52 , m_macFontSize(data
.m_macFontSize
)
53 , m_macFontStyle(data
.m_macFontStyle
)
54 , m_macATSUFontID(data
.m_macATSUFontID
)
56 Init(data
.m_pointSize
, data
.m_family
, data
.m_style
, data
.m_weight
,
57 data
.m_underlined
, data
.m_faceName
, data
.m_encoding
);
60 wxFontRefData(int size
,
65 const wxString
& faceName
,
66 wxFontEncoding encoding
)
72 , m_underlined(underlined
)
73 , m_faceName(faceName
)
74 , m_encoding(encoding
)
80 Init(size
, family
, style
, weight
, underlined
, faceName
, encoding
);
83 virtual ~wxFontRefData();
84 void SetNoAntiAliasing( bool no
= TRUE
) { m_noAA
= no
; }
85 bool GetNoAntiAliasing() { return m_noAA
; }
88 // common part of all ctors
94 const wxString
& faceName
,
95 wxFontEncoding encoding
);
97 // font characterstics
105 wxFontEncoding m_encoding
;
106 bool m_noAA
; // No anti-aliasing
111 unsigned char m_macFontStyle
;
112 wxUint32 m_macATSUFontID
;
116 // ----------------------------------------------------------------------------
118 // ----------------------------------------------------------------------------
120 class WXDLLEXPORT wxFont
: public wxFontBase
125 wxFont(const wxFont
& font
)
136 bool underlined
= FALSE
,
137 const wxString
& face
= wxEmptyString
,
138 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
142 (void)Create(size
, family
, style
, weight
, underlined
, face
, encoding
);
145 wxFont(const wxNativeFontInfo
& info
)
152 wxFont(const wxString
& fontDesc
);
154 bool Create(int size
,
158 bool underlined
= FALSE
,
159 const wxString
& face
= wxEmptyString
,
160 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
);
162 bool Create(const wxNativeFontInfo
& info
);
167 wxFont
& operator=(const wxFont
& font
);
169 // implement base class pure virtuals
170 virtual int GetPointSize() const;
171 virtual int GetFamily() const;
172 virtual int GetStyle() const;
173 virtual int GetWeight() const;
174 virtual bool GetUnderlined() const;
175 virtual wxString
GetFaceName() const;
176 virtual wxFontEncoding
GetEncoding() const;
178 virtual void SetPointSize(int pointSize
);
179 virtual void SetFamily(int family
);
180 virtual void SetStyle(int style
);
181 virtual void SetWeight(int weight
);
182 virtual void SetFaceName(const wxString
& faceName
);
183 virtual void SetUnderlined(bool underlined
);
184 virtual void SetEncoding(wxFontEncoding encoding
);
186 // implementation only from now on
187 // -------------------------------
189 virtual bool RealizeResource();
191 // Unofficial API, don't use
192 virtual void SetNoAntiAliasing( bool noAA
= TRUE
) ;
193 virtual bool GetNoAntiAliasing() ;
195 // common part of all ctors
201 DECLARE_DYNAMIC_CLASS(wxFont
)