Module Functions
----------------
.. function:: get_compiled_version () -> (int, int, int)

  Gets the SDL_ttf version pygame2 was compiled against as
  three-value tuple.

  This version is built at compile time. It can be used to detect
  which features may not be available through Pygame, if it is used
  as precompiled package using a different version of the SDL_ttf
  library.



.. function:: get_error () -> :exc:`pygame2.Error`

  Gets the last :exc:`pygame2.Error` occured.

  SDL_ttf maintains an internal error message. This message will usually
  be given to you when a :exc:`pygame2.Error` is raised. You will
  rarely need to call this function.



.. function:: get_version () -> (int, int, int)

  Gets the SDL version pygame2 currently uses as three-value tuple.

  This version is detected at runtime. It can be used to detect
  which features may not be available through Pygame, if it is used
  as precompiled package using a different version of the SDL library.



.. function:: init () -> None

  Initializes the SDL_ttf library.



.. function:: quit () -> None

  Shuts down the SDL_ttf library.

  After calling this function, you should not invoke any class,
  method or function related to the sdlttf module as they are likely to
  fail or might give unpredictable results.



.. function:: set_byte_swapped_unicode (swapped) -> None

  Sets, whether unicode text should be handled with a swapped BOM.



.. function:: was_init () -> bool

  Returns, whether the the SDL_ttf library is initialized.



Font
----
.. class:: Font (file, size[, index]) -> Font

  Creates a new Font from a TTF font file.

  Creates a new Font from a TTF font *file* using the specified *size* in
  points. If the font features different faces, they can be chosen using
  the optional *index*.

  .. note::

          The *file* object *must* support binary read and write
          access. This is especially important for Python 3.x users.


Attributes
^^^^^^^^^^
.. attribute:: Font.ascent

  Gets the ascent of the Font.

.. attribute:: Font.descent

  Gets the descent of the Font.

.. attribute:: Font.faces

  Gets the amount of available font faces.

.. attribute:: Font.family_name

  Gets the font face family name.

.. attribute:: Font.height

  Gets the height of the Font.

.. attribute:: Font.is_fixed_width

  Gets whether the chosen font face is a fixed width one.

.. attribute:: Font.line_skip

  Gets the line skip of the Font.

.. attribute:: Font.style

  Gets or sets the style of the font. The style can be a valid
  value of the style constants in the :mod:`pygame2.sdlttf.constants`
  module.

.. attribute:: Font.style_name

  Gets the currently set font style name.

Methods
^^^^^^^
.. method:: Font.get_glyph_metrics (text) -> [(int,int,int,int,int), ...]

  Gets the glyph metrics of a string.

  Gets the glyph metrics for each individual character of a string.
  The metrics returned for each character consist of the xMin, yMin,
  xMax, yMax and advance values.

  http://freetype.sourceforge.net/freetype2/docs/tutorial/step2.html
  contains a detailed description of those values.

  If no suitable character for getting the glyph extents could be found
  in the font, a None value will be used instead of a 5-value tuple.


.. method:: Font.get_size (text) -> int, int

  Gets the size of a text for this Font.


.. method:: Font.render (text, fgcolor[, bgcolor, renderflag]) -> :class:`pygame2.sdl.video.Surface`

  Renders a text to a :class:`pygame2.sdl.video.Surface`.

  Renders the specified *text* to a :class:`pygame2.sdl.video.Surface`.
  The text will have the chosen foreground color for the glyphs. The
  optional *bgcolor* argument denotes the background color to use for the
  returned :class:`pygame2.sdl.video.Surface`, if - and only if -
  the *renderflag* is RENDER_SHADED (the default). Otherwise the
  :class:`pygame2.sdl.video.Surface` will be transparent except for the
  rendered glyphs.

  The *renderflag argument* can be set to one of the rendering constants
  of the :mod:`pygame2.sdlttf.constants` module.



