Python bindings

As noted in the the section called “GNOME integration, GLib, and GObject” section, HarfBuzz uses a feature called GObject Introspection (GI) to provide bindings for Python.

At compile time, the GI scanner analyzes the HarfBuzz C source and builds metadata objects connecting the language bindings to the C library. Your Python code can then use the HarfBuzz binary through its Python interface.

HarfBuzz's Python bindings support Python 2 and Python 3. To use them, you will need to have the pygobject package installed. Then you should import HarfBuzz from gi.repository:

      from gi.repository import HarfBuzz
    

and you can call HarfBuzz functions from Python. Sample code can be found in the sample.py script in the HarfBuzz src directory.

Do note, however, that the Python API is subject to change without advance notice. GI allows the bindings to be automatically updated, which is one of its advantages, but you may need to update your Python code.