1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxFont class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
15 #if defined(__GNUG__) && !defined(__APPLE__)
16 #pragma interface "font.h"
19 class WXDLLEXPORT wxFontRefData
: public wxGDIRefData
21 friend class WXDLLEXPORT wxFont
;
30 , m_faceName("Geneva")
31 , m_encoding(wxFONTENCODING_DEFAULT
)
37 Init(10, wxDEFAULT
, wxNORMAL
, wxNORMAL
, FALSE
,
38 "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();
85 // common part of all ctors
91 const wxString
& faceName
,
92 wxFontEncoding encoding
);
94 // font characterstics
102 wxFontEncoding m_encoding
;
107 unsigned char m_macFontStyle
;
108 wxUint32 m_macATSUFontID
;
112 // ----------------------------------------------------------------------------
114 // ----------------------------------------------------------------------------
116 class WXDLLEXPORT wxFont
: public wxFontBase
121 wxFont(const wxFont
& font
)
132 bool underlined
= FALSE
,
133 const wxString
& face
= wxEmptyString
,
134 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
138 (void)Create(size
, family
, style
, weight
, underlined
, face
, encoding
);
141 wxFont(const wxNativeFontInfo
& info
)
148 wxFont(const wxString
& fontDesc
);
150 bool Create(int size
,
154 bool underlined
= FALSE
,
155 const wxString
& face
= wxEmptyString
,
156 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
);
158 bool Create(const wxNativeFontInfo
& info
);
163 wxFont
& operator=(const wxFont
& font
);
165 // implement base class pure virtuals
166 virtual int GetPointSize() const;
167 virtual int GetFamily() const;
168 virtual int GetStyle() const;
169 virtual int GetWeight() const;
170 virtual bool GetUnderlined() const;
171 virtual wxString
GetFaceName() const;
172 virtual wxFontEncoding
GetEncoding() const;
174 virtual void SetPointSize(int pointSize
);
175 virtual void SetFamily(int family
);
176 virtual void SetStyle(int style
);
177 virtual void SetWeight(int weight
);
178 virtual void SetFaceName(const wxString
& faceName
);
179 virtual void SetUnderlined(bool underlined
);
180 virtual void SetEncoding(wxFontEncoding encoding
);
182 // implementation only from now on
183 // -------------------------------
185 virtual bool RealizeResource();
188 // common part of all ctors
194 DECLARE_DYNAMIC_CLASS(wxFont
)