Imported Upstream version 3.4.0
[platform/upstream/harfbuzz.git] / docs / html / object-model-blobs.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <title>Blobs: HarfBuzz Manual</title>
6 <meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7 <link rel="home" href="index.html" title="HarfBuzz Manual">
8 <link rel="up" href="object-model.html" title="The HarfBuzz object model">
9 <link rel="prev" href="object-model-user-data.html" title="User data">
10 <link rel="next" href="buffers-language-script-and-direction.html" title="Buffers, language, script and direction">
11 <meta name="generator" content="GTK-Doc V1.32 (XML mode)">
12 <link rel="stylesheet" href="style.css" type="text/css">
13 </head>
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="object-model.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
19 <td><a accesskey="p" href="object-model-user-data.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
20 <td><a accesskey="n" href="buffers-language-script-and-direction.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
21 </tr></table>
22 <div class="section">
23 <div class="titlepage"><div><div><h2 class="title" style="clear: both">
24 <a name="object-model-blobs"></a>Blobs</h2></div></div></div>
25 <p>
26       While most of HarfBuzz's object types are specific to the
27       shaping process, <span class="emphasis"><em>blobs</em></span> are somewhat
28       different.
29     </p>
30 <p>
31       Blobs are an abstraction designed to negotiate lifecycle and
32       permissions for raw pieces of data.  For example, when you load
33       the raw font data into memory and want to pass it to HarfBuzz,
34       you do so in a <code class="literal">hb_blob_t</code> wrapper.
35     </p>
36 <p>
37       This allows you to take advantage of HarfBuzz's
38       reference-counting and <code class="function">destroy</code>
39       callbacks. If you allocated the memory for the data using
40       <code class="function">malloc()</code>, you would create the blob using
41     </p>
42 <pre class="programlisting">
43       hb_blob_create (data, length, HB_MEMORY_MODE_WRITABLE, data, free)
44     </pre>
45 <p>
46       That way, HarfBuzz will call <code class="function">free()</code> on the
47       allocated memory whenever the blob drops its last reference and
48       is deconstructed.  Consequently, the user code can stop worrying
49       about freeing memory and let the reference-counting machinery
50       take care of that.
51     </p>
52 <p>
53       Most of the time, blobs are read-only, facilitating their use in
54       immutable objects.
55     </p>
56 </div>
57 <div class="footer">
58 <hr>Generated by GTK-Doc V1.32</div>
59 </body>
60 </html>