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>Buffers, language, script and direction: 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="pt01.html" title="Part I. User's manual">
9 <link rel="prev" href="aat-shaping.html" title="AAT shaping">
10 <link rel="next" href="adding-text-to-the-buffer.html" title="Adding text to the buffer">
11 <meta name="generator" content="GTK-Doc V1.29 (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="pt01.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
19 <td><a accesskey="p" href="aat-shaping.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
20 <td><a accesskey="n" href="adding-text-to-the-buffer.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
23 <div class="titlepage"><div><div><h2 class="title">
24 <a name="buffers-language-script-and-direction"></a>Buffers, language, script and direction</h2></div></div></div>
25 <div class="toc"><dl class="toc">
26 <dt><span class="section"><a href="buffers-language-script-and-direction.html#creating-and-destroying-buffers">Creating and destroying buffers</a></span></dt>
27 <dt><span class="section"><a href="adding-text-to-the-buffer.html">Adding text to the buffer</a></span></dt>
28 <dt><span class="section"><a href="setting-buffer-properties.html">Setting buffer properties</a></span></dt>
29 <dt><span class="section"><a href="what-about-the-other-scripts.html">What about the other scripts?</a></span></dt>
30 <dt><span class="section"><a href="customizing-unicode-functions.html">Customizing Unicode functions</a></span></dt>
33 The input to HarfBuzz is a series of Unicode characters, stored in a
34 buffer. In this chapter, we'll look at how to set up a buffer with
35 the text that we want and then customize the properties of the
39 <div class="titlepage"><div><div><h2 class="title" style="clear: both">
40 <a name="creating-and-destroying-buffers"></a>Creating and destroying buffers</h2></div></div></div>
42 As we saw in our <span class="emphasis"><em>Getting Started</em></span> example, a
44 initialized with <code class="literal">hb_buffer_create()</code>. This
45 produces a new, empty buffer object, instantiated with some
46 default values and ready to accept your Unicode strings.
49 HarfBuzz manages the memory of objects (such as buffers) that it
50 creates, so you don't have to. When you have finished working on
51 a buffer, you can call <code class="literal">hb_buffer_destroy()</code>:
53 <pre class="programlisting">
54 hb_buffer_t *buffer = hb_buffer_create();
56 hb_buffer_destroy(buffer);
59 This will destroy the object and free its associated memory -
60 unless some other part of the program holds a reference to this
61 buffer. If you acquire a HarfBuzz buffer from another subsystem
62 and want to ensure that it is not garbage collected by someone
63 else destroying it, you should increase its reference count:
65 <pre class="programlisting">
66 void somefunc(hb_buffer_t *buffer) {
67 buffer = hb_buffer_reference(buffer);
71 And then decrease it once you're done with it:
73 <pre class="programlisting">
74 hb_buffer_destroy(buffer);
78 To throw away all the data in your buffer and start from scratch,
79 call <code class="literal">hb_buffer_reset(buffer)</code>. If you want to
80 throw away the string in the buffer but keep the options, you can
81 instead call <code class="literal">hb_buffer_clear_contents(buffer)</code>.
86 <hr>Generated by GTK-Doc V1.29</div>