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