1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxFont class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
15 // ----------------------------------------------------------------------------
17 // ----------------------------------------------------------------------------
22 wxOSX_SYSTEM_FONT_NONE
= 0,
23 wxOSX_SYSTEM_FONT_NORMAL
,
24 wxOSX_SYSTEM_FONT_BOLD
,
25 wxOSX_SYSTEM_FONT_SMALL
,
26 wxOSX_SYSTEM_FONT_SMALL_BOLD
,
27 wxOSX_SYSTEM_FONT_MINI
,
28 wxOSX_SYSTEM_FONT_MINI_BOLD
,
29 wxOSX_SYSTEM_FONT_LABELS
,
30 wxOSX_SYSTEM_FONT_VIEWS
34 class WXDLLIMPEXP_CORE wxFont
: public wxFontBase
40 wxFont(const wxFontInfo
& info
)
42 Create(info
.GetPointSize(),
50 if ( info
.IsUsingSizeInPixels() )
51 SetPixelSize(info
.GetPixelSize());
54 wxFont( wxOSXSystemFont systemFont
);
57 wxFont(WX_NSFont nsfont
);
60 #if FUTURE_WXWIN_COMPATIBILITY_3_0
65 bool underlined
= false,
66 const wxString
& face
= wxEmptyString
,
67 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
69 (void)Create(size
, (wxFontFamily
)family
, (wxFontStyle
)style
, (wxFontWeight
)weight
, underlined
, face
, encoding
);
77 bool underlined
= false,
78 const wxString
& face
= wxEmptyString
,
79 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
81 Create(size
, family
, style
, weight
, underlined
, face
, encoding
);
84 wxFont(const wxSize
& pixelSize
,
88 bool underlined
= false,
89 const wxString
& face
= wxEmptyString
,
90 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
92 Create(10, family
, style
, weight
, underlined
, face
, encoding
);
93 SetPixelSize(pixelSize
);
100 bool underlined
= false,
101 const wxString
& face
= wxEmptyString
,
102 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
);
104 wxFont(const wxNativeFontInfo
& info
)
109 wxFont(const wxString
& fontDesc
);
111 bool Create(const wxNativeFontInfo
& info
);
115 // implement base class pure virtuals
116 virtual int GetPointSize() const;
117 virtual wxSize
GetPixelSize() const;
118 virtual wxFontStyle
GetStyle() const;
119 virtual wxFontWeight
GetWeight() const;
120 virtual bool GetUnderlined() const;
121 virtual wxString
GetFaceName() const;
122 virtual wxFontEncoding
GetEncoding() const;
123 virtual const wxNativeFontInfo
*GetNativeFontInfo() const;
125 virtual bool IsFixedWidth() const;
127 virtual void SetPointSize(int pointSize
);
128 virtual void SetFamily(wxFontFamily family
);
129 virtual void SetStyle(wxFontStyle style
);
130 virtual void SetWeight(wxFontWeight weight
);
131 virtual bool SetFaceName(const wxString
& faceName
);
132 virtual void SetUnderlined(bool underlined
);
133 virtual void SetEncoding(wxFontEncoding encoding
);
135 wxDECLARE_COMMON_FONT_METHODS();
137 // implementation only from now on
138 // -------------------------------
140 virtual bool RealizeResource();
142 // Mac-specific, risks to change, don't use in portable code
144 #if wxOSX_USE_CARBON && wxOSX_USE_ATSU_TEXT
145 wxUint16
MacGetThemeFontID() const ;
147 // 'old' Quickdraw accessors
148 short MacGetFontNum() const;
149 wxByte
MacGetFontStyle() const;
152 #if wxOSX_USE_COCOA_OR_CARBON
153 CGFontRef
OSXGetCGFont() const;
156 #if wxOSX_USE_CORE_TEXT
157 CTFontRef
OSXGetCTFont() const;
160 #if wxOSX_USE_ATSU_TEXT
161 // Returns an ATSUStyle not ATSUStyle*
162 void* MacGetATSUStyle() const ;
163 void* OSXGetATSUStyle() const { return MacGetATSUStyle() ; }
165 wxDEPRECATED( wxUint32
MacGetATSUFontID() const );
166 wxDEPRECATED( wxUint32
MacGetATSUAdditionalQDStyles() const );
170 WX_NSFont
OSXGetNSFont() const;
171 static WX_NSFont
OSXCreateNSFont(wxOSXSystemFont font
, wxNativeFontInfo
* info
);
172 static WX_NSFont
OSXCreateNSFont(const wxNativeFontInfo
* info
);
173 static void SetNativeInfoFromNSFont(WX_NSFont nsfont
, wxNativeFontInfo
* info
);
177 WX_UIFont
OSXGetUIFont() const;
178 static WX_UIFont
OSXCreateUIFont(wxOSXSystemFont font
, wxNativeFontInfo
* info
);
179 static WX_UIFont
OSXCreateUIFont(const wxNativeFontInfo
* info
);
183 virtual void DoSetNativeFontInfo(const wxNativeFontInfo
& info
);
184 virtual wxFontFamily
DoGetFamily() const;
186 virtual wxGDIRefData
*CreateGDIRefData() const;
187 virtual wxGDIRefData
*CloneGDIRefData(const wxGDIRefData
*data
) const;
191 DECLARE_DYNAMIC_CLASS(wxFont
)
194 #endif // _WX_FONT_H_