This class is a helper used for wx.Font creation using named parameter idiom: it allows specifying various wx.Font attributes using the chained calls to its clearly named methods instead of passing them in the fixed order to wx.Font constructors.
For example, to create an italic font with the given face name and size you could use:
font = wx.Font(wx.FontInfo(12).FaceName("Helvetica").Italic())
Notice that all of the methods of this object return a reference to the object itself, allowing the calls to them to be chained as in the example above.
All methods taking boolean parameters can be used to turn the specified font attribute on or off and turn it on by default.
New in version 2.9.5.
Default constructor uses the default font size for the current platform. |
|
Set all the font attributes at once. |
|
Set anti-aliasing flag. |
|
Use a bold version of the font. |
|
Set the font encoding to use. |
|
Set the font face name to use. |
|
Set the font family. |
|
Get the symbolic weight closest to the given raw weight value. |
|
Use an italic version of the font. |
|
Use a lighter version of the font. |
|
Use a slanted version of the font. |
|
Use a strike-through version of the font. |
|
Specify the style of the font using one of FontStyle constants. |
|
Use an underlined version of the font. |
|
Specify the weight of the font. |
wx.
FontInfo
(object)¶Possible constructors:
FontInfo()
FontInfo(pointSize)
FontInfo(pixelSize)
This class is a helper used for Font creation using named parameter idiom: it allows specifying various Font attributes using the chained calls to its clearly named methods instead of passing them in the fixed order to Font constructors.
__init__
(self, *args, **kw)¶__init__ (self)
Default constructor uses the default font size for the current platform.
__init__ (self, pointSize)
Constructor setting the font size in points to use.
Note that until wxWidgets 3.1.2 fractional point sizes were not supported, and the type of pointSize was int
.
pointSize (float) –
See also
__init__ (self, pixelSize)
Constructor setting the font size in pixels to use.
pixelSize (wx.Size) –
AllFlags
(self, flags)¶Set all the font attributes at once.
See wx.FontFlag for the various flags that can be used.
Note that calling this method affects the font weight stored in this object: it is set to FONTWEIGHT_LIGHT
or FONTWEIGHT_BOLD
if the corresponding flag is present in flags, or FONTWEIGHT_NORMAL
otherwise.
flags (int) –
AntiAliased
(self, antiAliased=True)¶Set anti-aliasing flag.
Force the use of anti-aliasing on or off.
Currently this is not implemented, i.e. using this method doesn’t do anything.
antiAliased (bool) –
Bold
(self, bold=True)¶Use a bold version of the font.
This is a wrapper for Weight
calling it with FONTWEIGHT_BOLD
argument.
bold (bool) –
See also
Encoding
(self, encoding)¶Set the font encoding to use.
This is mostly unneeded in Unicode builds of wxWidgets.
encoding (FontEncoding) –
See also
FaceName
(self, faceName)¶Set the font face name to use.
Face names are not portable, so prefer to use Family
in portable code.
faceName (string) –
See also
Family
(self, family)¶Set the font family.
The family is a generic portable way of referring to fonts without specifying a precise face name. This parameter must be one of the wx.FontFamily enumeration values.
If the FaceName
is used, then it overrides the font family.
family (FontFamily) –
See also
GetWeightClosestToNumericValue
(numWeight)¶Get the symbolic weight closest to the given raw weight value.
numWeight (int) – A valid raw weight value, i.e. a value in the range 1 to 1000, inclusive.
A valid element of FontWeight enum.
New in version 4.1/wxWidgets-3.1.2.
Italic
(self, italic=True)¶Use an italic version of the font.
This is a wrapper for Style
calling it with FONTSTYLE_ITALIC
argument.
italic (bool) –
See also
Light
(self, light=True)¶Use a lighter version of the font.
This is a wrapper for Weight
calling it with FONTWEIGHT_LIGHT
argument.
light (bool) –
See also
Slant
(self, slant=True)¶Use a slanted version of the font.
This is a wrapper for Style
calling it with FONTSTYLE_SLANT
argument.
slant (bool) –
See also
Strikethrough
(self, strikethrough=True)¶Use a strike-through version of the font.
Currently this is only implemented in wxMSW, wxGTK, and wxOSX.
strikethrough (bool) –
Style
(self, style)¶Specify the style of the font using one of FontStyle constants.
style (FontStyle) –
New in version 4.1/wxWidgets-3.1.2.
Underlined
(self, underlined=True)¶Use an underlined version of the font.
underlined (bool) –
Weight
(self, weight)¶Specify the weight of the font.
weight (int) – A font weight in the range from 1 to 1000, inclusive, with 1 being the thinnest and 1000 the heaviest possible font variant. FONTWEIGHT_XXX
values from FontWeight enum can be used here.
New in version 4.1/wxWidgets-3.1.2.