1wxFont(3) Erlang Module Definition wxFont(3)
2
3
4
6 wxFont - Functions for wxFont class
7
9 A font is an object which determines the appearance of text.
10
11 Fonts are used for drawing text to a device context, and setting the
12 appearance of a window's text, see wxDC:setFont/2 and wxWindow:set‐
13 Font/2.
14
15 The easiest way to create a custom font is to use wxFontInfo (not im‐
16 plemented in wx) object to specify the font attributes and then use
17 new/5 constructor. Alternatively, you could start with one of the pre-
18 defined fonts or use wxWindow:getFont/1 and modify the font, e.g. by
19 increasing its size using MakeLarger() (not implemented in wx) or
20 changing its weight using MakeBold() (not implemented in wx).
21
22 This class uses reference counting and copy-on-write internally so that
23 assignments between two instances of this class are very cheap. You can
24 therefore use actual objects instead of pointers without efficiency
25 problems. If an instance of this class is changed it will create its
26 own data internally so that other instances, which previously shared
27 the data using the reference counting, are not affected.
28
29 You can retrieve the current system font settings with wxSystemSet‐
30 tings.
31
32 Predefined objects (include wx.hrl): ?wxNullFont, ?wxNORMAL_FONT, ?wxS‐
33 MALL_FONT, ?wxITALIC_FONT, ?wxSWISS_FONT
34
35 See: Overview font, wxDC:setFont/2, wxDC:drawText/3, wxDC:getTextEx‐
36 tent/3, wxFontDialog, wxSystemSettings
37
38 wxWidgets docs: wxFont
39
41 wxFont() = wx:wx_object()
42
44 new() -> wxFont()
45
46 Default ctor.
47
48 new(NativeInfoString) -> wxFont()
49
50 new(Font) -> wxFont()
51
52 Types:
53
54 Font = wxFont()
55
56 Copy constructor, uses reference counting.
57
58 new(PointSize, Family, Style, Weight) -> wxFont()
59
60 new(PixelSize, Family, Style, Weight) -> wxFont()
61
62 Types:
63
64 PixelSize = {W :: integer(), H :: integer()}
65 Family = Style = Weight = wx:wx_enum()
66
67 new(PointSize, Family, Style, Weight, Options :: [Option]) ->
68 wxFont()
69
70 new(PixelSize, Family, Style, Weight, Options :: [Option]) ->
71 wxFont()
72
73 Types:
74
75 PixelSize = {W :: integer(), H :: integer()}
76 Family = Style = Weight = wx:wx_enum()
77 Option =
78 {underline, boolean()} |
79 {faceName, unicode:chardata()} |
80 {encoding, wx:wx_enum()}
81
82 Creates a font object with the specified attributes and size in
83 pixels.
84
85 Notice that the use of this constructor is often more verbose
86 and less readable than the use of constructor from wxFontInfo
87 (not implemented in wx), consider using that constructor in‐
88 stead.
89
90 Remark: If the desired font does not exist, the closest match
91 will be chosen. Under Windows, only scalable TrueType fonts are
92 used.
93
94 destroy(This :: wxFont()) -> ok
95
96 Destructor.
97
98 See reference-counted object destruction for more info.
99
100 Remark: Although all remaining fonts are deleted when the appli‐
101 cation exits, the application should try to clean up all fonts
102 itself. This is because wxWidgets cannot know if a pointer to
103 the font object is stored in an application data structure, and
104 there is a risk of double deletion.
105
106 isFixedWidth(This) -> boolean()
107
108 Types:
109
110 This = wxFont()
111
112 Returns true if the font is a fixed width (or monospaced) font,
113 false if it is a proportional one or font is invalid.
114
115 Note that this function under some platforms is different from
116 just testing for the font family being equal to wxFONTFAM‐
117 ILY_TELETYPE because native platform-specific functions are used
118 for the check (resulting in a more accurate return value).
119
120 getDefaultEncoding() -> wx:wx_enum()
121
122 Returns the current application's default encoding.
123
124 See: Overview fontencoding, setDefaultEncoding/1
125
126 getFaceName(This) -> unicode:charlist()
127
128 Types:
129
130 This = wxFont()
131
132 Returns the face name associated with the font, or the empty
133 string if there is no face information.
134
135 See: setFaceName/2
136
137 getFamily(This) -> wx:wx_enum()
138
139 Types:
140
141 This = wxFont()
142
143 Gets the font family if possible.
144
145 As described in ?wxFontFamily docs the returned value acts as a
146 rough, basic classification of the main font properties (look,
147 spacing).
148
149 If the current font face name is not recognized by wxFont or by
150 the underlying system, wxFONTFAMILY_DEFAULT is returned.
151
152 Note that currently this function is not very precise and so not
153 particularly useful. Font families mostly make sense only for
154 font creation, see setFamily/2.
155
156 See: setFamily/2
157
158 getNativeFontInfoDesc(This) -> unicode:charlist()
159
160 Types:
161
162 This = wxFont()
163
164 Returns the platform-dependent string completely describing this
165 font.
166
167 Returned string is always non-empty unless the font is invalid
168 (in which case an assert is triggered).
169
170 Note that the returned string is not meant to be shown or edited
171 by the user: a typical use of this function is for serializing
172 in string-form a wxFont object.
173
174 See: SetNativeFontInfo() (not implemented in wx), getNative‐
175 FontInfoUserDesc/1
176
177 getNativeFontInfoUserDesc(This) -> unicode:charlist()
178
179 Types:
180
181 This = wxFont()
182
183 Returns a user-friendly string for this font object.
184
185 Returned string is always non-empty unless the font is invalid
186 (in which case an assert is triggered).
187
188 The string does not encode all wxFont infos under all platforms;
189 e.g. under wxMSW the font family is not present in the returned
190 string.
191
192 Some examples of the formats of returned strings (which are
193 platform-dependent) are in SetNativeFontInfoUserDesc() (not im‐
194 plemented in wx).
195
196 See: SetNativeFontInfoUserDesc() (not implemented in wx), getNa‐
197 tiveFontInfoDesc/1
198
199 getPointSize(This) -> integer()
200
201 Types:
202
203 This = wxFont()
204
205 Gets the point size as an integer number.
206
207 This function is kept for compatibility reasons. New code should
208 use GetFractionalPointSize() (not implemented in wx) and support
209 fractional point sizes.
210
211 See: setPointSize/2
212
213 See: GetFractionalPointSize() (not implemented in wx)
214
215 getStyle(This) -> wx:wx_enum()
216
217 Types:
218
219 This = wxFont()
220
221 Gets the font style.
222
223 See ?wxFontStyle for a list of valid styles.
224
225 See: setStyle/2
226
227 getUnderlined(This) -> boolean()
228
229 Types:
230
231 This = wxFont()
232
233 Returns true if the font is underlined, false otherwise.
234
235 See: setUnderlined/2
236
237 getWeight(This) -> wx:wx_enum()
238
239 Types:
240
241 This = wxFont()
242
243 Gets the font weight.
244
245 See ?wxFontWeight for a list of valid weight identifiers.
246
247 See: setWeight/2
248
249 ok(This) -> boolean()
250
251 Types:
252
253 This = wxFont()
254
255 See: isOk/1.
256
257 isOk(This) -> boolean()
258
259 Types:
260
261 This = wxFont()
262
263 Returns true if this object is a valid font, false otherwise.
264
265 setDefaultEncoding(Encoding) -> ok
266
267 Types:
268
269 Encoding = wx:wx_enum()
270
271 Sets the default font encoding.
272
273 See: Overview fontencoding, getDefaultEncoding/0
274
275 setFaceName(This, FaceName) -> boolean()
276
277 Types:
278
279 This = wxFont()
280 FaceName = unicode:chardata()
281
282 Sets the facename for the font.
283
284 Remark: To avoid portability problems, don't rely on a specific
285 face, but specify the font family instead (see ?wxFontFamily and
286 setFamily/2).
287
288 Return: true if the given face name exists; if the face name
289 doesn't exist in the user's system then the font is invalidated
290 (so that isOk/1 will return false) and false is returned.
291
292 See: getFaceName/1, setFamily/2
293
294 setFamily(This, Family) -> ok
295
296 Types:
297
298 This = wxFont()
299 Family = wx:wx_enum()
300
301 Sets the font family.
302
303 As described in ?wxFontFamily docs the given family value acts
304 as a rough, basic indication of the main font properties (look,
305 spacing).
306
307 Note that changing the font family results in changing the font
308 face name.
309
310 See: getFamily/1, setFaceName/2
311
312 setPointSize(This, PointSize) -> ok
313
314 Types:
315
316 This = wxFont()
317 PointSize = integer()
318
319 Sets the font size in points to an integer value.
320
321 This is a legacy version of the function only supporting integer
322 point sizes. It can still be used, but to avoid unnecessarily
323 restricting the font size in points to integer values, consider
324 using the new (added in wxWidgets 3.1.2) SetFractionalPoint‐
325 Size() (not implemented in wx) function instead.
326
327 setStyle(This, Style) -> ok
328
329 Types:
330
331 This = wxFont()
332 Style = wx:wx_enum()
333
334 Sets the font style.
335
336 See: getStyle/1
337
338 setUnderlined(This, Underlined) -> ok
339
340 Types:
341
342 This = wxFont()
343 Underlined = boolean()
344
345 Sets underlining.
346
347 See: getUnderlined/1
348
349 setWeight(This, Weight) -> ok
350
351 Types:
352
353 This = wxFont()
354 Weight = wx:wx_enum()
355
356 Sets the font weight.
357
358 See: getWeight/1
359
360
361
362wxWidgets team. wx 2.3.1 wxFont(3)