.. wxPython Phoenix documentation
This file was generated by Phoenix's sphinx generator and associated
tools, do not edit by hand.
Copyright: (c) 2011-2020 by Total Control Software
License: wxWindows License
.. include:: headings.inc
.. currentmodule:: wx.lib.graphics
.. highlight:: python
.. _wx.lib.graphics.GraphicsFont:
==========================================================================================================================================
|phoenix_title| **wx.lib.graphics.GraphicsFont**
==========================================================================================================================================
A ``GraphicsFont`` is an adapter to allow using :class:`wx.Font` with a
:class:`GraphicsContext` when drawing text.
|
|class_hierarchy| Class Hierarchy
=================================
.. raw:: html

Inheritance diagram for class
GraphicsFont:
|
|super_classes| Known Superclasses
==================================
:class:`wx.lib.graphics.GraphicsObject`
|
|method_summary| Methods Summary
================================
================================================================================ ================================================================================
:meth:`~wx.lib.graphics.GraphicsFont.__init__` Constructs a new ``GraphicsFont``.
:meth:`~wx.lib.graphics.GraphicsFont.Apply` Apply this font's properties to the given context.
:meth:`~wx.lib.graphics.GraphicsFont.CreateFromFont` Create a ``GraphicsFont from a :class:`wx.Font`.
:meth:`~wx.lib.graphics.GraphicsFont.IsNull` Returns whether the object is valid.
================================================================================ ================================================================================
|
|property_summary| Properties Summary
=====================================
================================================================================ ================================================================================
:attr:`~wx.lib.graphics.GraphicsFont.Brush` A ``GraphicsBrush`` to use for filling the text when using this
:attr:`~wx.lib.graphics.GraphicsFont.Colour` The color to be associated with this font. It will be used as the
:attr:`~wx.lib.graphics.GraphicsFont.PointSize` The size in points of the font.
================================================================================ ================================================================================
|
|api| Class API
===============
.. class:: GraphicsFont(GraphicsObject)
A ``GraphicsFont`` is an adapter to allow using :class:`wx.Font` with a
:class:`GraphicsContext` when drawing text.
.. method:: __init__(self)
Constructs a new ``GraphicsFont``.
.. note:: Currently user code should be using
:meth:`CreateFromFont` instead of creating new ``GraphicsFont``
instances themselves.
.. method:: Apply(self, ctx, colour)
Apply this font's properties to the given context.
Called by :class:`GraphicsContext` as needed.
.. staticmethod:: CreateFromFont(font, colour=None)
Create a ``GraphicsFont from a :class:`wx.Font`.
Currently this is the only way to construct a ``GraphicsFont``.
:param wx.Font `font`: A ``wx.Font`` to use as a source of properties
to be used when creating the Cairo font.
:param wx.Colour `colour`: An optional colour to associate with the font.
.. method:: IsNull(self)
Returns whether the object is valid.
.. attribute:: Brush
A ``GraphicsBrush`` to use for filling the text when using this
font. An alternative to using a plain colour.
:type: :class:`GraphicsBrush`
.. attribute:: Colour
The color to be associated with this font. It will be used as the
fill when drawing text with this font.
:type: :class:`wx.Colour`
.. attribute:: PointSize
The size in points of the font.
:type: int or float