Mini Shell
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Python bindings: HarfBuzz Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="index.html" title="HarfBuzz Manual">
<link rel="up" href="integration.html" title="Platform Integration Guide">
<link rel="prev" href="integration-icu.html" title="ICU integration">
<link rel="next" href="pt02.html" title="Part II. Reference manual">
<meta name="generator" content="GTK-Doc V1.32 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts"></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="integration.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="integration-icu.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="pt02.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="integration-python"></a>Python bindings</h2></div></div></div>
<p>
As noted in the <a class="xref" href="integration.html#integration-glib" title="GNOME integration, GLib, and GObject">the section called “GNOME integration, GLib, and GObject”</a> section,
HarfBuzz uses a feature called <a class="ulink" href="https://wiki.gnome.org/Projects/GObjectIntrospection" target="_top">GObject
Introspection</a> (GI) to provide bindings for Python.
</p>
<p>
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.
</p>
<p>
HarfBuzz's Python bindings support Python 2 and Python 3. To use
them, you will need to have the <code class="literal">pygobject</code>
package installed. Then you should import
<code class="literal">HarfBuzz</code> from
<code class="literal">gi.repository</code>:
</p>
<pre class="programlisting">
from gi.repository import HarfBuzz
</pre>
<p>
and you can call HarfBuzz functions from Python. Sample code can
be found in the <code class="filename">sample.py</code> script in the
HarfBuzz <code class="filename">src</code> directory.
</p>
<p>
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.
</p>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.32</div>
</body>
</html>
Zerion Mini Shell 1.0