1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxFont class
4 // Author: Julian Smart
7 // Copyright: (c) Julian Smart
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
14 // ----------------------------------------------------------------------------
16 // ----------------------------------------------------------------------------
21 wxOSX_SYSTEM_FONT_NONE
= 0,
22 wxOSX_SYSTEM_FONT_NORMAL
,
23 wxOSX_SYSTEM_FONT_BOLD
,
24 wxOSX_SYSTEM_FONT_SMALL
,
25 wxOSX_SYSTEM_FONT_SMALL_BOLD
,
26 wxOSX_SYSTEM_FONT_MINI
,
27 wxOSX_SYSTEM_FONT_MINI_BOLD
,
28 wxOSX_SYSTEM_FONT_LABELS
,
29 wxOSX_SYSTEM_FONT_VIEWS
33 class WXDLLIMPEXP_CORE wxFont
: public wxFontBase
39 wxFont(const wxFontInfo
& info
)
41 Create(info
.GetPointSize(),
49 if ( info
.IsUsingSizeInPixels() )
50 SetPixelSize(info
.GetPixelSize());
53 wxFont( wxOSXSystemFont systemFont
);
56 wxFont(WX_NSFont nsfont
);
59 #if FUTURE_WXWIN_COMPATIBILITY_3_0
64 bool underlined
= false,
65 const wxString
& face
= wxEmptyString
,
66 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
68 (void)Create(size
, (wxFontFamily
)family
, (wxFontStyle
)style
, (wxFontWeight
)weight
, underlined
, face
, encoding
);
76 bool underlined
= false,
77 const wxString
& face
= wxEmptyString
,
78 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
80 Create(size
, family
, style
, weight
, underlined
, face
, encoding
);
83 wxFont(const wxSize
& pixelSize
,
87 bool underlined
= false,
88 const wxString
& face
= wxEmptyString
,
89 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
91 Create(10, family
, style
, weight
, underlined
, face
, encoding
);
92 SetPixelSize(pixelSize
);
99 bool underlined
= false,
100 const wxString
& face
= wxEmptyString
,
101 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
);
103 wxFont(const wxNativeFontInfo
& info
)
108 wxFont(const wxString
& fontDesc
);
110 bool Create(const wxNativeFontInfo
& info
);
114 // implement base class pure virtuals
115 virtual int GetPointSize() const;
116 virtual wxSize
GetPixelSize() const;
117 virtual wxFontStyle
GetStyle() const;
118 virtual wxFontWeight
GetWeight() const;
119 virtual bool GetUnderlined() const;
120 virtual wxString
GetFaceName() const;
121 virtual wxFontEncoding
GetEncoding() const;
122 virtual const wxNativeFontInfo
*GetNativeFontInfo() const;
124 virtual bool IsFixedWidth() const;
126 virtual void SetPointSize(int pointSize
);
127 virtual void SetFamily(wxFontFamily family
);
128 virtual void SetStyle(wxFontStyle style
);
129 virtual void SetWeight(wxFontWeight weight
);
130 virtual bool SetFaceName(const wxString
& faceName
);
131 virtual void SetUnderlined(bool underlined
);
132 virtual void SetEncoding(wxFontEncoding encoding
);
134 wxDECLARE_COMMON_FONT_METHODS();
136 // implementation only from now on
137 // -------------------------------
139 virtual bool RealizeResource();
141 // Mac-specific, risks to change, don't use in portable code
143 #if wxOSX_USE_CARBON && wxOSX_USE_ATSU_TEXT
144 wxUint16
MacGetThemeFontID() const ;
146 // 'old' Quickdraw accessors
147 short MacGetFontNum() const;
148 wxByte
MacGetFontStyle() const;
151 #if wxOSX_USE_COCOA_OR_CARBON
152 CGFontRef
OSXGetCGFont() const;
155 #if wxOSX_USE_CORE_TEXT
156 CTFontRef
OSXGetCTFont() const;
159 #if wxOSX_USE_ATSU_TEXT
160 // Returns an ATSUStyle not ATSUStyle*
161 void* MacGetATSUStyle() const ;
162 void* OSXGetATSUStyle() const { return MacGetATSUStyle() ; }
164 wxDEPRECATED( wxUint32
MacGetATSUFontID() const );
165 wxDEPRECATED( wxUint32
MacGetATSUAdditionalQDStyles() const );
169 WX_NSFont
OSXGetNSFont() const;
170 static WX_NSFont
OSXCreateNSFont(wxOSXSystemFont font
, wxNativeFontInfo
* info
);
171 static WX_NSFont
OSXCreateNSFont(const wxNativeFontInfo
* info
);
172 static void SetNativeInfoFromNSFont(WX_NSFont nsfont
, wxNativeFontInfo
* info
);
176 WX_UIFont
OSXGetUIFont() const;
177 static WX_UIFont
OSXCreateUIFont(wxOSXSystemFont font
, wxNativeFontInfo
* info
);
178 static WX_UIFont
OSXCreateUIFont(const wxNativeFontInfo
* info
);
182 virtual void DoSetNativeFontInfo(const wxNativeFontInfo
& info
);
183 virtual wxFontFamily
DoGetFamily() const;
185 virtual wxGDIRefData
*CreateGDIRefData() const;
186 virtual wxGDIRefData
*CloneGDIRefData(const wxGDIRefData
*data
) const;
190 DECLARE_DYNAMIC_CLASS(wxFont
)
193 #endif // _WX_FONT_H_