]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/motif/font.h
ef259f9a5528caaa7d443d6503086aa8c4daa0ce
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/motif/font.h
3 // Purpose: wxFont class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
15 #if __WXMOTIF20__ && !__WXLESSTIF__
16 #define wxMOTIF_USE_RENDER_TABLE 1
18 #define wxMOTIF_USE_RENDER_TABLE 0
20 #define wxMOTIF_NEW_FONT_HANDLING wxMOTIF_USE_RENDER_TABLE
25 class WXDLLIMPEXP_CORE wxFont
: public wxFontBase
31 wxFont(const wxFontInfo
& info
)
33 Create(info
.GetPointSize(),
41 if ( info
.IsUsingSizeInPixels() )
42 SetPixelSize(info
.GetPixelSize());
45 wxFont(const wxNativeFontInfo
& info
);
47 #if FUTURE_WXWIN_COMPATIBILITY_3_0
52 bool underlined
= false,
53 const wxString
& face
= wxEmptyString
,
54 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
56 (void)Create(size
, (wxFontFamily
)family
, (wxFontStyle
)style
, (wxFontWeight
)weight
, underlined
, face
, encoding
);
64 bool underlined
= false,
65 const wxString
& face
= wxEmptyString
,
66 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
68 Create(size
, family
, style
, weight
, underlined
, face
, encoding
);
71 wxFont(const wxSize
& pixelSize
,
75 bool underlined
= false,
76 const wxString
& face
= wxEmptyString
,
77 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
79 Create(10, family
, style
, weight
, underlined
, face
, encoding
);
80 SetPixelSize(pixelSize
);
87 bool underlined
= false,
88 const wxString
& face
= wxEmptyString
,
89 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
);
92 bool Create(const wxString
& fontname
,
93 wxFontEncoding fontenc
= wxFONTENCODING_DEFAULT
);
94 bool Create(const wxNativeFontInfo
& fontinfo
);
98 // implement base class pure virtuals
99 virtual int GetPointSize() const;
100 virtual wxFontStyle
GetStyle() const;
101 virtual wxFontWeight
GetWeight() const;
102 virtual bool GetUnderlined() const;
103 virtual wxString
GetFaceName() const;
104 virtual wxFontEncoding
GetEncoding() const;
105 virtual const wxNativeFontInfo
*GetNativeFontInfo() const;
107 virtual void SetPointSize(int pointSize
);
108 virtual void SetFamily(wxFontFamily family
);
109 virtual void SetStyle(wxFontStyle style
);
110 virtual void SetWeight(wxFontWeight weight
);
111 virtual bool SetFaceName(const wxString
& faceName
);
112 virtual void SetUnderlined(bool underlined
);
113 virtual void SetEncoding(wxFontEncoding encoding
);
115 wxDECLARE_COMMON_FONT_METHODS();
119 // Find an existing, or create a new, XFontStruct
120 // based on this wxFont and the given scale. Append the
121 // font to list in the private data for future reference.
123 // TODO This is a fairly basic implementation, that doesn't
124 // allow for different facenames, and also doesn't do a mapping
125 // between 'standard' facenames (e.g. Arial, Helvetica, Times Roman etc.)
126 // and the fonts that are available on a particular system.
127 // Maybe we need to scan the user's machine to build up a profile
128 // of the fonts and a mapping file.
130 // Return font struct, and optionally the Motif font list
131 wxXFont
*GetInternalFont(double scale
= 1.0,
132 WXDisplay
* display
= NULL
) const;
134 // These two are helper functions for convenient access of the above.
135 #if wxMOTIF_USE_RENDER_TABLE
136 WXFontSet
GetFontSet(double scale
, WXDisplay
* display
= NULL
) const;
137 WXRenderTable
GetRenderTable(WXDisplay
* display
) const;
138 #else // if !wxMOTIF_USE_RENDER_TABLE
139 WXFontStructPtr
GetFontStruct(double scale
= 1.0,
140 WXDisplay
* display
= NULL
) const;
141 WXFontList
GetFontList(double scale
= 1.0,
142 WXDisplay
* display
= NULL
) const;
143 #endif // !wxMOTIF_USE_RENDER_TABLE
144 // returns either a XmFontList or XmRenderTable, depending
146 WXFontType
GetFontType(WXDisplay
* display
) const;
147 // like the function above but does a copy for XmFontList
148 WXFontType
GetFontTypeC(WXDisplay
* display
) const;
149 static WXString
GetFontTag();
152 virtual wxGDIRefData
*CreateGDIRefData() const;
153 virtual wxGDIRefData
*CloneGDIRefData(const wxGDIRefData
*data
) const;
155 virtual void DoSetNativeFontInfo( const wxNativeFontInfo
& info
);
156 virtual wxFontFamily
DoGetFamily() const;
161 DECLARE_DYNAMIC_CLASS(wxFont
)
164 #endif // _WX_FONT_H_