Imported Upstream version 1.3.0
[platform/upstream/harfbuzz.git] / docs / html / harfbuzz-Shaping.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>HarfBuzz Manual: Shaping</title>
6 <meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
7 <link rel="home" href="index.html" title="HarfBuzz Manual">
8 <link rel="up" href="ch07.html" title="Harfbuzz API">
9 <link rel="prev" href="harfbuzz-hb-font.html" title="hb-font">
10 <link rel="next" href="harfbuzz-hb-version.html" title="hb-version">
11 <meta name="generator" content="GTK-Doc V1.20 (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="10"><tr valign="middle">
16 <td width="100%" align="left" class="shortcuts">
17 <a href="#" class="shortcut">Top</a><span id="nav_description"> <span class="dim">|</span> 
18                   <a href="#harfbuzz-Shaping.description" class="shortcut">Description</a></span><span id="nav_hierarchy"> <span class="dim">|</span> 
19                   <a href="#harfbuzz-Shaping.object-hierarchy" class="shortcut">Object Hierarchy</a></span>
20 </td>
21 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
22 <td><a accesskey="u" href="ch07.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
23 <td><a accesskey="p" href="harfbuzz-hb-font.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
24 <td><a accesskey="n" href="harfbuzz-hb-version.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
25 </tr></table>
26 <div class="refentry">
27 <a name="harfbuzz-Shaping"></a><div class="titlepage"></div>
28 <div class="refnamediv"><table width="100%"><tr>
29 <td valign="top">
30 <h2><span class="refentrytitle"><a name="harfbuzz-Shaping.top_of_page"></a>Shaping</span></h2>
31 <p>Shaping — Conversion of text strings into positioned glyphs</p>
32 </td>
33 <td class="gallery_image" valign="top" align="right"></td>
34 </tr></table></div>
35 <div class="refsect1">
36 <a name="harfbuzz-Shaping.functions"></a><h2>Functions</h2>
37 <div class="informaltable"><table width="100%" border="0">
38 <colgroup>
39 <col width="150px" class="functions_return">
40 <col class="functions_name">
41 </colgroup>
42 <tbody>
43 <tr>
44 <td class="function_type">
45 <a class="link" href="harfbuzz-hb-common.html#hb-bool-t" title="hb_bool_t"><span class="returnvalue">hb_bool_t</span></a>
46 </td>
47 <td class="function_name">
48 <a class="link" href="harfbuzz-Shaping.html#hb-feature-from-string" title="hb_feature_from_string ()">hb_feature_from_string</a> <span class="c_punctuation">()</span>
49 </td>
50 </tr>
51 <tr>
52 <td class="function_type">
53 <span class="returnvalue">void</span>
54 </td>
55 <td class="function_name">
56 <a class="link" href="harfbuzz-Shaping.html#hb-feature-to-string" title="hb_feature_to_string ()">hb_feature_to_string</a> <span class="c_punctuation">()</span>
57 </td>
58 </tr>
59 <tr>
60 <td class="function_type">
61 <span class="returnvalue">void</span>
62 </td>
63 <td class="function_name">
64 <a class="link" href="harfbuzz-Shaping.html#hb-shape" title="hb_shape ()">hb_shape</a> <span class="c_punctuation">()</span>
65 </td>
66 </tr>
67 <tr>
68 <td class="function_type">
69 <a class="link" href="harfbuzz-hb-common.html#hb-bool-t" title="hb_bool_t"><span class="returnvalue">hb_bool_t</span></a>
70 </td>
71 <td class="function_name">
72 <a class="link" href="harfbuzz-Shaping.html#hb-shape-full" title="hb_shape_full ()">hb_shape_full</a> <span class="c_punctuation">()</span>
73 </td>
74 </tr>
75 <tr>
76 <td class="function_type">const <span class="returnvalue">char</span> **
77 </td>
78 <td class="function_name">
79 <a class="link" href="harfbuzz-Shaping.html#hb-shape-list-shapers" title="hb_shape_list_shapers ()">hb_shape_list_shapers</a> <span class="c_punctuation">()</span>
80 </td>
81 </tr>
82 </tbody>
83 </table></div>
84 </div>
85 <a name="hb-feature-t"></a><div class="refsect1">
86 <a name="harfbuzz-Shaping.other"></a><h2>Types and Values</h2>
87 <div class="informaltable"><table width="100%" border="0">
88 <colgroup>
89 <col width="150px" class="name">
90 <col class="description">
91 </colgroup>
92 <tbody><tr>
93 <td class="datatype_keyword"> </td>
94 <td class="function_name"><a class="link" href="harfbuzz-Shaping.html#hb-feature-t-struct" title="hb_feature_t">hb_feature_t</a></td>
95 </tr></tbody>
96 </table></div>
97 </div>
98 <div class="refsect1">
99 <a name="harfbuzz-Shaping.object-hierarchy"></a><h2>Object Hierarchy</h2>
100 <pre class="screen">    GBoxed
101     <span class="lineart">╰──</span> hb_feature_t
102 </pre>
103 </div>
104 <div class="refsect1">
105 <a name="harfbuzz-Shaping.includes"></a><h2>Includes</h2>
106 <pre class="synopsis">#include &lt;hb.h&gt;
107 </pre>
108 </div>
109 <div class="refsect1">
110 <a name="harfbuzz-Shaping.description"></a><h2>Description</h2>
111 <p>Shaping is the central operation of HarfBuzz. Shaping operates on buffers,
112 which are sequences of Unicode characters that use the same font and have
113 the same text direction, script and language. After shaping the buffer
114 contains the output glyphs and their positions.</p>
115 </div>
116 <div class="refsect1">
117 <a name="harfbuzz-Shaping.functions_details"></a><h2>Functions</h2>
118 <div class="refsect2">
119 <a name="hb-feature-from-string"></a><h3>hb_feature_from_string ()</h3>
120 <pre class="programlisting"><a class="link" href="harfbuzz-hb-common.html#hb-bool-t" title="hb_bool_t"><span class="returnvalue">hb_bool_t</span></a>
121 hb_feature_from_string (<em class="parameter"><code>const <span class="type">char</span> *str</code></em>,
122                         <em class="parameter"><code><span class="type">int</span> len</code></em>,
123                         <em class="parameter"><code><a class="link" href="harfbuzz-Shaping.html#hb-feature-t"><span class="type">hb_feature_t</span></a> *feature</code></em>);</pre>
124 <p>Parses a string into a <a class="link" href="harfbuzz-Shaping.html#hb-feature-t"><span class="type">hb_feature_t</span></a>.</p>
125 <p>TODO: document the syntax here.</p>
126 <div class="refsect3">
127 <a name="id-1.3.3.9.9.2.6"></a><h4>Parameters</h4>
128 <div class="informaltable"><table width="100%" border="0">
129 <colgroup>
130 <col width="150px" class="parameters_name">
131 <col class="parameters_description">
132 <col width="200px" class="parameters_annotations">
133 </colgroup>
134 <tbody>
135 <tr>
136 <td class="parameter_name"><p>str</p></td>
137 <td class="parameter_description"><p> a string to parse. </p></td>
138 <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=len][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> uint8_t]</span></td>
139 </tr>
140 <tr>
141 <td class="parameter_name"><p>len</p></td>
142 <td class="parameter_description"><p>length of <em class="parameter"><code>str</code></em>
143 , or -1 if string is <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> terminated</p></td>
144 <td class="parameter_annotations"> </td>
145 </tr>
146 <tr>
147 <td class="parameter_name"><p>feature</p></td>
148 <td class="parameter_description"><p> the <a class="link" href="harfbuzz-Shaping.html#hb-feature-t"><span class="type">hb_feature_t</span></a> to initialize with the parsed values. </p></td>
149 <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>]</span></td>
150 </tr>
151 </tbody>
152 </table></div>
153 </div>
154 <div class="refsect3">
155 <a name="id-1.3.3.9.9.2.7"></a><h4>Returns</h4>
156 <p><code class="literal">true</code> if <em class="parameter"><code>str</code></em>
157 is successfully parsed, <code class="literal">false</code> otherwise.</p>
158 <p></p>
159 </div>
160 <p class="since">Since 0.9.5</p>
161 </div>
162 <hr>
163 <div class="refsect2">
164 <a name="hb-feature-to-string"></a><h3>hb_feature_to_string ()</h3>
165 <pre class="programlisting"><span class="returnvalue">void</span>
166 hb_feature_to_string (<em class="parameter"><code><a class="link" href="harfbuzz-Shaping.html#hb-feature-t"><span class="type">hb_feature_t</span></a> *feature</code></em>,
167                       <em class="parameter"><code><span class="type">char</span> *buf</code></em>,
168                       <em class="parameter"><code>unsigned <span class="type">int</span> size</code></em>);</pre>
169 <p>Converts a <a class="link" href="harfbuzz-Shaping.html#hb-feature-t"><span class="type">hb_feature_t</span></a> into a <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>-terminated string in the format
170 understood by <a class="link" href="harfbuzz-Shaping.html#hb-feature-from-string" title="hb_feature_from_string ()"><code class="function">hb_feature_from_string()</code></a>. The client in responsible for
171 allocating big enough size for <em class="parameter"><code>buf</code></em>
172 , 128 bytes is more than enough.</p>
173 <div class="refsect3">
174 <a name="id-1.3.3.9.9.3.5"></a><h4>Parameters</h4>
175 <div class="informaltable"><table width="100%" border="0">
176 <colgroup>
177 <col width="150px" class="parameters_name">
178 <col class="parameters_description">
179 <col width="200px" class="parameters_annotations">
180 </colgroup>
181 <tbody>
182 <tr>
183 <td class="parameter_name"><p>feature</p></td>
184 <td class="parameter_description"><p>an <a class="link" href="harfbuzz-Shaping.html#hb-feature-t"><span class="type">hb_feature_t</span></a> to convert</p></td>
185 <td class="parameter_annotations"> </td>
186 </tr>
187 <tr>
188 <td class="parameter_name"><p>buf</p></td>
189 <td class="parameter_description"><p> output string. </p></td>
190 <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=size][<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>]</span></td>
191 </tr>
192 <tr>
193 <td class="parameter_name"><p>size</p></td>
194 <td class="parameter_description"><p>the allocated size of <em class="parameter"><code>buf</code></em>
195 </p></td>
196 <td class="parameter_annotations"> </td>
197 </tr>
198 </tbody>
199 </table></div>
200 </div>
201 <p class="since">Since 0.9.5</p>
202 </div>
203 <hr>
204 <div class="refsect2">
205 <a name="hb-shape"></a><h3>hb_shape ()</h3>
206 <pre class="programlisting"><span class="returnvalue">void</span>
207 hb_shape (<em class="parameter"><code><a class="link" href="harfbuzz-hb-font.html#hb-font-t"><span class="type">hb_font_t</span></a> *font</code></em>,
208           <em class="parameter"><code><a class="link" href="harfbuzz-Buffers.html#hb-buffer-t"><span class="type">hb_buffer_t</span></a> *buffer</code></em>,
209           <em class="parameter"><code>const <a class="link" href="harfbuzz-Shaping.html#hb-feature-t"><span class="type">hb_feature_t</span></a> *features</code></em>,
210           <em class="parameter"><code>unsigned <span class="type">int</span> num_features</code></em>);</pre>
211 <p>Shapes <em class="parameter"><code>buffer</code></em>
212  using <em class="parameter"><code>font</code></em>
213  turning its Unicode characters content to
214 positioned glyphs. If <em class="parameter"><code>features</code></em>
215  is not <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, it will be used to control the
216 features applied during shaping.</p>
217 <div class="refsect3">
218 <a name="id-1.3.3.9.9.4.5"></a><h4>Parameters</h4>
219 <div class="informaltable"><table width="100%" border="0">
220 <colgroup>
221 <col width="150px" class="parameters_name">
222 <col class="parameters_description">
223 <col width="200px" class="parameters_annotations">
224 </colgroup>
225 <tbody>
226 <tr>
227 <td class="parameter_name"><p>font</p></td>
228 <td class="parameter_description"><p>an <a class="link" href="harfbuzz-hb-font.html#hb-font-t"><span class="type">hb_font_t</span></a> to use for shaping</p></td>
229 <td class="parameter_annotations"> </td>
230 </tr>
231 <tr>
232 <td class="parameter_name"><p>buffer</p></td>
233 <td class="parameter_description"><p>an <a class="link" href="harfbuzz-Buffers.html#hb-buffer-t"><span class="type">hb_buffer_t</span></a> to shape</p></td>
234 <td class="parameter_annotations"> </td>
235 </tr>
236 <tr>
237 <td class="parameter_name"><p>features</p></td>
238 <td class="parameter_description"><p> an array of user
239 specified <a class="link" href="harfbuzz-Shaping.html#hb-feature-t"><span class="type">hb_feature_t</span></a> or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td>
240 <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=num_features][<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
241 </tr>
242 <tr>
243 <td class="parameter_name"><p>num_features</p></td>
244 <td class="parameter_description"><p>the length of <em class="parameter"><code>features</code></em>
245 array</p></td>
246 <td class="parameter_annotations"> </td>
247 </tr>
248 </tbody>
249 </table></div>
250 </div>
251 <p class="since">Since 0.9.2</p>
252 </div>
253 <hr>
254 <div class="refsect2">
255 <a name="hb-shape-full"></a><h3>hb_shape_full ()</h3>
256 <pre class="programlisting"><a class="link" href="harfbuzz-hb-common.html#hb-bool-t" title="hb_bool_t"><span class="returnvalue">hb_bool_t</span></a>
257 hb_shape_full (<em class="parameter"><code><a class="link" href="harfbuzz-hb-font.html#hb-font-t"><span class="type">hb_font_t</span></a> *font</code></em>,
258                <em class="parameter"><code><a class="link" href="harfbuzz-Buffers.html#hb-buffer-t"><span class="type">hb_buffer_t</span></a> *buffer</code></em>,
259                <em class="parameter"><code>const <a class="link" href="harfbuzz-Shaping.html#hb-feature-t"><span class="type">hb_feature_t</span></a> *features</code></em>,
260                <em class="parameter"><code>unsigned <span class="type">int</span> num_features</code></em>,
261                <em class="parameter"><code>const <span class="type">char</span> * const *shaper_list</code></em>);</pre>
262 <p>See <a class="link" href="harfbuzz-Shaping.html#hb-shape" title="hb_shape ()"><code class="function">hb_shape()</code></a> for details. If <em class="parameter"><code>shaper_list</code></em>
263  is not <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, the specified
264 shapers will be used in the given order, otherwise the default shapers list
265 will be used.</p>
266 <div class="refsect3">
267 <a name="id-1.3.3.9.9.5.5"></a><h4>Parameters</h4>
268 <div class="informaltable"><table width="100%" border="0">
269 <colgroup>
270 <col width="150px" class="parameters_name">
271 <col class="parameters_description">
272 <col width="200px" class="parameters_annotations">
273 </colgroup>
274 <tbody>
275 <tr>
276 <td class="parameter_name"><p>font</p></td>
277 <td class="parameter_description"><p>an <a class="link" href="harfbuzz-hb-font.html#hb-font-t"><span class="type">hb_font_t</span></a> to use for shaping</p></td>
278 <td class="parameter_annotations"> </td>
279 </tr>
280 <tr>
281 <td class="parameter_name"><p>buffer</p></td>
282 <td class="parameter_description"><p>an <a class="link" href="harfbuzz-Buffers.html#hb-buffer-t"><span class="type">hb_buffer_t</span></a> to shape</p></td>
283 <td class="parameter_annotations"> </td>
284 </tr>
285 <tr>
286 <td class="parameter_name"><p>features</p></td>
287 <td class="parameter_description"><p> an array of user
288 specified <a class="link" href="harfbuzz-Shaping.html#hb-feature-t"><span class="type">hb_feature_t</span></a> or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td>
289 <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=num_features][<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
290 </tr>
291 <tr>
292 <td class="parameter_name"><p>num_features</p></td>
293 <td class="parameter_description"><p>the length of <em class="parameter"><code>features</code></em>
294 array</p></td>
295 <td class="parameter_annotations"> </td>
296 </tr>
297 <tr>
298 <td class="parameter_name"><p>shaper_list</p></td>
299 <td class="parameter_description"><p> a <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>-terminated
300 array of shapers to use or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td>
301 <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> zero-terminated=1][<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
302 </tr>
303 </tbody>
304 </table></div>
305 </div>
306 <div class="refsect3">
307 <a name="id-1.3.3.9.9.5.6"></a><h4>Returns</h4>
308 <p> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if all shapers failed, <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> otherwise</p>
309 <p></p>
310 </div>
311 <p class="since">Since 0.9.2</p>
312 </div>
313 <hr>
314 <div class="refsect2">
315 <a name="hb-shape-list-shapers"></a><h3>hb_shape_list_shapers ()</h3>
316 <pre class="programlisting">const <span class="returnvalue">char</span> **
317 hb_shape_list_shapers (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
318 <p>Retrieves the list of shapers supported by HarfBuzz.</p>
319 <div class="refsect3">
320 <a name="id-1.3.3.9.9.6.5"></a><h4>Returns</h4>
321 <p> an array of
322 constant strings. </p>
323 <p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>][<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> zero-terminated=1]</span></p>
324 </div>
325 <p class="since">Since 0.9.2</p>
326 </div>
327 </div>
328 <div class="refsect1">
329 <a name="harfbuzz-Shaping.other_details"></a><h2>Types and Values</h2>
330 <div class="refsect2">
331 <a name="hb-feature-t-struct"></a><h3>hb_feature_t</h3>
332 <pre class="programlisting">typedef struct {
333   hb_tag_t      tag;
334   uint32_t      value;
335   unsigned int  start;
336   unsigned int  end;
337 } hb_feature_t;
338 </pre>
339 </div>
340 </div>
341 </div>
342 <div class="footer">
343 <hr>
344           Generated by GTK-Doc V1.20</div>
345 </body>
346 </html>