]>
Commit | Line | Data |
---|---|---|
83df96d6 JS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: font.h | |
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 | |
65571936 | 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 | |
83df96d6 JS |
24 | wxFont(int size, |
25 | int family, | |
26 | int style, | |
27 | int weight, | |
28 | bool underlined = FALSE, | |
29 | const wxString& face = wxEmptyString, | |
30 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) | |
31 | { | |
83df96d6 JS |
32 | (void)Create(size, family, style, weight, underlined, face, encoding); |
33 | } | |
9045ad9d | 34 | |
83df96d6 | 35 | wxFont(const wxNativeFontInfo& info); |
9045ad9d | 36 | |
83df96d6 JS |
37 | bool Create(int size, |
38 | int family, | |
39 | int style, | |
40 | int weight, | |
41 | bool underlined = FALSE, | |
42 | const wxString& face = wxEmptyString, | |
43 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT); | |
2b5f62a0 VZ |
44 | |
45 | // FIXME: I added the ! to make it compile; | |
46 | // is this right? - JACS | |
9045ad9d | 47 | #if !wxUSE_UNICODE |
83df96d6 JS |
48 | bool Create(const wxString& fontname, |
49 | wxFontEncoding fontenc = wxFONTENCODING_DEFAULT); | |
2b5f62a0 VZ |
50 | #endif |
51 | // DELETEME: no longer seems to be implemented. | |
52 | // bool Create(const wxNativeFontInfo& fontinfo); | |
9045ad9d | 53 | |
83df96d6 | 54 | virtual ~wxFont(); |
9045ad9d | 55 | |
83df96d6 JS |
56 | // implement base class pure virtuals |
57 | virtual int GetPointSize() const; | |
58 | virtual int GetFamily() const; | |
59 | virtual int GetStyle() const; | |
60 | virtual int GetWeight() const; | |
61 | virtual bool GetUnderlined() const; | |
62 | virtual wxString GetFaceName() const; | |
63 | virtual wxFontEncoding GetEncoding() const; | |
3bf5a59b | 64 | virtual const wxNativeFontInfo *GetNativeFontInfo() const; |
9045ad9d | 65 | |
2b5f62a0 | 66 | virtual bool IsFixedWidth() const; |
9045ad9d | 67 | |
83df96d6 JS |
68 | virtual void SetPointSize(int pointSize); |
69 | virtual void SetFamily(int family); | |
70 | virtual void SetStyle(int style); | |
71 | virtual void SetWeight(int weight); | |
85ab460e | 72 | virtual bool SetFaceName(const wxString& faceName); |
83df96d6 JS |
73 | virtual void SetUnderlined(bool underlined); |
74 | virtual void SetEncoding(wxFontEncoding encoding); | |
9045ad9d | 75 | |
2b5f62a0 | 76 | virtual void SetNoAntiAliasing( bool no = TRUE ); |
5ac2e80c | 77 | virtual bool GetNoAntiAliasing() const ; |
9045ad9d | 78 | |
2b5f62a0 VZ |
79 | // Implementation |
80 | ||
81 | #if wxUSE_PANGO | |
82 | #else | |
83df96d6 JS |
83 | // Find an existing, or create a new, XFontStruct |
84 | // based on this wxFont and the given scale. Append the | |
85 | // font to list in the private data for future reference. | |
9045ad9d | 86 | |
83df96d6 JS |
87 | // TODO This is a fairly basic implementation, that doesn't |
88 | // allow for different facenames, and also doesn't do a mapping | |
89 | // between 'standard' facenames (e.g. Arial, Helvetica, Times Roman etc.) | |
90 | // and the fonts that are available on a particular system. | |
91 | // Maybe we need to scan the user's machine to build up a profile | |
92 | // of the fonts and a mapping file. | |
9045ad9d | 93 | |
83df96d6 JS |
94 | // Return font struct, and optionally the Motif font list |
95 | wxXFont *GetInternalFont(double scale = 1.0, | |
96 | WXDisplay* display = NULL) const; | |
9045ad9d | 97 | |
bc797f4c | 98 | // Helper function for convenient access of the above. |
83df96d6 JS |
99 | WXFontStructPtr GetFontStruct(double scale = 1.0, |
100 | WXDisplay* display = NULL) const; | |
2b5f62a0 | 101 | #endif |
9045ad9d | 102 | |
83df96d6 | 103 | protected: |
9045ad9d VZ |
104 | virtual void DoSetNativeFontInfo( const wxNativeFontInfo& info ); |
105 | ||
83df96d6 | 106 | void Unshare(); |
9045ad9d | 107 | |
83df96d6 JS |
108 | private: |
109 | DECLARE_DYNAMIC_CLASS(wxFont) | |
110 | }; | |
111 | ||
112 | #endif | |
113 | // _WX_FONT_H_ |