]>
Commit | Line | Data |
---|---|---|
c801d85f KB |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: font.h | |
3 | // Purpose: | |
4 | // Author: Robert Roebling | |
58614078 | 5 | // Id: $Id$ |
c801d85f | 6 | // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem |
8bbe427f | 7 | // Licence: wxWindows licence |
c801d85f KB |
8 | ///////////////////////////////////////////////////////////////////////////// |
9 | ||
10 | ||
11 | #ifndef __GTKFONTH__ | |
12 | #define __GTKFONTH__ | |
13 | ||
14 | #ifdef __GNUG__ | |
15 | #pragma interface | |
16 | #endif | |
17 | ||
18 | #include "wx/defs.h" | |
19 | #include "wx/object.h" | |
20 | #include "wx/string.h" | |
21 | #include "wx/hash.h" | |
22 | #include "wx/gdiobj.h" | |
23 | ||
24 | //----------------------------------------------------------------------------- | |
25 | // classes | |
26 | //----------------------------------------------------------------------------- | |
27 | ||
28 | class wxDC; | |
29 | class wxPaintDC; | |
30 | class wxWindow; | |
31 | ||
32 | class wxFont; | |
33 | class wxFontNameDirectory; | |
34 | ||
35 | //----------------------------------------------------------------------------- | |
36 | // global variables | |
37 | //----------------------------------------------------------------------------- | |
38 | ||
358fc25c RR |
39 | extern wxFontNameDirectory *wxTheFontNameDirectory; |
40 | extern const char* wxEmptyString; | |
c801d85f KB |
41 | |
42 | //----------------------------------------------------------------------------- | |
43 | // wxFont | |
44 | //----------------------------------------------------------------------------- | |
45 | ||
8bbe427f | 46 | class wxFont: public wxGDIObject |
c801d85f KB |
47 | { |
48 | DECLARE_DYNAMIC_CLASS(wxFont) | |
8bbe427f | 49 | |
358fc25c RR |
50 | public: |
51 | wxFont(); | |
52 | wxFont( int pointSize, int family, int style, int weight, bool underlined = FALSE, | |
53 | const wxString& face = wxEmptyString ); | |
54 | wxFont( const wxFont& font ); | |
55 | ~wxFont(); | |
56 | wxFont& operator = ( const wxFont& font ); | |
57 | bool operator == ( const wxFont& font ); | |
58 | bool operator != ( const wxFont& font ); | |
59 | bool Ok() const; | |
60 | ||
61 | int GetPointSize() const; | |
62 | int GetFamily() const; | |
63 | int GetFontId() const; | |
64 | int GetStyle() const; | |
65 | int GetWeight() const; | |
66 | bool GetUnderlined() const; | |
67 | ||
68 | void SetPointSize( int pointSize ); | |
69 | void SetFamily( int family ); | |
70 | void SetStyle( int style ); | |
71 | void SetWeight( int weight ); | |
72 | void SetFaceName( const wxString& faceName ); | |
73 | void SetUnderlined( bool underlined ); | |
74 | ||
75 | wxString GetFaceName() const; | |
76 | wxString GetFamilyString() const; | |
77 | wxString GetStyleString() const; | |
78 | wxString GetWeightString() const; | |
79 | ||
8bbe427f | 80 | // implementation |
358fc25c RR |
81 | |
82 | wxFont( char *xFontName ); | |
83 | void Unshare(); | |
8bbe427f | 84 | |
358fc25c | 85 | GdkFont* GetInternalFont(float scale = 1.0) const; |
c801d85f | 86 | |
358fc25c | 87 | // no data :-) |
c801d85f KB |
88 | }; |
89 | ||
90 | //----------------------------------------------------------------------------- | |
91 | // wxFontDirectory | |
92 | //----------------------------------------------------------------------------- | |
93 | ||
8bbe427f | 94 | class wxFontNameDirectory: public wxObject |
c801d85f KB |
95 | { |
96 | DECLARE_DYNAMIC_CLASS(wxFontNameDirectory) | |
8bbe427f | 97 | |
c801d85f | 98 | public: |
8bbe427f | 99 | wxFontNameDirectory(); |
c801d85f KB |
100 | ~wxFontNameDirectory(); |
101 | ||
8bbe427f | 102 | void Initialize(); |
c801d85f KB |
103 | void Initialize(int fontid, int family, const char *name); |
104 | ||
105 | int FindOrCreateFontId(const char *name, int family); | |
106 | char* GetAFMName(int fontid, int weight, int style); | |
107 | int GetFamily(int fontid); | |
108 | int GetFontId(const char *name); | |
109 | char* GetFontName(int fontid); | |
8bbe427f | 110 | int GetNewFontId(); |
c801d85f KB |
111 | char* GetPostScriptName(int fontid, int weight, int style); |
112 | char* GetScreenName(int fontid, int weight, int style); | |
8bbe427f | 113 | |
c801d85f KB |
114 | class wxHashTable *table; |
115 | int nextFontId; | |
116 | }; | |
117 | ||
c801d85f | 118 | #endif // __GTKFONTH__ |