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