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
41 wxFont(WX_NSFont nsfont
);
44 #if FUTURE_WXWIN_COMPATIBILITY_3_0
49 bool underlined
= false,
50 const wxString
& face
= wxEmptyString
,
51 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
53 (void)Create(size
, (wxFontFamily
)family
, (wxFontStyle
)style
, (wxFontWeight
)weight
, underlined
, face
, encoding
);
61 bool underlined
= false,
62 const wxString
& face
= wxEmptyString
,
63 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
65 Create(size
, family
, style
, weight
, underlined
, face
, encoding
);
68 wxFont(const wxSize
& pixelSize
,
72 bool underlined
= false,
73 const wxString
& face
= wxEmptyString
,
74 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
76 Create(10, family
, style
, weight
, underlined
, face
, encoding
);
77 SetPixelSize(pixelSize
);
84 bool underlined
= false,
85 const wxString
& face
= wxEmptyString
,
86 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
);
88 wxFont(const wxNativeFontInfo
& info
)
93 wxFont(const wxString
& fontDesc
);
95 bool Create(const wxNativeFontInfo
& info
);
97 bool CreateSystemFont(wxOSXSystemFont font
);
101 // implement base class pure virtuals
102 virtual int GetPointSize() const;
103 virtual wxSize
GetPixelSize() const;
104 virtual wxFontFamily
GetFamily() const;
105 virtual wxFontStyle
GetStyle() const;
106 virtual wxFontWeight
GetWeight() const;
107 virtual bool GetUnderlined() const;
108 virtual wxString
GetFaceName() const;
109 virtual wxFontEncoding
GetEncoding() const;
110 virtual const wxNativeFontInfo
*GetNativeFontInfo() const;
112 virtual void SetPointSize(int pointSize
);
113 virtual void SetFamily(wxFontFamily family
);
114 virtual void SetStyle(wxFontStyle style
);
115 virtual void SetWeight(wxFontWeight weight
);
116 virtual bool SetFaceName(const wxString
& faceName
);
117 virtual void SetUnderlined(bool underlined
);
118 virtual void SetEncoding(wxFontEncoding encoding
);
120 wxDECLARE_COMMON_FONT_METHODS();
122 // implementation only from now on
123 // -------------------------------
125 virtual bool RealizeResource();
127 // Mac-specific, risks to change, don't use in portable code
129 #if wxOSX_USE_CARBON && wxOSX_USE_ATSU_TEXT
130 wxUint16
MacGetThemeFontID() const ;
132 // 'old' Quickdraw accessors
133 short MacGetFontNum() const;
134 wxByte
MacGetFontStyle() const;
137 #if wxOSX_USE_COCOA_OR_CARBON
138 CGFontRef
OSXGetCGFont() const;
141 #if wxOSX_USE_CORE_TEXT
142 CTFontRef
OSXGetCTFont() const;
145 #if wxOSX_USE_ATSU_TEXT
146 // Returns an ATSUStyle not ATSUStyle*
147 void* MacGetATSUStyle() const ;
148 void* OSXGetATSUStyle() const { return MacGetATSUStyle() ; }
150 #if WXWIN_COMPATIBILITY_2_8
151 wxDEPRECATED( wxUint32
MacGetATSUFontID() const );
152 wxDEPRECATED( wxUint32
MacGetATSUAdditionalQDStyles() const );
157 WX_NSFont
OSXGetNSFont() const;
158 static WX_NSFont
OSXCreateNSFont(wxOSXSystemFont font
, wxNativeFontInfo
* info
);
159 static WX_NSFont
OSXCreateNSFont(const wxNativeFontInfo
* info
);
160 static void SetNativeInfoFromNSFont(WX_NSFont nsfont
, wxNativeFontInfo
* info
);
164 WX_UIFont
OSXGetUIFont() const;
165 static WX_UIFont
OSXCreateUIFont(wxOSXSystemFont font
, wxNativeFontInfo
* info
);
166 static WX_UIFont
OSXCreateUIFont(const wxNativeFontInfo
* info
);
170 virtual void DoSetNativeFontInfo(const wxNativeFontInfo
& info
);
172 virtual wxGDIRefData
*CreateGDIRefData() const;
173 virtual wxGDIRefData
*CloneGDIRefData(const wxGDIRefData
*data
) const;
177 DECLARE_DYNAMIC_CLASS(wxFont
)
180 #endif // _WX_FONT_H_