]>
Commit | Line | Data |
---|---|---|
83df96d6 | 1 | ///////////////////////////////////////////////////////////////////////////// |
1b88201f | 2 | // Name: wx/x11/font.h |
83df96d6 JS |
3 | // Purpose: wxFont class |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 17/09/98 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Julian Smart | |
1b88201f | 9 | // Licence: wxWindows licence |
83df96d6 JS |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_FONT_H_ | |
13 | #define _WX_FONT_H_ | |
14 | ||
83df96d6 JS |
15 | class wxXFont; |
16 | ||
17 | // Font | |
968eb2ef | 18 | class WXDLLIMPEXP_CORE wxFont : public wxFontBase |
83df96d6 JS |
19 | { |
20 | public: | |
21 | // ctors and such | |
f8855e47 | 22 | wxFont() { } |
9045ad9d | 23 | |
0c14b6c3 | 24 | #if FUTURE_WXWIN_COMPATIBILITY_3_0 |
83df96d6 | 25 | wxFont(int size, |
0c14b6c3 FM |
26 | int family, |
27 | int style, | |
28 | int weight, | |
29 | bool underlined = false, | |
30 | const wxString& face = wxEmptyString, | |
31 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) | |
83df96d6 | 32 | { |
0c14b6c3 | 33 | (void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding); |
83df96d6 | 34 | } |
0c14b6c3 | 35 | #endif |
9045ad9d | 36 | |
0c14b6c3 FM |
37 | wxFont(int size, |
38 | wxFontFamily family, | |
39 | wxFontStyle style, | |
40 | wxFontWeight weight, | |
41 | bool underlined = false, | |
42 | const wxString& face = wxEmptyString, | |
43 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) | |
44 | { | |
45 | Create(size, family, style, weight, underlined, face, encoding); | |
46 | } | |
9045ad9d | 47 | |
83df96d6 | 48 | bool Create(int size, |
0c14b6c3 FM |
49 | wxFontFamily family, |
50 | wxFontStyle style, | |
51 | wxFontWeight weight, | |
52 | bool underlined = false, | |
53 | const wxString& face = wxEmptyString, | |
54 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT); | |
55 | ||
56 | wxFont(const wxNativeFontInfo& info); | |
2b5f62a0 VZ |
57 | |
58 | // FIXME: I added the ! to make it compile; | |
59 | // is this right? - JACS | |
9045ad9d | 60 | #if !wxUSE_UNICODE |
83df96d6 JS |
61 | bool Create(const wxString& fontname, |
62 | wxFontEncoding fontenc = wxFONTENCODING_DEFAULT); | |
2b5f62a0 VZ |
63 | #endif |
64 | // DELETEME: no longer seems to be implemented. | |
65 | // bool Create(const wxNativeFontInfo& fontinfo); | |
9045ad9d | 66 | |
83df96d6 | 67 | virtual ~wxFont(); |
9045ad9d | 68 | |
83df96d6 JS |
69 | // implement base class pure virtuals |
70 | virtual int GetPointSize() const; | |
0c14b6c3 FM |
71 | virtual wxFontFamily GetFamily() const; |
72 | virtual wxFontStyle GetStyle() const; | |
73 | virtual wxFontWeight GetWeight() const; | |
83df96d6 JS |
74 | virtual bool GetUnderlined() const; |
75 | virtual wxString GetFaceName() const; | |
76 | virtual wxFontEncoding GetEncoding() const; | |
3bf5a59b | 77 | virtual const wxNativeFontInfo *GetNativeFontInfo() const; |
9045ad9d | 78 | |
2b5f62a0 | 79 | virtual bool IsFixedWidth() const; |
9045ad9d | 80 | |
83df96d6 | 81 | virtual void SetPointSize(int pointSize); |
0c14b6c3 FM |
82 | virtual void SetFamily(wxFontFamily family); |
83 | virtual void SetStyle(wxFontStyle style); | |
84 | virtual void SetWeight(wxFontWeight weight); | |
85ab460e | 85 | virtual bool SetFaceName(const wxString& faceName); |
83df96d6 JS |
86 | virtual void SetUnderlined(bool underlined); |
87 | virtual void SetEncoding(wxFontEncoding encoding); | |
9045ad9d | 88 | |
0c14b6c3 FM |
89 | WXDECLARE_COMPAT_SETTERS |
90 | ||
2b5f62a0 | 91 | virtual void SetNoAntiAliasing( bool no = TRUE ); |
5ac2e80c | 92 | virtual bool GetNoAntiAliasing() const ; |
9045ad9d | 93 | |
2b5f62a0 VZ |
94 | // Implementation |
95 | ||
96 | #if wxUSE_PANGO | |
97 | #else | |
83df96d6 JS |
98 | // Find an existing, or create a new, XFontStruct |
99 | // based on this wxFont and the given scale. Append the | |
100 | // font to list in the private data for future reference. | |
9045ad9d | 101 | |
83df96d6 JS |
102 | // TODO This is a fairly basic implementation, that doesn't |
103 | // allow for different facenames, and also doesn't do a mapping | |
104 | // between 'standard' facenames (e.g. Arial, Helvetica, Times Roman etc.) | |
105 | // and the fonts that are available on a particular system. | |
106 | // Maybe we need to scan the user's machine to build up a profile | |
107 | // of the fonts and a mapping file. | |
9045ad9d | 108 | |
83df96d6 JS |
109 | // Return font struct, and optionally the Motif font list |
110 | wxXFont *GetInternalFont(double scale = 1.0, | |
111 | WXDisplay* display = NULL) const; | |
9045ad9d | 112 | |
bc797f4c | 113 | // Helper function for convenient access of the above. |
83df96d6 JS |
114 | WXFontStructPtr GetFontStruct(double scale = 1.0, |
115 | WXDisplay* display = NULL) const; | |
2b5f62a0 | 116 | #endif |
9045ad9d | 117 | |
83df96d6 | 118 | protected: |
8f884a0d VZ |
119 | virtual wxGDIRefData *CreateGDIRefData() const; |
120 | virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; | |
121 | ||
9045ad9d VZ |
122 | virtual void DoSetNativeFontInfo( const wxNativeFontInfo& info ); |
123 | ||
83df96d6 | 124 | void Unshare(); |
9045ad9d | 125 | |
83df96d6 JS |
126 | private: |
127 | DECLARE_DYNAMIC_CLASS(wxFont) | |
128 | }; | |
129 | ||
130 | #endif | |
1b88201f | 131 | // _WX_FONT_H_ |