]>
Commit | Line | Data |
---|---|---|
5c6eb3a8 SC |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: font.h | |
3 | // Purpose: wxFont class | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 01/02/97 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Julian Smart | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_FONT_H_ | |
13 | #define _WX_FONT_H_ | |
14 | ||
15 | // ---------------------------------------------------------------------------- | |
16 | // wxFont | |
17 | // ---------------------------------------------------------------------------- | |
18 | ||
19 | class WXDLLIMPEXP_CORE wxFont : public wxFontBase | |
20 | { | |
21 | public: | |
22 | // ctors and such | |
23 | wxFont() { } | |
24 | ||
25 | wxFont(int size, | |
26 | int family, | |
27 | int style, | |
28 | int weight, | |
29 | bool underlined = FALSE, | |
30 | const wxString& face = wxEmptyString, | |
31 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) | |
32 | { | |
33 | (void)Create(size, family, style, weight, underlined, face, encoding); | |
34 | } | |
35 | ||
36 | wxFont(const wxNativeFontInfo& info) | |
37 | { | |
38 | (void)Create(info); | |
39 | } | |
40 | ||
41 | wxFont(const wxString& fontDesc); | |
42 | ||
43 | bool Create(int size, | |
44 | int family, | |
45 | int style, | |
46 | int weight, | |
47 | bool underlined = FALSE, | |
48 | const wxString& face = wxEmptyString, | |
49 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT); | |
50 | ||
51 | bool Create(const wxNativeFontInfo& info); | |
52 | ||
524c47aa | 53 | #if wxOSX_USE_CARBON |
5c6eb3a8 | 54 | bool MacCreateFromThemeFont( wxUint16 themeFontID ) ; |
524c47aa | 55 | #endif |
b46f221f | 56 | #if wxOSX_USE_CORE_TEXT |
5c6eb3a8 SC |
57 | bool MacCreateFromUIFont( wxUint32 coreTextFontType ); |
58 | bool MacCreateFromCTFontDescriptor( const void * ctFontDescriptor, int pointSize = 0 ); | |
59 | bool MacCreateFromCTFont( const void * ctFont ); | |
60 | #endif | |
61 | ||
62 | virtual ~wxFont(); | |
63 | ||
64 | // implement base class pure virtuals | |
65 | virtual int GetPointSize() const; | |
66 | virtual wxSize GetPixelSize() const; | |
67 | virtual int GetFamily() const; | |
68 | virtual int GetStyle() const; | |
69 | virtual int GetWeight() const; | |
70 | virtual bool GetUnderlined() const; | |
71 | virtual wxString GetFaceName() const; | |
72 | virtual wxFontEncoding GetEncoding() const; | |
73 | virtual const wxNativeFontInfo *GetNativeFontInfo() const; | |
74 | ||
75 | virtual void SetPointSize(int pointSize); | |
76 | virtual void SetFamily(int family); | |
77 | virtual void SetStyle(int style); | |
78 | virtual void SetWeight(int weight); | |
79 | virtual bool SetFaceName(const wxString& faceName); | |
80 | virtual void SetUnderlined(bool underlined); | |
81 | virtual void SetEncoding(wxFontEncoding encoding); | |
82 | ||
83 | // implementation only from now on | |
84 | // ------------------------------- | |
85 | ||
86 | virtual bool RealizeResource(); | |
87 | ||
88 | // Unofficial API, don't use | |
89 | virtual void SetNoAntiAliasing( bool noAA = TRUE ) ; | |
90 | virtual bool GetNoAntiAliasing() const ; | |
91 | ||
92 | // Mac-specific, risks to change, don't use in portable code | |
93 | ||
b46f221f | 94 | #if wxOSX_USE_ATSU_TEXT |
5c6eb3a8 SC |
95 | // 'old' Quickdraw accessors |
96 | short MacGetFontNum() const; | |
97 | short MacGetFontSize() const; | |
98 | wxByte MacGetFontStyle() const; | |
99 | ||
100 | // 'new' ATSUI accessors | |
101 | wxUint32 MacGetATSUFontID() const; | |
102 | wxUint32 MacGetATSUAdditionalQDStyles() const; | |
103 | wxUint16 MacGetThemeFontID() const ; | |
104 | ||
105 | // Returns an ATSUStyle not ATSUStyle* | |
106 | #endif | |
b46f221f | 107 | #if wxOSX_USE_CORE_TEXT |
5c6eb3a8 | 108 | const void * MacGetCTFont() const; |
5c6eb3a8 | 109 | #endif |
b46f221f | 110 | #if wxOSX_USE_CORE_TEXT || wxOSX_USE_ATSU_TEXT |
5c6eb3a8 SC |
111 | void* MacGetATSUStyle() const ; |
112 | #endif | |
113 | ||
114 | protected: | |
115 | virtual wxGDIRefData *CreateGDIRefData() const; | |
116 | virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; | |
117 | ||
118 | private: | |
119 | void Unshare(); | |
120 | ||
121 | DECLARE_DYNAMIC_CLASS(wxFont) | |
122 | }; | |
123 | ||
124 | #endif // _WX_FONT_H_ |