]>
Commit | Line | Data |
---|---|---|
9b6dbb09 | 1 | ///////////////////////////////////////////////////////////////////////////// |
53c5fb20 | 2 | // Name: wx/motif/font.h |
9b6dbb09 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 | |
53c5fb20 | 9 | // Licence: wxWindows licence |
9b6dbb09 JS |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_FONT_H_ | |
13 | #define _WX_FONT_H_ | |
14 | ||
b0b2263b | 15 | #if __WXMOTIF20__ && !__WXLESSTIF__ |
eb9d223a | 16 | #define wxMOTIF_USE_RENDER_TABLE 1 |
b0b2263b | 17 | #else |
eb9d223a | 18 | #define wxMOTIF_USE_RENDER_TABLE 0 |
996994c7 | 19 | #endif |
105fbe1f | 20 | #define wxMOTIF_NEW_FONT_HANDLING wxMOTIF_USE_RENDER_TABLE |
996994c7 | 21 | |
a2e91a93 VZ |
22 | class wxXFont; |
23 | ||
93ccaed8 | 24 | // Font |
94c7b088 | 25 | class WXDLLIMPEXP_CORE wxFont : public wxFontBase |
f97c9854 JS |
26 | { |
27 | public: | |
93ccaed8 | 28 | // ctors and such |
f8855e47 | 29 | wxFont() { } |
9045ad9d | 30 | |
93ccaed8 | 31 | wxFont(int size, |
83df96d6 JS |
32 | int family, |
33 | int style, | |
34 | int weight, | |
96be256b | 35 | bool underlined = false, |
83df96d6 JS |
36 | const wxString& face = wxEmptyString, |
37 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) | |
93ccaed8 | 38 | { |
93ccaed8 VZ |
39 | (void)Create(size, family, style, weight, underlined, face, encoding); |
40 | } | |
9045ad9d | 41 | |
98c9fc2d | 42 | wxFont(const wxNativeFontInfo& info); |
9045ad9d | 43 | |
93ccaed8 | 44 | bool Create(int size, |
83df96d6 JS |
45 | int family, |
46 | int style, | |
47 | int weight, | |
96be256b | 48 | bool underlined = false, |
83df96d6 JS |
49 | const wxString& face = wxEmptyString, |
50 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT); | |
9045ad9d | 51 | |
563f868d GD |
52 | // wxMOTIF-specific |
53 | bool Create(const wxString& fontname, | |
83df96d6 | 54 | wxFontEncoding fontenc = wxFONTENCODING_DEFAULT); |
563f868d | 55 | bool Create(const wxNativeFontInfo& fontinfo); |
9045ad9d | 56 | |
93ccaed8 | 57 | virtual ~wxFont(); |
9045ad9d | 58 | |
93ccaed8 VZ |
59 | // implement base class pure virtuals |
60 | virtual int GetPointSize() const; | |
61 | virtual int GetFamily() const; | |
62 | virtual int GetStyle() const; | |
63 | virtual int GetWeight() const; | |
64 | virtual bool GetUnderlined() const; | |
65 | virtual wxString GetFaceName() const; | |
66 | virtual wxFontEncoding GetEncoding() const; | |
3bf5a59b | 67 | virtual const wxNativeFontInfo *GetNativeFontInfo() const; |
9045ad9d | 68 | |
93ccaed8 VZ |
69 | virtual void SetPointSize(int pointSize); |
70 | virtual void SetFamily(int family); | |
71 | virtual void SetStyle(int style); | |
72 | virtual void SetWeight(int weight); | |
85ab460e | 73 | virtual bool SetFaceName(const wxString& faceName); |
93ccaed8 VZ |
74 | virtual void SetUnderlined(bool underlined); |
75 | virtual void SetEncoding(wxFontEncoding encoding); | |
9045ad9d | 76 | |
93ccaed8 | 77 | // Implementation |
9045ad9d | 78 | |
93ccaed8 VZ |
79 | // Find an existing, or create a new, XFontStruct |
80 | // based on this wxFont and the given scale. Append the | |
81 | // font to list in the private data for future reference. | |
9045ad9d | 82 | |
93ccaed8 VZ |
83 | // TODO This is a fairly basic implementation, that doesn't |
84 | // allow for different facenames, and also doesn't do a mapping | |
85 | // between 'standard' facenames (e.g. Arial, Helvetica, Times Roman etc.) | |
86 | // and the fonts that are available on a particular system. | |
87 | // Maybe we need to scan the user's machine to build up a profile | |
88 | // of the fonts and a mapping file. | |
9045ad9d | 89 | |
93ccaed8 | 90 | // Return font struct, and optionally the Motif font list |
a2e91a93 | 91 | wxXFont *GetInternalFont(double scale = 1.0, |
83df96d6 | 92 | WXDisplay* display = NULL) const; |
9045ad9d | 93 | |
93ccaed8 | 94 | // These two are helper functions for convenient access of the above. |
eb9d223a | 95 | #if wxMOTIF_USE_RENDER_TABLE |
105fbe1f | 96 | WXFontSet GetFontSet(double scale, WXDisplay* display = NULL) const; |
eb9d223a MB |
97 | WXRenderTable GetRenderTable(WXDisplay* display) const; |
98 | #else // if !wxMOTIF_USE_RENDER_TABLE | |
105fbe1f MB |
99 | WXFontStructPtr GetFontStruct(double scale = 1.0, |
100 | WXDisplay* display = NULL) const; | |
93ccaed8 | 101 | WXFontList GetFontList(double scale = 1.0, |
83df96d6 | 102 | WXDisplay* display = NULL) const; |
105fbe1f | 103 | #endif // !wxMOTIF_USE_RENDER_TABLE |
996994c7 | 104 | // returns either a XmFontList or XmRenderTable, depending |
da494b40 MB |
105 | // on Motif version |
106 | WXFontType GetFontType(WXDisplay* display) const; | |
73608949 MB |
107 | // like the function above but does a copy for XmFontList |
108 | WXFontType GetFontTypeC(WXDisplay* display) const; | |
da494b40 | 109 | static WXString GetFontTag(); |
8f884a0d | 110 | |
9b6dbb09 | 111 | protected: |
8f884a0d VZ |
112 | virtual wxGDIRefData *CreateGDIRefData() const; |
113 | virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; | |
114 | ||
9045ad9d VZ |
115 | virtual void DoSetNativeFontInfo( const wxNativeFontInfo& info ); |
116 | ||
93ccaed8 | 117 | void Unshare(); |
9045ad9d | 118 | |
93ccaed8 VZ |
119 | private: |
120 | DECLARE_DYNAMIC_CLASS(wxFont) | |
9b6dbb09 JS |
121 | }; |
122 | ||
8f884a0d | 123 | #endif // _WX_FONT_H_ |