]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/motif/font.h
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 wxNativeFontInfo
& info
);
33 #if FUTURE_WXWIN_COMPATIBILITY_3_0
38 bool underlined
= false,
39 const wxString
& face
= wxEmptyString
,
40 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
42 (void)Create(size
, (wxFontFamily
)family
, (wxFontStyle
)style
, (wxFontWeight
)weight
, underlined
, face
, encoding
);
50 bool underlined
= false,
51 const wxString
& face
= wxEmptyString
,
52 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
54 Create(size
, family
, style
, weight
, underlined
, face
, encoding
);
57 wxFont(const wxSize
& pixelSize
,
61 bool underlined
= false,
62 const wxString
& face
= wxEmptyString
,
63 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
65 Create(10, family
, style
, weight
, underlined
, face
, encoding
);
66 SetPixelSize(pixelSize
);
71 int flags
= wxFONTFLAG_DEFAULT
,
72 const wxString
& face
= wxEmptyString
,
73 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
)
75 Create(pointSize
, family
,
76 GetStyleFromFlags(flags
),
77 GetWeightFromFlags(flags
),
78 GetUnderlinedFromFlags(flags
),
86 bool underlined
= false,
87 const wxString
& face
= wxEmptyString
,
88 wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
);
91 bool Create(const wxString
& fontname
,
92 wxFontEncoding fontenc
= wxFONTENCODING_DEFAULT
);
93 bool Create(const wxNativeFontInfo
& fontinfo
);
97 // implement base class pure virtuals
98 virtual int GetPointSize() const;
99 virtual wxFontStyle
GetStyle() const;
100 virtual wxFontWeight
GetWeight() const;
101 virtual bool GetUnderlined() const;
102 virtual wxString
GetFaceName() const;
103 virtual wxFontEncoding
GetEncoding() const;
104 virtual const wxNativeFontInfo
*GetNativeFontInfo() const;
106 virtual void SetPointSize(int pointSize
);
107 virtual void SetFamily(wxFontFamily family
);
108 virtual void SetStyle(wxFontStyle style
);
109 virtual void SetWeight(wxFontWeight weight
);
110 virtual bool SetFaceName(const wxString
& faceName
);
111 virtual void SetUnderlined(bool underlined
);
112 virtual void SetEncoding(wxFontEncoding encoding
);
114 wxDECLARE_COMMON_FONT_METHODS();
118 // Find an existing, or create a new, XFontStruct
119 // based on this wxFont and the given scale. Append the
120 // font to list in the private data for future reference.
122 // TODO This is a fairly basic implementation, that doesn't
123 // allow for different facenames, and also doesn't do a mapping
124 // between 'standard' facenames (e.g. Arial, Helvetica, Times Roman etc.)
125 // and the fonts that are available on a particular system.
126 // Maybe we need to scan the user's machine to build up a profile
127 // of the fonts and a mapping file.
129 // Return font struct, and optionally the Motif font list
130 wxXFont
*GetInternalFont(double scale
= 1.0,
131 WXDisplay
* display
= NULL
) const;
133 // These two are helper functions for convenient access of the above.
134 #if wxMOTIF_USE_RENDER_TABLE
135 WXFontSet
GetFontSet(double scale
, WXDisplay
* display
= NULL
) const;
136 WXRenderTable
GetRenderTable(WXDisplay
* display
) const;
137 #else // if !wxMOTIF_USE_RENDER_TABLE
138 WXFontStructPtr
GetFontStruct(double scale
= 1.0,
139 WXDisplay
* display
= NULL
) const;
140 WXFontList
GetFontList(double scale
= 1.0,
141 WXDisplay
* display
= NULL
) const;
142 #endif // !wxMOTIF_USE_RENDER_TABLE
143 // returns either a XmFontList or XmRenderTable, depending
145 WXFontType
GetFontType(WXDisplay
* display
) const;
146 // like the function above but does a copy for XmFontList
147 WXFontType
GetFontTypeC(WXDisplay
* display
) const;
148 static WXString
GetFontTag();
151 virtual wxGDIRefData
*CreateGDIRefData() const;
152 virtual wxGDIRefData
*CloneGDIRefData(const wxGDIRefData
*data
) const;
154 virtual void DoSetNativeFontInfo( const wxNativeFontInfo
& info
);
155 virtual wxFontFamily
DoGetFamily() const;
160 DECLARE_DYNAMIC_CLASS(wxFont
)
163 #endif // _WX_FONT_H_