.. include:: ../substitutions

.. oe:namespace:: OEDepict

.. meta::
   :keywords: OEDrawTextToCenter

.. _OEDepict_OEDrawTextToCenter:


.. oe:function:: OEDrawTextToCenter


   .. oe:language:: c++ java csharp

      .. oe:api::

         void OEDrawTextToCenter(OEImageBase& image, const std::string& text,
                                 const OEFont& font)

   .. oe:language:: python

      .. oe:api:: python

         OEDrawTextToCenter(image: OEImageBase, text: str, font: OEFont) -> None

   Draws the given text to the center of the image.

   See code snippet below and the corresponding image in
   :ref:`Figure: Example of using the OEDrawTextToCenter function <figure_OEDrawTextToCenter>`.

   .. oe:source:: OEDrawTextToCenter.py
      :language: python
      :noindent:
      :frag:     SNIPPET-OEDrawTextToCenter

   .. oe:source:: OEDrawTextToCenter.cpp
      :language: c++
      :noindent:
      :frag:     SNIPPET-OEDrawTextToCenter

   .. oe:source:: OEDrawTextToCenter.java
      :language: java
      :noindent:
      :frag:     SNIPPET-OEDrawTextToCenter

   .. oe:language:: csharp

   .. oe:source:: OEDrawTextToCenter.cs
      :language: csharp
      :noindent:
      :frag:     SNIPPET-OEDrawTextToCenter

   .. _figure_OEDrawTextToCenter:

   .. figure:: ../images/OEDrawTextToCenter.*
      :align:  center

      **Example of using the OEDrawTextToCenter function**

   .. seealso::

      * :ref:`OEImageBase <OEDepict_OEImageBase>` class
      * :ref:`OEFont <OEDepict_OEFont>` class
      * :oe:func:`OEDepict::OEDrawBorder` function
      * :oe:func:`OEDepict::OEDrawText` function


