.. include:: headings.inc .. _Font: ========================================================================================================================================== |phoenix_title| **Font** ========================================================================================================================================== A font is an object which determines the appearance of text. Fonts are used for drawing text to a device context, and setting the appearance of a window's text. This class uses :ref:`reference counting and copy-on-write ` internally so that assignments between two instances of this class are very cheap. You can therefore use actual objects instead of pointers without efficiency problems. If an instance of this class is changed it will create its own data internally so that other instances, which previously shared the data using the reference counting, are not affected. You can retrieve the current system font settings with :ref:`SystemSettings`. .. seealso:: :ref:`Font Overview `, :meth:`DC.SetFont` , :meth:`DC.DrawText` , :meth:`DC.GetTextExtent` , `FontDialog`, :ref:`SystemSettings` | |class_hierarchy| Inheritance Diagram ===================================== Inheritance diagram for class **Font** .. raw:: html

Inheritance diagram of Font

| |method_summary| Methods Summary ================================ ================================================================================ ================================================================================ :meth:`~Font.__init__` Default constructor. :meth:`~Font.Bold` Returns a bold version of this font. :meth:`~Font.GetDefaultEncoding` Returns the current application's default encoding. :meth:`~Font.GetEncoding` Returns the encoding of this font. :meth:`~Font.GetFaceName` Returns the face name associated with the font, or the empty string if there is no face information. :meth:`~Font.GetFamily` Gets the font family if possible. :meth:`~Font.GetNativeFontInfo` Returns the encoding of this font. :meth:`~Font.GetNativeFontInfoDesc` Returns the platform-dependent string completely describing this font. :meth:`~Font.GetNativeFontInfoUserDesc` Returns a user-friendly string for this font object. :meth:`~Font.GetPixelSize` Gets the pixel size. :meth:`~Font.GetPointSize` Gets the point size. :meth:`~Font.GetStrikethrough` Returns ``True`` if the font is stricken-through, ``False`` otherwise. :meth:`~Font.GetStyle` Gets the font style. :meth:`~Font.GetUnderlined` Returns ``True`` if the font is underlined, ``False`` otherwise. :meth:`~Font.GetWeight` Gets the font weight. :meth:`~Font.IsFixedWidth` Returns ``True`` if the font is a fixed width (or monospaced) font, ``False`` if it is a proportional one or font is invalid. :meth:`~Font.IsOk` Returns ``True`` if this object is a valid font, ``False`` otherwise. :meth:`~Font.Italic` Returns an italic version of this font. :meth:`~Font.Larger` Returns a larger version of this font. :meth:`~Font.MakeBold` Changes this font to be bold. :meth:`~Font.MakeItalic` Changes this font to be italic. :meth:`~Font.MakeLarger` Changes this font to be larger. :meth:`~Font.MakeSmaller` Changes this font to be smaller. :meth:`~Font.MakeStrikethrough` Changes this font to be stricken-through. :meth:`~Font.MakeUnderlined` Changes this font to be underlined. :meth:`~Font.New` This function takes the same parameters as the relative :ref:`Font constructor ` and returns a new font object allocated on the heap. :meth:`~Font.Scale` Changes the size of this font. :meth:`~Font.Scaled` Returns a scaled version of this font. :meth:`~Font.SetDefaultEncoding` Sets the default font encoding. :meth:`~Font.SetEncoding` Sets the encoding for this font. :meth:`~Font.SetFaceName` Sets the facename for the font. :meth:`~Font.SetFamily` Sets the font family. :meth:`~Font.SetNativeFontInfo` Creates the font corresponding to the given native font description string which must have been previously returned by :meth:`GetNativeFontInfoDesc` . :meth:`~Font.SetNativeFontInfoUserDesc` Creates the font corresponding to the given native font description string and returns ``True`` if the creation was successful. :meth:`~Font.SetPixelSize` Sets the pixel size. :meth:`~Font.SetPointSize` Sets the point size. :meth:`~Font.SetStrikethrough` Sets strike-through attribute of the font. :meth:`~Font.SetStyle` Sets the font style. :meth:`~Font.SetSymbolicSize` Sets the font size using a predefined symbolic size name. :meth:`~Font.SetSymbolicSizeRelativeTo` Sets the font size compared to the base font size. :meth:`~Font.SetUnderlined` Sets underlining. :meth:`~Font.SetWeight` Sets the font weight. :meth:`~Font.Smaller` Returns a smaller version of this font. :meth:`~Font.Strikethrough` Returns stricken-through version of this font. :meth:`~Font.Underlined` Returns underlined version of this font. :meth:`~Font.__nonzero__` :meth:`~Font._copyFrom` For internal use only. :meth:`~Font.__ne__` Inequality operator. :meth:`~Font.__eq__` Equality operator. ================================================================================ ================================================================================ | |property_summary| Properties Summary ===================================== ================================================================================ ================================================================================ :attr:`~Font.Encoding` See :meth:`~Font.GetEncoding` and :meth:`~Font.SetEncoding` :attr:`~Font.FaceName` See :meth:`~Font.GetFaceName` and :meth:`~Font.SetFaceName` :attr:`~Font.Family` See :meth:`~Font.GetFamily` and :meth:`~Font.SetFamily` :attr:`~Font.NativeFontInfoDesc` See :meth:`~Font.GetNativeFontInfoDesc` and :meth:`~Font.SetNativeFontInfo` :attr:`~Font.NativeFontInfoUserDesc` See :meth:`~Font.GetNativeFontInfoUserDesc` and :meth:`~Font.SetNativeFontInfoUserDesc` :attr:`~Font.PixelSize` See :meth:`~Font.GetPixelSize` and :meth:`~Font.SetPixelSize` :attr:`~Font.PointSize` See :meth:`~Font.GetPointSize` and :meth:`~Font.SetPointSize` :attr:`~Font.Style` See :meth:`~Font.GetStyle` and :meth:`~Font.SetStyle` :attr:`~Font.Weight` See :meth:`~Font.GetWeight` and :meth:`~Font.SetWeight` ================================================================================ ================================================================================ | |api| Class API =============== .. class:: Font(GDIObject) A font is an object which determines the appearance of text. **Possible constructors**:: Font() Font(font) Font(pointSize, family, style, weight, underline=False, faceName='', encoding=FONTENCODING_DEFAULT) Font(pixelSize, family, style, weight, underline=False, faceName='', encoding=FONTENCODING_DEFAULT) Font(pointSize, family, flags=FONTFLAG_DEFAULT, faceName='', encoding=FONTENCODING_DEFAULT) Font(nativeInfoString) Font(nativeInfo) .. method:: __init__(self, *args, **kw) |overload| **Overloaded Implementations**: **~~~** **__init__** `(self)` Default constructor. **~~~** **__init__** `(self, font)` Copy constructor, uses :ref:`reference counting `. :param `font`: :type `font`: Font **~~~** **__init__** `(self, pointSize, family, style, weight, underline=False, faceName='', encoding=FONTENCODING_DEFAULT)` Creates a font object with the specified attributes and size in points. :param `pointSize`: Size in points. See :meth:`SetPointSize` for more info. :type `pointSize`: int :param `family`: The font family: a generic portable way of referring to fonts without specifying a facename. This parameter must be one of the :ref:`FontFamily` enumeration values. If the `faceName` argument is provided, then it overrides the font family. :type `family`: FontFamily :param `style`: One of ``FONTSTYLE_NORMAL`` , ``FONTSTYLE_SLANT`` and ``FONTSTYLE_ITALIC`` . :type `style`: FontStyle :param `weight`: Font weight, sometimes also referred to as font boldness. One of the :ref:`FontWeight` enumeration values. :type `weight`: FontWeight :param `underline`: The value can be ``True`` or ``False``. At present this has an effect on Windows and Motif 2.x only. :type `underline`: bool :param `faceName`: An optional string specifying the face name to be used. If it is an empty string, a default face name will be chosen based on the family. :type `faceName`: string :param `encoding`: An encoding which may be one of the enumeration values of :ref:`FontEncoding` . Briefly these can be summed up as: =================================== ==================================================================================================================================================================================================================================================================================== ``FONTENCODING_SYSTEM`` Default system encoding. ``FONTENCODING_DEFAULT`` Default application encoding: this is the encoding set by calls to :meth:`SetDefaultEncoding` and which may be set to, say, ``KOI8`` to create all fonts by default with ``KOI8`` encoding. Initially, the default application encoding is the same as default system encoding. ``FONTENCODING_ISO8859_1`` ...15 ``ISO8859`` encodings. ``FONTENCODING_KOI8`` The standard Russian encoding for Internet. ``FONTENCODING_CP1250`` ...1252 Windows encodings similar to ``ISO8859`` (but not identical). =================================== ==================================================================================================================================================================================================================================================================================== | If the specified encoding isn't available, no font is created (see also:ref:`Font Encodings `). :type `encoding`: FontEncoding .. note:: If the desired font does not exist, the closest match will be chosen. Under Windows, only scalable TrueType fonts are used. **~~~** **__init__** `(self, pixelSize, family, style, weight, underline=False, faceName='', encoding=FONTENCODING_DEFAULT)` Creates a font object with the specified attributes and size in pixels. :param `pixelSize`: Size in pixels. See :meth:`SetPixelSize` for more info. :type `pixelSize`: Size :param `family`: The font family: a generic portable way of referring to fonts without specifying a facename. This parameter must be one of the :ref:`FontFamily` enumeration values. If the `faceName` argument is provided, then it overrides the font family. :type `family`: FontFamily :param `style`: One of ``FONTSTYLE_NORMAL`` , ``FONTSTYLE_SLANT`` and ``FONTSTYLE_ITALIC`` . :type `style`: FontStyle :param `weight`: Font weight, sometimes also referred to as font boldness. One of the :ref:`FontWeight` enumeration values. :type `weight`: FontWeight :param `underline`: The value can be ``True`` or ``False``. At present this has an effect on Windows and Motif 2.x only. :type `underline`: bool :param `faceName`: An optional string specifying the face name to be used. If it is an empty string, a default face name will be chosen based on the family. :type `faceName`: string :param `encoding`: An encoding which may be one of the enumeration values of :ref:`FontEncoding` . Briefly these can be summed up as: =================================== ==================================================================================================================================================================================================================================================================================== ``FONTENCODING_SYSTEM`` Default system encoding. ``FONTENCODING_DEFAULT`` Default application encoding: this is the encoding set by calls to :meth:`SetDefaultEncoding` and which may be set to, say, ``KOI8`` to create all fonts by default with ``KOI8`` encoding. Initially, the default application encoding is the same as default system encoding. ``FONTENCODING_ISO8859_1`` ...15 ``ISO8859`` encodings. ``FONTENCODING_KOI8`` The standard Russian encoding for Internet. ``FONTENCODING_CP1250`` ...1252 Windows encodings similar to ``ISO8859`` (but not identical). =================================== ==================================================================================================================================================================================================================================================================================== | If the specified encoding isn't available, no font is created (see also:ref:`Font Encodings `). :type `encoding`: FontEncoding .. note:: If the desired font does not exist, the closest match will be chosen. Under Windows, only scalable TrueType fonts are used. **~~~** **__init__** `(self, pointSize, family, flags=FONTFLAG_DEFAULT, faceName='', encoding=FONTENCODING_DEFAULT)` Creates a font object using font flags. This constructor is similar to the constructors above except it specifies the font styles such as underlined, italic, bold, ... in a single `flags` argument instead of using separate arguments for them. This parameter can be a combination of :ref:`FontFlag` enum elements. The meaning of the remaining arguments is the same as in the other constructors, please see their documentation for details. Notice that this constructor provides the only way of creating fonts with strike-through style. :param `pointSize`: :type `pointSize`: int :param `family`: :type `family`: FontFamily :param `flags`: :type `flags`: int :param `faceName`: :type `faceName`: string :param `encoding`: :type `encoding`: FontEncoding .. versionadded:: 2.9.4 **~~~** **__init__** `(self, nativeInfoString)` Constructor from font description string. This constructor uses :meth:`SetNativeFontInfo` to initialize the font. If `fontdesc` is invalid the font remains uninitialized, i.e. its :meth:`IsOk` method will return ``False``. :param `nativeInfoString`: :type `nativeInfoString`: string **~~~** **__init__** `(self, nativeInfo)` Construct font from a native font info structure. :param `nativeInfo`: :type `nativeInfo`: NativeFontInfo **~~~** .. method:: Bold(self) Returns a bold version of this font. :rtype: :ref:`Font` .. versionadded:: 2.9.1 .. seealso:: :meth:`MakeBold` .. staticmethod:: GetDefaultEncoding() Returns the current application's default encoding. :rtype: :ref:`FontEncoding` .. seealso:: :ref:`Font Encodings `, :meth:`SetDefaultEncoding` .. method:: GetEncoding(self) Returns the encoding of this font. Note that under wxGTK the returned value is always ``FONTENCODING_UTF8`` . :rtype: :ref:`FontEncoding` .. seealso:: :meth:`SetEncoding` .. method:: GetFaceName(self) Returns the face name associated with the font, or the empty string if there is no face information. :rtype: `string` .. seealso:: :meth:`SetFaceName` .. method:: GetFamily(self) Gets the font family if possible. As described in :ref:`FontFamily` docs the returned value acts as a rough, basic classification of the main font properties (look, spacing). If the current font face name is not recognized by :ref:`Font` or by the underlying system, ``FONTFAMILY_DEFAULT`` is returned. Note that currently this function is not very precise and so not particularly useful. Font families mostly make sense only for font creation, see :meth:`SetFamily` . :rtype: :ref:`FontFamily` .. seealso:: :meth:`SetFamily` .. method:: GetNativeFontInfo(self) Returns the encoding of this font. Note that under wxGTK the returned value is always ``FONTENCODING_UTF8`` . :rtype: :ref:`NativeFontInfo` .. seealso:: :meth:`SetEncoding` .. method:: GetNativeFontInfoDesc(self) Returns the platform-dependent string completely describing this font. Returned string is always non-empty unless the font is invalid (in which case an assert is triggered). Note that the returned string is not meant to be shown or edited by the user: a typical use of this function is for serializing in string-form a :ref:`Font` object. :rtype: `string` .. seealso:: :meth:`SetNativeFontInfo` , :meth:`GetNativeFontInfoUserDesc` .. method:: GetNativeFontInfoUserDesc(self) Returns a user-friendly string for this font object. Returned string is always non-empty unless the font is invalid (in which case an assert is triggered). The string does not encode all :ref:`Font` infos under all platforms; e.g. under wxMSW the font family is not present in the returned string. Some examples of the formats of returned strings (which are platform-dependent) are in :meth:`SetNativeFontInfoUserDesc` . :rtype: `string` .. seealso:: :meth:`SetNativeFontInfoUserDesc` , :meth:`GetNativeFontInfoDesc` .. method:: GetPixelSize(self) Gets the pixel size. Note that under wxMSW if you passed to :meth:`SetPixelSize` (or to the constructor) a :ref:`Size` object with a null width value, you'll get a null width in the returned object. :rtype: :ref:`Size` .. seealso:: :meth:`SetPixelSize` .. method:: GetPointSize(self) Gets the point size. :rtype: `int` .. seealso:: :meth:`SetPointSize` .. method:: GetStrikethrough(self) Returns ``True`` if the font is stricken-through, ``False`` otherwise. :rtype: `bool` .. versionadded:: 2.9.4 .. seealso:: :meth:`SetStrikethrough` .. method:: GetStyle(self) Gets the font style. See :ref:`FontStyle` for a list of valid styles. :rtype: :ref:`FontStyle` .. seealso:: :meth:`SetStyle` .. method:: GetUnderlined(self) Returns ``True`` if the font is underlined, ``False`` otherwise. :rtype: `bool` .. seealso:: :meth:`SetUnderlined` .. method:: GetWeight(self) Gets the font weight. See :ref:`FontWeight` for a list of valid weight identifiers. :rtype: :ref:`FontWeight` .. seealso:: :meth:`SetWeight` .. method:: IsFixedWidth(self) Returns ``True`` if the font is a fixed width (or monospaced) font, ``False`` if it is a proportional one or font is invalid. Note that this function under some platforms is different than just testing for the font family being equal to ``FONTFAMILY_TELETYPE`` because native platform-specific functions are used for the check (resulting in a more accurate return value). :rtype: `bool` .. method:: IsOk(self) Returns ``True`` if this object is a valid font, ``False`` otherwise. :rtype: `bool` .. method:: Italic(self) Returns an italic version of this font. :rtype: :ref:`Font` .. versionadded:: 2.9.1 .. seealso:: :meth:`MakeItalic` .. method:: Larger(self) Returns a larger version of this font. The font size is multiplied by ``1.2`` , the factor of ``1.2`` being inspired by the ``W3C`` ``CSS`` specification. :rtype: :ref:`Font` .. versionadded:: 2.9.1 .. seealso:: :meth:`MakeLarger` , :meth:`Smaller` , :meth:`Scaled` .. method:: MakeBold(self) Changes this font to be bold. :rtype: :ref:`Font` .. versionadded:: 2.9.1 .. seealso:: :meth:`Bold` .. method:: MakeItalic(self) Changes this font to be italic. :rtype: :ref:`Font` .. versionadded:: 2.9.1 .. seealso:: :meth:`Italic` .. method:: MakeLarger(self) Changes this font to be larger. The font size is multiplied by ``1.2`` , the factor of ``1.2`` being inspired by the ``W3C`` ``CSS`` specification. :rtype: :ref:`Font` .. versionadded:: 2.9.1 .. seealso:: :meth:`Larger` , :meth:`MakeSmaller` , :meth:`Scale` .. method:: MakeSmaller(self) Changes this font to be smaller. The font size is divided by ``1.2`` , the factor of ``1.2`` being inspired by the ``W3C`` ``CSS`` specification. :rtype: :ref:`Font` .. versionadded:: 2.9.1 .. seealso:: :meth:`Smaller` , :meth:`MakeLarger` , :meth:`Scale` .. method:: MakeStrikethrough(self) Changes this font to be stricken-through. Currently stricken-through fonts are only supported in wxMSW and wxGTK. :rtype: :ref:`Font` .. versionadded:: 2.9.4 .. seealso:: :meth:`Strikethrough` .. method:: MakeUnderlined(self) Changes this font to be underlined. :rtype: :ref:`Font` .. versionadded:: 2.9.2 .. seealso:: :meth:`Underlined` .. staticmethod:: New(*args, **kw) This function takes the same parameters as the relative :ref:`Font constructor ` and returns a new font object allocated on the heap. |overload| **Overloaded Implementations**: **~~~** **New** `(pointSize, family, style, weight, underline=False, faceName='', encoding=FONTENCODING_DEFAULT)` :param `pointSize`: :type `pointSize`: int :param `family`: :type `family`: FontFamily :param `style`: :type `style`: FontStyle :param `weight`: :type `weight`: FontWeight :param `underline`: :type `underline`: bool :param `faceName`: :type `faceName`: string :param `encoding`: :type `encoding`: FontEncoding :rtype: :ref:`Font` **~~~** **New** `(pointSize, family, flags=FONTFLAG_DEFAULT, faceName='', encoding=FONTENCODING_DEFAULT)` :param `pointSize`: :type `pointSize`: int :param `family`: :type `family`: FontFamily :param `flags`: :type `flags`: int :param `faceName`: :type `faceName`: string :param `encoding`: :type `encoding`: FontEncoding :rtype: :ref:`Font` **~~~** **New** `(pixelSize, family, style, weight, underline=False, faceName='', encoding=FONTENCODING_DEFAULT)` :param `pixelSize`: :type `pixelSize`: Size :param `family`: :type `family`: FontFamily :param `style`: :type `style`: FontStyle :param `weight`: :type `weight`: FontWeight :param `underline`: :type `underline`: bool :param `faceName`: :type `faceName`: string :param `encoding`: :type `encoding`: FontEncoding :rtype: :ref:`Font` **~~~** **New** `(pixelSize, family, flags=FONTFLAG_DEFAULT, faceName='', encoding=FONTENCODING_DEFAULT)` :param `pixelSize`: :type `pixelSize`: Size :param `family`: :type `family`: FontFamily :param `flags`: :type `flags`: int :param `faceName`: :type `faceName`: string :param `encoding`: :type `encoding`: FontEncoding :rtype: :ref:`Font` **~~~** **New** `(nativeInfo)` :param `nativeInfo`: :type `nativeInfo`: NativeFontInfo :rtype: :ref:`Font` **~~~** **New** `(nativeInfoString)` :param `nativeInfoString`: :type `nativeInfoString`: string :rtype: :ref:`Font` **~~~** .. method:: Scale(self, x) Changes the size of this font. The font size is multiplied by the given factor (which may be less than 1 to create a smaller version of the font). :param `x`: :type `x`: float :rtype: :ref:`Font` .. versionadded:: 2.9.1 .. seealso:: :meth:`Scaled` , :meth:`MakeLarger` , :meth:`MakeSmaller` .. method:: Scaled(self, x) Returns a scaled version of this font. The font size is multiplied by the given factor (which may be less than 1 to create a smaller version of the font). :param `x`: :type `x`: float :rtype: :ref:`Font` .. versionadded:: 2.9.1 .. seealso:: :meth:`Scale` , :meth:`Larger` , :meth:`Smaller` .. staticmethod:: SetDefaultEncoding(encoding) Sets the default font encoding. :param `encoding`: :type `encoding`: FontEncoding .. seealso:: :ref:`Font Encodings `, :meth:`GetDefaultEncoding` .. method:: SetEncoding(self, encoding) Sets the encoding for this font. Note that under wxGTK this function has no effect (because the underlying Pango library always uses ``FONTENCODING_UTF8`` ). :param `encoding`: :type `encoding`: FontEncoding .. seealso:: :meth:`GetEncoding` .. method:: SetFaceName(self, faceName) Sets the facename for the font. :param `faceName`: A valid facename, which should be on the end-user's system. :type `faceName`: string :rtype: `bool` :returns: ``True`` if the given face name exists; if the face name doesn't exist in the user's system then the font is invalidated (so that :meth:`IsOk` will return ``False``) and ``False`` is returned. .. note:: To avoid portability problems, don't rely on a specific face, but specify the font family instead (see :ref:`FontFamily` and :meth:`SetFamily` ). .. seealso:: :meth:`GetFaceName` , :meth:`SetFamily` .. method:: SetFamily(self, family) Sets the font family. As described in :ref:`FontFamily` docs the given `family` value acts as a rough, basic indication of the main font properties (look, spacing). Note that changing the font family results in changing the font face name. :param `family`: One of the :ref:`FontFamily` values. :type `family`: FontFamily .. seealso:: :meth:`GetFamily` , :meth:`SetFaceName` .. method:: SetNativeFontInfo(self, *args, **kw) |overload| **Overloaded Implementations**: **~~~** **SetNativeFontInfo** `(self, info)` Creates the font corresponding to the given native font description string which must have been previously returned by :meth:`GetNativeFontInfoDesc` . If the string is invalid, font is unchanged. This function is typically used for de-serializing a :ref:`Font` object previously saved in a string-form. :param `info`: :type `info`: string :rtype: `bool` :returns: ``True`` if the creation was successful. .. seealso:: :meth:`SetNativeFontInfoUserDesc` **~~~** **SetNativeFontInfo** `(self, info)` Sets the encoding for this font. Note that under wxGTK this function has no effect (because the underlying Pango library always uses ``FONTENCODING_UTF8`` ). :param `info`: :type `info`: NativeFontInfo .. seealso:: :meth:`GetEncoding` **~~~** .. method:: SetNativeFontInfoUserDesc(self, info) Creates the font corresponding to the given native font description string and returns ``True`` if the creation was successful. Unlike :meth:`SetNativeFontInfo` , this function accepts strings which are user-friendly. Examples of accepted string formats are: =========== ===================================================================== ============================= platform generic syntax example =========== ===================================================================== ============================= wxGTK2 ``[FACE-NAME] [bold] [oblique|italic] [POINTSIZE]`` Monospace bold 10 wxMSW ``[light|bold] [italic] [FACE-NAME] [POINTSIZE] [ENCODING]`` Tahoma 10 ``WINDOWS-1252`` =========== ===================================================================== ============================= | For more detailed information about the allowed syntaxes you can look at the documentation of the native API used for font-rendering (e.g. ``pango_font_description_from_string`` on GTK). Note that unlike :meth:`SetNativeFontInfo` , this function doesn't always restore all attributes of the :ref:`Font` object under all platforms; e.g. on wxMSW the font family is not restored (because GetNativeFontInfoUserDesc doesn't return it on wxMSW). If you want to serialize/deserialize a font in string form, you should use :meth:`GetNativeFontInfoDesc` and :meth:`SetNativeFontInfo` instead. :param `info`: :type `info`: string :rtype: `bool` .. seealso:: :meth:`SetNativeFontInfo` .. todo:: add an example for Mac .. method:: SetPixelSize(self, pixelSize) Sets the pixel size. The height parameter of `pixelSize` must be positive while the width parameter may also be zero (to indicate that you're not interested in the width of the characters: a suitable width will be chosen for best rendering). This feature (specifying the font pixel size) is directly supported only under wxMSW and wxGTK currently; under other platforms a font with the closest size to the given one is found using binary search (this maybe slower). :param `pixelSize`: :type `pixelSize`: Size .. seealso:: :meth:`GetPixelSize` .. method:: SetPointSize(self, pointSize) Sets the point size. The `point size` is defined as 1/72 of the anglo-Saxon inch (25.4 mm): it is approximately 0.0139 inch or 352.8 um. :param `pointSize`: Size in points. :type `pointSize`: int .. seealso:: :meth:`GetPointSize` .. method:: SetStrikethrough(self, strikethrough) Sets strike-through attribute of the font. Currently stricken-through fonts are only supported in wxMSW and wxGTK. :param `strikethrough`: ``True`` to add strike-through style, ``False`` to remove it. :type `strikethrough`: bool .. versionadded:: 2.9.4 .. seealso:: :meth:`GetStrikethrough` .. method:: SetStyle(self, style) Sets the font style. :param `style`: One of the :ref:`FontStyle` enumeration values. :type `style`: FontStyle .. seealso:: :meth:`GetStyle` .. method:: SetSymbolicSize(self, size) Sets the font size using a predefined symbolic size name. This function allows to change font size to be (very) large or small compared to the standard font size. :param `size`: :type `size`: FontSymbolicSize .. versionadded:: 2.9.2 .. seealso:: :meth:`SetSymbolicSizeRelativeTo` . .. method:: SetSymbolicSizeRelativeTo(self, size, base) Sets the font size compared to the base font size. This is the same as :meth:`SetSymbolicSize` except that it uses the given font size as the normal font size instead of the standard font size. :param `size`: :type `size`: FontSymbolicSize :param `base`: :type `base`: int .. versionadded:: 2.9.2 .. method:: SetUnderlined(self, underlined) Sets underlining. :param `underlined`: ``True`` to underline, ``False`` otherwise. :type `underlined`: bool .. seealso:: :meth:`GetUnderlined` .. method:: SetWeight(self, weight) Sets the font weight. :param `weight`: One of the :ref:`FontWeight` values. :type `weight`: FontWeight .. seealso:: :meth:`GetWeight` .. method:: Smaller(self) Returns a smaller version of this font. The font size is divided by ``1.2`` , the factor of ``1.2`` being inspired by the ``W3C`` ``CSS`` specification. :rtype: :ref:`Font` .. versionadded:: 2.9.1 .. seealso:: :meth:`MakeSmaller` , :meth:`Larger` , :meth:`Scaled` .. method:: Strikethrough(self) Returns stricken-through version of this font. Currently stricken-through fonts are only supported in wxMSW and wxGTK. :rtype: :ref:`Font` .. versionadded:: 2.9.4 .. seealso:: :meth:`MakeStrikethrough` .. method:: Underlined(self) Returns underlined version of this font. :rtype: :ref:`Font` .. versionadded:: 2.9.2 .. seealso:: :meth:`MakeUnderlined` .. method:: __nonzero__(self) :rtype: `int` .. method:: _copyFrom(self, other) For internal use only. .. method:: __ne__(self) Inequality operator. See :ref:`reference-counted object comparison ` for more info. :param `font`: :type `font`: Font .. method:: __eq__(self) Equality operator. See :ref:`reference-counted object comparison ` for more info. :param `font`: :type `font`: Font .. attribute:: Encoding See :meth:`~Font.GetEncoding` and :meth:`~Font.SetEncoding` .. attribute:: FaceName See :meth:`~Font.GetFaceName` and :meth:`~Font.SetFaceName` .. attribute:: Family See :meth:`~Font.GetFamily` and :meth:`~Font.SetFamily` .. attribute:: NativeFontInfoDesc See :meth:`~Font.GetNativeFontInfoDesc` and :meth:`~Font.SetNativeFontInfo` .. attribute:: NativeFontInfoUserDesc See :meth:`~Font.GetNativeFontInfoUserDesc` and :meth:`~Font.SetNativeFontInfoUserDesc` .. attribute:: PixelSize See :meth:`~Font.GetPixelSize` and :meth:`~Font.SetPixelSize` .. attribute:: PointSize See :meth:`~Font.GetPointSize` and :meth:`~Font.SetPointSize` .. attribute:: Style See :meth:`~Font.GetStyle` and :meth:`~Font.SetStyle` .. attribute:: Weight See :meth:`~Font.GetWeight` and :meth:`~Font.SetWeight`