1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxFont class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
16 #pragma interface "font.h"
19 class WXDLLEXPORT wxFontRefData
: public wxGDIRefData
21 friend class WXDLLEXPORT wxFont
;
25 Init(10, wxDEFAULT
, wxNORMAL
, wxNORMAL
, FALSE
,
26 "Geneva", wxFONTENCODING_DEFAULT
);
29 wxFontRefData(const wxFontRefData
& data
)
31 Init(data
.m_pointSize
, data
.m_family
, data
.m_style
, data
.m_weight
,
32 data
.m_underlined
, data
.m_faceName
, data
.m_encoding
);
34 m_macFontNum
= data
.m_macFontNum
;
35 m_macFontSize
= data
.m_macFontSize
;
36 m_macFontStyle
= data
.m_macFontStyle
;
37 m_fontId
= data
.m_fontId
;
40 wxFontRefData(int size
,
45 const wxString
& faceName
,
46 wxFontEncoding encoding
)
48 Init(size
, family
, style
, weight
, underlined
, faceName
, encoding
);
51 virtual ~wxFontRefData();
53 // common part of all ctors
59 const wxString
& faceName
,
60 wxFontEncoding encoding
);
62 // font characterstics
70 wxFontEncoding m_encoding
;
75 unsigned char m_macFontStyle
;
76 wxUint32 m_macATSUFontID
;
80 // ----------------------------------------------------------------------------
82 // ----------------------------------------------------------------------------
84 class WXDLLEXPORT wxFont
: public wxFontBase
89 wxFont(const wxFont
& font
) { Init(); Ref(font
); }
95 bool underlined
= FALSE
,
96 const wxString
& face
= wxEmptyString
,
97 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
101 (void)Create(size
, family
, style
, weight
, underlined
, face
, encoding
);
104 wxFont(const wxNativeFontInfo
& info
)
111 wxFont(const wxString
& fontDesc
);
113 bool Create(int size
,
117 bool underlined
= FALSE
,
118 const wxString
& face
= wxEmptyString
,
119 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
);
121 bool Create(const wxNativeFontInfo
& info
);
126 wxFont
& operator=(const wxFont
& font
);
128 // implement base class pure virtuals
129 virtual int GetPointSize() const;
130 virtual int GetFamily() const;
131 virtual int GetStyle() const;
132 virtual int GetWeight() const;
133 virtual bool GetUnderlined() const;
134 virtual wxString
GetFaceName() const;
135 virtual wxFontEncoding
GetEncoding() const;
137 virtual void SetPointSize(int pointSize
);
138 virtual void SetFamily(int family
);
139 virtual void SetStyle(int style
);
140 virtual void SetWeight(int weight
);
141 virtual void SetFaceName(const wxString
& faceName
);
142 virtual void SetUnderlined(bool underlined
);
143 virtual void SetEncoding(wxFontEncoding encoding
);
145 // implementation only from now on
146 // -------------------------------
148 virtual bool RealizeResource();
151 // common part of all ctors
157 DECLARE_DYNAMIC_CLASS(wxFont
)