1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <title>Python bindings: HarfBuzz Manual</title>
6 <meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
7 <link rel="home" href="index.html" title="HarfBuzz Manual">
8 <link rel="up" href="integration.html" title="Platform Integration Guide">
9 <link rel="prev" href="integration-icu.html" title="ICU integration">
10 <link rel="next" href="pt02.html" title="Part II. Reference manual">
11 <meta name="generator" content="GTK-Doc V1.32.1 (XML mode)">
12 <link rel="stylesheet" href="style.css" type="text/css">
14 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
15 <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
16 <td width="100%" align="left" class="shortcuts"></td>
17 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
18 <td><a accesskey="u" href="integration.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
19 <td><a accesskey="p" href="integration-icu.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
20 <td><a accesskey="n" href="pt02.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
23 <div class="titlepage"><div><div><h2 class="title" style="clear: both">
24 <a name="integration-python"></a>Python bindings</h2></div></div></div>
26 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,
27 HarfBuzz uses a feature called <a class="ulink" href="https://wiki.gnome.org/Projects/GObjectIntrospection" target="_top">GObject
28 Introspection</a> (GI) to provide bindings for Python.
31 At compile time, the GI scanner analyzes the HarfBuzz C source
32 and builds metadata objects connecting the language bindings to
33 the C library. Your Python code can then use the HarfBuzz binary
34 through its Python interface.
37 HarfBuzz's Python bindings support Python 2 and Python 3. To use
38 them, you will need to have the <code class="literal">pygobject</code>
39 package installed. Then you should import
40 <code class="literal">HarfBuzz</code> from
41 <code class="literal">gi.repository</code>:
43 <pre class="programlisting">
44 from gi.repository import HarfBuzz
47 and you can call HarfBuzz functions from Python. Sample code can
48 be found in the <code class="filename">sample.py</code> script in the
49 HarfBuzz <code class="filename">src</code> directory.
52 Do note, however, that the Python API is subject to change
53 without advance notice. GI allows the bindings to be
54 automatically updated, which is one of its advantages, but you
55 may need to update your Python code.
59 <hr>Generated by GTK-Doc V1.32.1</div>