]> git.saurik.com Git - wxWidgets.git/blame - include/wx/x11/font.h
wxMac linking fix
[wxWidgets.git] / include / wx / x11 / font.h
CommitLineData
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
15class wxXFont;
16
17// Font
968eb2ef 18class WXDLLIMPEXP_CORE wxFont : public wxFontBase
83df96d6
JS
19{
20public:
21 // ctors and such
22 wxFont() { Init(); }
23 wxFont(const wxFont& font) { Init(); Ref(font); }
9045ad9d 24
83df96d6
JS
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();
9045ad9d 34
83df96d6
JS
35 (void)Create(size, family, style, weight, underlined, face, encoding);
36 }
9045ad9d 37
83df96d6 38 wxFont(const wxNativeFontInfo& info);
9045ad9d 39
83df96d6
JS
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);
2b5f62a0
VZ
47
48 // FIXME: I added the ! to make it compile;
49 // is this right? - JACS
9045ad9d 50#if !wxUSE_UNICODE
83df96d6
JS
51 bool Create(const wxString& fontname,
52 wxFontEncoding fontenc = wxFONTENCODING_DEFAULT);
2b5f62a0
VZ
53#endif
54 // DELETEME: no longer seems to be implemented.
55 // bool Create(const wxNativeFontInfo& fontinfo);
9045ad9d 56
83df96d6 57 virtual ~wxFont();
9045ad9d 58
83df96d6
JS
59 // assignment
60 wxFont& operator=(const wxFont& font);
9045ad9d 61
83df96d6
JS
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;
3bf5a59b 70 virtual const wxNativeFontInfo *GetNativeFontInfo() const;
9045ad9d 71
2b5f62a0 72 virtual bool IsFixedWidth() const;
9045ad9d 73
83df96d6
JS
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);
9045ad9d 81
2b5f62a0 82 virtual void SetNoAntiAliasing( bool no = TRUE );
5ac2e80c 83 virtual bool GetNoAntiAliasing() const ;
9045ad9d 84
2b5f62a0
VZ
85 // Implementation
86
87#if wxUSE_PANGO
88#else
83df96d6
JS
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.
9045ad9d 92
83df96d6
JS
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.
9045ad9d 99
83df96d6
JS
100 // Return font struct, and optionally the Motif font list
101 wxXFont *GetInternalFont(double scale = 1.0,
102 WXDisplay* display = NULL) const;
9045ad9d 103
bc797f4c 104 // Helper function for convenient access of the above.
83df96d6
JS
105 WXFontStructPtr GetFontStruct(double scale = 1.0,
106 WXDisplay* display = NULL) const;
2b5f62a0 107#endif
9045ad9d 108
83df96d6 109protected:
9045ad9d
VZ
110 virtual void DoSetNativeFontInfo( const wxNativeFontInfo& info );
111
83df96d6
JS
112 // common part of all ctors
113 void Init();
9045ad9d 114
83df96d6 115 void Unshare();
9045ad9d 116
83df96d6
JS
117private:
118 DECLARE_DYNAMIC_CLASS(wxFont)
119};
120
121#endif
122// _WX_FONT_H_