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( wxOSXSystemFont systemFont
);
43 wxFont(WX_NSFont nsfont
);
46 #if FUTURE_WXWIN_COMPATIBILITY_3_0
51 bool underlined
= false,
52 const wxString
& face
= wxEmptyString
,
53 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
55 (void)Create(size
, (wxFontFamily
)family
, (wxFontStyle
)style
, (wxFontWeight
)weight
, underlined
, face
, encoding
);
63 bool underlined
= false,
64 const wxString
& face
= wxEmptyString
,
65 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
67 Create(size
, family
, style
, weight
, underlined
, face
, encoding
);
70 wxFont(const wxSize
& pixelSize
,
74 bool underlined
= false,
75 const wxString
& face
= wxEmptyString
,
76 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
78 Create(10, family
, style
, weight
, underlined
, face
, encoding
);
79 SetPixelSize(pixelSize
);
84 int flags
= wxFONTFLAG_DEFAULT
,
85 const wxString
& face
= wxEmptyString
,
86 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
88 Create(pointSize
, family
,
89 GetStyleFromFlags(flags
),
90 GetWeightFromFlags(flags
),
91 GetUnderlinedFromFlags(flags
),
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 void SetPointSize(int pointSize
);
125 virtual void SetFamily(wxFontFamily family
);
126 virtual void SetStyle(wxFontStyle style
);
127 virtual void SetWeight(wxFontWeight weight
);
128 virtual bool SetFaceName(const wxString
& faceName
);
129 virtual void SetUnderlined(bool underlined
);
130 virtual void SetEncoding(wxFontEncoding encoding
);
132 wxDECLARE_COMMON_FONT_METHODS();
134 // implementation only from now on
135 // -------------------------------
137 virtual bool RealizeResource();
139 // Mac-specific, risks to change, don't use in portable code
141 #if wxOSX_USE_CARBON && wxOSX_USE_ATSU_TEXT
142 wxUint16
MacGetThemeFontID() const ;
144 // 'old' Quickdraw accessors
145 short MacGetFontNum() const;
146 wxByte
MacGetFontStyle() const;
149 #if wxOSX_USE_COCOA_OR_CARBON
150 CGFontRef
OSXGetCGFont() const;
153 #if wxOSX_USE_CORE_TEXT
154 CTFontRef
OSXGetCTFont() const;
157 #if wxOSX_USE_ATSU_TEXT
158 // Returns an ATSUStyle not ATSUStyle*
159 void* MacGetATSUStyle() const ;
160 void* OSXGetATSUStyle() const { return MacGetATSUStyle() ; }
162 wxDEPRECATED( wxUint32
MacGetATSUFontID() const );
163 wxDEPRECATED( wxUint32
MacGetATSUAdditionalQDStyles() const );
167 WX_NSFont
OSXGetNSFont() const;
168 static WX_NSFont
OSXCreateNSFont(wxOSXSystemFont font
, wxNativeFontInfo
* info
);
169 static WX_NSFont
OSXCreateNSFont(const wxNativeFontInfo
* info
);
170 static void SetNativeInfoFromNSFont(WX_NSFont nsfont
, wxNativeFontInfo
* info
);
174 WX_UIFont
OSXGetUIFont() const;
175 static WX_UIFont
OSXCreateUIFont(wxOSXSystemFont font
, wxNativeFontInfo
* info
);
176 static WX_UIFont
OSXCreateUIFont(const wxNativeFontInfo
* info
);
180 virtual void DoSetNativeFontInfo(const wxNativeFontInfo
& info
);
181 virtual wxFontFamily
DoGetFamily() const;
183 virtual wxGDIRefData
*CreateGDIRefData() const;
184 virtual wxGDIRefData
*CloneGDIRefData(const wxGDIRefData
*data
) const;
188 DECLARE_DYNAMIC_CLASS(wxFont
)
191 #endif // _WX_FONT_H_