.. wxPython Phoenix documentation

   This file was generated by Phoenix's sphinx generator and associated
   tools, do not edit by hand.

   Copyright: (c) 2011-2017 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

   <div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
   <img id="toggleBlock-trigger" src="_static/images/closed.png"/>
   Inheritance diagram for class <strong>GraphicsFont</strong>:
   </div>
   <div id="toggleBlock-summary" style="display:block;"></div>
   <div id="toggleBlock-content" style="display:none;">
   <p class="graphviz">
   <center><img src="_static/images/inheritance/wx.lib.graphics.GraphicsFont_inheritance.png" alt="Inheritance diagram of GraphicsFont" usemap="#dummy" class="inheritance"/></center>
   </div>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.lib.graphics.GraphicsFont.html" title="A ``GraphicsFont`` is an adapter to allow using wx.Font with a" alt="" coords="11,83,214,112"/> <area shape="rect" id="node2" href="wx.lib.graphics.GraphicsObject.html" title="Base class for the other ``Graphics*`` classes." alt="" coords="5,5,220,35"/> </map> 
   </p>

|


|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`                                     
================================================================================ ================================================================================


|


|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)


   .. 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


